ruby_raider 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/integration.yml +5 -5
- data/.github/workflows/selenium.yml +22 -0
- data/.github/workflows/watir.yml +22 -0
- data/README.md +24 -18
- data/lib/generators/automation/templates/account.tt +2 -2
- data/lib/generators/automation/templates/appium_caps.tt +2 -2
- data/lib/generators/automation/templates/home.tt +3 -2
- data/lib/generators/automation/templates/login.tt +2 -2
- data/lib/generators/automation/templates/page.tt +4 -4
- data/lib/generators/automation/templates/partials/element.tt +1 -1
- data/lib/generators/automation/templates/partials/home_page_selector.tt +2 -2
- data/lib/generators/automation/templates/partials/initialize_selector.tt +1 -1
- data/lib/generators/automation/templates/partials/pdp_page_selector.tt +2 -2
- data/lib/generators/automation/templates/partials/selenium_login.tt +1 -1
- data/lib/generators/automation/templates/partials/url_methods.tt +1 -1
- data/lib/generators/automation/templates/partials/visit_method.tt +2 -2
- data/lib/generators/automation/templates/pdp.tt +3 -2
- data/lib/generators/cucumber/templates/env.tt +6 -7
- data/lib/generators/cucumber/templates/feature.tt +7 -3
- data/lib/generators/cucumber/templates/partials/appium_env.tt +1 -4
- data/lib/generators/cucumber/templates/partials/driver_world.tt +4 -3
- data/lib/generators/cucumber/templates/partials/mobile_steps.tt +7 -7
- data/lib/generators/cucumber/templates/partials/selenium_env.tt +6 -6
- data/lib/generators/cucumber/templates/partials/watir_env.tt +1 -4
- data/lib/generators/cucumber/templates/partials/web_steps.tt +10 -3
- data/lib/generators/cucumber/templates/steps.tt +3 -3
- data/lib/generators/cucumber/templates/world.tt +1 -1
- data/lib/generators/generator.rb +15 -5
- data/lib/generators/helper_generator.rb +1 -1
- data/lib/generators/invoke_generators.rb +2 -6
- data/lib/generators/menu_generator.rb +7 -21
- data/lib/generators/rspec/rspec_generator.rb +1 -1
- data/lib/generators/rspec/templates/spec.tt +7 -7
- data/lib/generators/templates/common/config.tt +1 -1
- data/lib/generators/templates/common/gemfile.tt +13 -13
- data/lib/generators/templates/common/partials/automation_gems.tt +1 -1
- data/lib/generators/templates/common/partials/web_config.tt +1 -1
- data/lib/generators/templates/common/read_me.tt +21 -15
- data/lib/generators/templates/common/rubocop.tt +1 -1
- data/lib/generators/templates/helpers/allure_helper.tt +2 -2
- data/lib/generators/templates/helpers/driver_helper.tt +10 -8
- data/lib/generators/templates/helpers/partials/allure_imports.tt +1 -1
- data/lib/generators/templates/helpers/partials/allure_requirements.tt +1 -1
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +3 -3
- data/lib/generators/templates/helpers/partials/quit_driver.tt +5 -6
- data/lib/generators/templates/helpers/partials/screenshot.tt +6 -7
- data/lib/generators/templates/helpers/spec_helper.tt +5 -5
- data/lib/utilities/utilities.rb +1 -1
- data/lib/version +1 -1
- data/spec/integration/commands/scaffolding_commands_spec.rb +1 -1
- data/spec/integration/commands/utility_commands_spec.rb +3 -3
- data/spec/integration/generators/actions_generator_spec.rb +1 -1
- data/spec/integration/generators/automation_generator_spec.rb +4 -4
- data/spec/integration/generators/common_generator_spec.rb +13 -20
- data/spec/integration/generators/cucumber_generator_spec.rb +2 -2
- data/spec/integration/generators/helpers_generator_spec.rb +13 -13
- data/spec/integration/generators/rspec_generator_spec.rb +2 -2
- data/spec/{support → integration}/settings_helper.rb +1 -3
- data/spec/integration/spec_helper.rb +33 -0
- data/spec/system/selenium_spec.rb +40 -0
- data/spec/system/watir_spec.rb +40 -0
- metadata +8 -6
- data/.github/workflows/rspec_selenium.yml +0 -42
- data/.github/workflows/rspec_watir.yml +0 -42
- data/spec/spec_helper.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 279c26bb0d8d1a27d95b0510587e6828e2164c84a334c41b84b57db98f04867c
|
4
|
+
data.tar.gz: c024426fe0bbb58b912ac6bf07a0867110dc340c4946d4e3eab499e25a38b2ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '028fcaca7bd181054203e2d50d54fa2399608725379ffd63e003f2efd43f9b6274fa9a014e7ffb0da28eff2f077b48fb4d4d6ae5c53f3db9f14f1958f4e451e4'
|
7
|
+
data.tar.gz: 9ef33293321c2f08b1942c2c82d2bc0be57f9245335be00bcefe4d145a5c7abb842e5274ba313e21dec17e756cbf6fc4f9fa7f4d74887e630791a4ae0adbde91
|
@@ -8,13 +8,13 @@ jobs:
|
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
|
10
10
|
steps:
|
11
|
+
- name: Checkout repository
|
12
|
+
uses: actions/checkout@v4
|
13
|
+
|
11
14
|
- name: Set up Ruby
|
12
|
-
uses: ruby/setup-ruby@
|
15
|
+
uses: ruby/setup-ruby@v1
|
13
16
|
with:
|
14
|
-
ruby-version:
|
15
|
-
|
16
|
-
- name: Checkout repository
|
17
|
-
uses: actions/checkout@v3
|
17
|
+
ruby-version: 3.1.0
|
18
18
|
|
19
19
|
- name: Install gems
|
20
20
|
run: bundle install
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Selenium Tests on Ubuntu
|
2
|
+
on: [ pull_request ]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
build:
|
6
|
+
name: Selenium based frameworks pipeline
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- name: Checkout repository
|
11
|
+
uses: actions/checkout@v4
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.1.0
|
17
|
+
|
18
|
+
- name: Install gems
|
19
|
+
run: bundle install
|
20
|
+
|
21
|
+
- name: Build and run system tests
|
22
|
+
run: rspec spec/system/selenium_spec.rb
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Watir Tests on Ubuntu
|
2
|
+
on: [ pull_request ]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
build:
|
6
|
+
name: Watir based frameworks pipeline
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- name: Checkout repository
|
11
|
+
uses: actions/checkout@v4
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.1.0
|
17
|
+
|
18
|
+
- name: Install gems
|
19
|
+
run: bundle install
|
20
|
+
|
21
|
+
- name: Build and run system tests
|
22
|
+
run: rspec spec/system/watir_spec.rb
|
data/README.md
CHANGED
@@ -33,21 +33,25 @@
|
|
33
33
|
Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
34
34
|
|
35
35
|
### At the moment Ruby Raider supports generating the following frameworks:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
|
37
|
+
| Web Testing Framework | Visual Testing Framework | Mobile Testing Framework | Accessibility Testing Framework |
|
38
|
+
|-----------------------|-----------------------------------|------------------------------------|---------------------------------|
|
39
|
+
| Cucumber and Selenium | Cucumber, Applitools and Selenium | Cucumber and Appium for IOS | Cucumber and Axe for web |
|
40
|
+
| Rspec and Selenium | Rspec, Applitools and Selenium | Rspec and Appium for IOS | Rspec and Axe for web |
|
41
|
+
| Cucumber and Watir | | Cucumber and Appium for Android | |
|
42
|
+
| Rspec and Watir | | Rspec and Appium for Android | |
|
43
|
+
| | | Cucumber and Appium Cross-platform | |
|
44
|
+
| | | Rspec and Appium Cross-platform | |
|
44
45
|
|
45
46
|
***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
|
46
|
-
***Remember to use the full path of the app that you download in the capabilities file and start the server using one of
|
47
|
+
***Remember to use the full path of the app that you download in the capabilities file and start the server using one of
|
48
|
+
the commands below:***
|
49
|
+
|
47
50
|
```ruby
|
48
51
|
raider u start_appium
|
49
|
-
appium
|
52
|
+
appium --base - path /wd/ hub
|
50
53
|
```
|
54
|
+
|
51
55
|
***In order to run the visual tests with applitools, you need to create an account and get your api key, you can read
|
52
56
|
more [here](https://applitools.com/docs/topics/overview/obtain-api-key.html#:~:text=If%20you%20already%20have%20an,Your%20key%20will%20be%20displayed.)
|
53
57
|
.***
|
@@ -81,13 +85,13 @@ Select the ones you will like to work with.
|
|
81
85
|
If you already know which frameworks you want to use, you can do:
|
82
86
|
|
83
87
|
```ruby
|
84
|
-
raider new [name_of_project] -p framework:[framework] automation:[automation_type] visual:[boolean] axe:[boolean]
|
88
|
+
raider new [name_of_project] - p framework : [framework] automation : [automation_type] visual : [boolean] axe : [boolean]
|
85
89
|
```
|
86
90
|
|
87
91
|
An example of the command above would be:
|
88
92
|
|
89
93
|
```ruby
|
90
|
-
raider new test_project -p framework:rspec automation:selenium visual:false axe:true
|
94
|
+
raider new test_project -p framework : rspec automation: selenium visual : false axe : true
|
91
95
|
```
|
92
96
|
|
93
97
|
Where [frameworks] is a comma separated list of the frameworks you want to use.
|
@@ -97,12 +101,12 @@ Where [frameworks] is a comma separated list of the frameworks you want to use.
|
|
97
101
|
###### Anything between square brackets([...]) is where your imput goes
|
98
102
|
|
99
103
|
```ruby
|
100
|
-
Commands:
|
104
|
+
Commands :
|
101
105
|
raider generate # Provides access to all the scaffolding commands
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
+
raider help [COMMAND] # Describe available commands or one specific command
|
107
|
+
raider new [PROJECT_NAME] # Creates a new framework based on settings picked
|
108
|
+
raider utility # Provides access to all the utility commands
|
109
|
+
raider version # It shows the version of Ruby Raider you are currently using
|
106
110
|
```
|
107
111
|
|
108
112
|
All the basic commands have their corresponding shortcut:
|
@@ -113,6 +117,7 @@ All the basic commands have their corresponding shortcut:
|
|
113
117
|
* v for version
|
114
118
|
|
115
119
|
### Scaffolding Commands
|
120
|
+
|
116
121
|
Ruby Raider also supports scaffolding:
|
117
122
|
|
118
123
|
* To create a new page object you do: ```raider g page [PAGE_NAME]```
|
@@ -134,9 +139,10 @@ raider u path [PATH_NAME] - -helper or -h
|
|
134
139
|
|
135
140
|
If you don't specify an option, path will assume you want to change the default path for pages.
|
136
141
|
|
137
|
-
|
138
142
|
### Appium Server Command
|
143
|
+
|
139
144
|
To initialise Appium server run this command:
|
145
|
+
|
140
146
|
```ruby
|
141
147
|
raider u start_appium
|
142
148
|
```
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%- if
|
1
|
+
<%- if selenium_based? -%>
|
2
2
|
<%=- ERB.new(File.read(File.expand_path('./partials/selenium_account.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
3
|
-
<%- elsif
|
3
|
+
<%- elsif watir? -%>
|
4
4
|
<%=- ERB.new(File.read(File.expand_path('./partials/watir_account.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
5
5
|
<%- end -%>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<% if
|
1
|
+
<% if ios? %>
|
2
2
|
<%= ERB.new(File.read(File.expand_path('./partials/ios_caps.tt', __dir__))).result(binding) -%>
|
3
|
-
<% elsif
|
3
|
+
<% elsif android? %>
|
4
4
|
<%= ERB.new(File.read(File.expand_path('./partials/android_caps.tt', __dir__))).result(binding) -%>
|
5
5
|
<% else %>
|
6
6
|
<%= ERB.new(File.read(File.expand_path('./partials/cross_platform_caps.tt', __dir__))).result(binding) -%>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../abstract/page'
|
4
|
+
|
4
5
|
class Home < Page
|
5
6
|
|
6
7
|
# Actions
|
@@ -14,6 +15,6 @@ class Home < Page
|
|
14
15
|
# Elements
|
15
16
|
|
16
17
|
def backpack_image
|
17
|
-
<%= ERB.new(File.read(File.expand_path('./partials/home_page_selector.tt', __dir__)), trim_mode: '-').result(binding)
|
18
|
+
<%= ERB.new(File.read(File.expand_path('./partials/home_page_selector.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
18
19
|
end
|
19
|
-
end
|
20
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%- if
|
1
|
+
<%- if selenium_based? -%>
|
2
2
|
<%=- ERB.new(File.read(File.expand_path('./partials/selenium_login.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
3
|
-
<%- elsif
|
3
|
+
<%- elsif watir? -%>
|
4
4
|
<%=- ERB.new(File.read(File.expand_path('./partials/watir_login.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
5
5
|
<%- end -%>
|
@@ -3,7 +3,7 @@ require_relative '../components/header'
|
|
3
3
|
<%- end -%>
|
4
4
|
|
5
5
|
class Page
|
6
|
-
<%- if
|
6
|
+
<%- if cross_platform? -%>
|
7
7
|
include AppiumHelper
|
8
8
|
<%- end -%>
|
9
9
|
<%=- ERB.new(File.read(File.expand_path('./partials/initialize_selector.tt', __dir__))).result(binding) -%>
|
@@ -14,17 +14,17 @@ class Page
|
|
14
14
|
self.class.to_s.sub('Page', ' Page')
|
15
15
|
end
|
16
16
|
|
17
|
-
<%- if
|
17
|
+
<%- if selenium_based? -%>
|
18
18
|
# Components
|
19
19
|
|
20
20
|
def header
|
21
21
|
Header.new(driver.find_element(id: 'customer_menu_top'))
|
22
22
|
end
|
23
|
-
<%- elsif
|
23
|
+
<%- elsif watir? -%>
|
24
24
|
# Components
|
25
25
|
|
26
26
|
def header
|
27
27
|
Header.new(browser.element(id: 'customer_menu_top'))
|
28
28
|
end
|
29
29
|
<%- end -%>
|
30
|
-
end
|
30
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%- if
|
1
|
+
<%- if ios? -%>
|
2
2
|
driver.find_element(predicate: 'label == "Sauce Labs Backpack"')
|
3
|
-
<%- elsif
|
3
|
+
<%- elsif android? -%>
|
4
4
|
driver.find_element(xpath: '(//android.view.ViewGroup[@content-desc="store item"])[1]/android.view.ViewGroup[1]')
|
5
5
|
<%- else -%>
|
6
6
|
element(ios: { predicate: 'label == "Sauce Labs Backpack"' },
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%- if
|
1
|
+
<%- if ios? -%>
|
2
2
|
driver.find_element(accessibility_id: 'Add To Cart button')
|
3
|
-
<%- elsif
|
3
|
+
<%- elsif android? -%>
|
4
4
|
driver.find_element(xpath: '//android.view.ViewGroup[@content-desc="Add To Cart button"]/android.widget.TextView')
|
5
5
|
<%- else -%>
|
6
6
|
element(ios: { accessibility_id: 'Add To Cart button' },
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<% if
|
1
|
+
<% if web? %>
|
2
2
|
def visit(*page)
|
3
|
-
<% if
|
3
|
+
<% if selenium_based? %>@driver.navigate.to full_url(page.first) <% else %>@browser.goto full_url(page.first)<% end %>
|
4
4
|
end
|
5
5
|
<% end %>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative '../abstract/page'
|
2
|
+
|
2
3
|
class Pdp < Page
|
3
4
|
|
4
5
|
# Actions
|
@@ -12,6 +13,6 @@ class Pdp < Page
|
|
12
13
|
# Elements
|
13
14
|
|
14
15
|
def add_to_cart_button
|
15
|
-
<%= ERB.new(File.read(File.expand_path('./partials/pdp_page_selector.tt', __dir__)), trim_mode: '-').result(binding)
|
16
|
+
<%= ERB.new(File.read(File.expand_path('./partials/pdp_page_selector.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
16
17
|
end
|
17
|
-
end
|
18
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
<%-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<%=- ERB.new(File.read(File.expand_path('./partials/watir_env.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
1
|
+
<%- if selenium_based? -%>
|
2
|
+
<%= ERB.new(File.read(File.expand_path('./partials/selenium_env.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
3
|
+
<%- elsif mobile? -%>
|
4
|
+
<%= ERB.new(File.read(File.expand_path('./partials/appium_env.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
6
5
|
<%- else -%>
|
7
|
-
|
8
|
-
<%- end -%>
|
6
|
+
<%= ERB.new(File.read(File.expand_path('./partials/watir_env.tt', __dir__)), trim_mode: '-').result(binding) -%>
|
7
|
+
<%- end -%>
|
@@ -1,16 +1,20 @@
|
|
1
|
-
|
1
|
+
<%- if web? -%>
|
2
2
|
Feature: Login Page
|
3
3
|
|
4
4
|
Scenario: A user can login
|
5
5
|
Given I'm a registered user on the login page
|
6
6
|
When I login with my credentials
|
7
|
+
<%- if axe? -%>
|
8
|
+
Then the page should be axe clean
|
9
|
+
<%- else -%>
|
7
10
|
Then I'm logged in
|
11
|
+
<% end -%>
|
8
12
|
|
9
|
-
|
13
|
+
<%- else -%>
|
10
14
|
Feature: Home Page
|
11
15
|
|
12
16
|
Scenario: A user can go to the product details page
|
13
17
|
Given I'm an anonymous user on the home page
|
14
18
|
When I select one of the products
|
15
19
|
Then I'm redirected to the product details page
|
16
|
-
|
20
|
+
<%- end %>
|
@@ -1,8 +1,5 @@
|
|
1
1
|
require 'tmpdir'
|
2
2
|
require_relative '../../helpers/allure_helper'
|
3
|
-
require_relative '../../helpers/driver_helper'
|
4
|
-
|
5
|
-
include DriverHelper
|
6
3
|
|
7
4
|
Before do
|
8
5
|
AllureHelper.configure
|
@@ -15,4 +12,4 @@ After do |scenario|
|
|
15
12
|
AllureHelper.add_screenshot(scenario.name, screenshot)
|
16
13
|
end
|
17
14
|
driver.quit_driver
|
18
|
-
end
|
15
|
+
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require_relative '../../helpers/driver_helper'
|
2
|
-
<%- if
|
2
|
+
<%- if visual? -%>
|
3
3
|
require_relative '../../helpers/visual_helper'
|
4
4
|
<%- end -%>
|
5
|
-
<%- if
|
5
|
+
<%- if selenium_based? -%>
|
6
6
|
require_relative '../../models/user_factory'
|
7
7
|
|
8
|
-
World(DriverHelper<%- if
|
8
|
+
World(DriverHelper<%- if visual? -%>, VisualHelper<%- end -%>)
|
9
9
|
<%- else -%>
|
10
|
+
|
10
11
|
World(DriverHelper)
|
11
12
|
<%- end -%>
|
@@ -1,20 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
<%- if cross_platform? -%>
|
4
4
|
require_relative '../../helpers/appium_helper'
|
5
5
|
<%- end -%>
|
6
6
|
require_relative '../../page_objects/pages/home'
|
7
7
|
require_relative '../../page_objects/pages/pdp'
|
8
8
|
|
9
9
|
Given("I'm an anonymous user on the home page") do
|
10
|
-
|
10
|
+
@home_page = Home.new(driver)
|
11
11
|
end
|
12
12
|
|
13
13
|
When('I select one of the products') do
|
14
|
-
|
14
|
+
@home_page.go_to_backpack_pdp
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
17
|
+
Then("I'm redirected to the product details page") do
|
18
|
+
pdp_page = Pdp.new(driver)
|
19
|
+
expect(pdp_page.add_to_cart_text).to eq 'Add To Cart'
|
20
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%- if visual_automation -%>
|
2
1
|
# frozen_string_literal: true
|
2
|
+
<%- if visual? -%>
|
3
3
|
|
4
4
|
require 'tmpdir'
|
5
5
|
require_relative '../../helpers/allure_helper'
|
@@ -30,14 +30,14 @@ After do |scenario|
|
|
30
30
|
end
|
31
31
|
|
32
32
|
<%- else -%>
|
33
|
-
# frozen_string_literal: true
|
34
33
|
|
34
|
+
<%- if axe? && cucumber? -%>
|
35
|
+
require 'axe-rspec'
|
36
|
+
<%- end -%>
|
37
|
+
require 'rspec'
|
35
38
|
require 'tmpdir'
|
36
|
-
require_relative '../../helpers/driver_helper'
|
37
39
|
require_relative '../../helpers/allure_helper'
|
38
40
|
|
39
|
-
include DriverHelper
|
40
|
-
|
41
41
|
Before do
|
42
42
|
driver.manage.window.maximize
|
43
43
|
end
|
@@ -49,4 +49,4 @@ After do |scenario|
|
|
49
49
|
end
|
50
50
|
driver.quit
|
51
51
|
end
|
52
|
-
<%- end -%>
|
52
|
+
<%- end -%>
|
@@ -2,9 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'tmpdir'
|
4
4
|
require_relative '../../helpers/allure_helper'
|
5
|
-
require_relative '../../helpers/browser_helper'
|
6
|
-
|
7
|
-
include BrowserHelper
|
8
5
|
|
9
6
|
Before do
|
10
7
|
browser.window.maximize
|
@@ -16,4 +13,4 @@ After do |scenario|
|
|
16
13
|
AllureHelper.add_screenshot(scenario.name, screenshot)
|
17
14
|
end
|
18
15
|
browser.quit
|
19
|
-
end
|
16
|
+
end
|
@@ -5,7 +5,7 @@ require_relative '../../page_objects/pages/login'
|
|
5
5
|
|
6
6
|
Given("I'm a {user} on the login page") do |user|
|
7
7
|
@user = user
|
8
|
-
@login_page = Login.new(<% if
|
8
|
+
@login_page = Login.new(<% if watir? %>browser<% else %>driver<% end %>)
|
9
9
|
@login_page.visit
|
10
10
|
end
|
11
11
|
|
@@ -13,11 +13,18 @@ When('I login with my credentials') do
|
|
13
13
|
@login_page.login(@user['username'], @user['password'])
|
14
14
|
end
|
15
15
|
|
16
|
+
<%- if axe? -%>
|
17
|
+
Then('the page should be axe clean') do
|
18
|
+
account = Account.new(driver)
|
19
|
+
expect(account.page).to be_axe_clean
|
20
|
+
end
|
21
|
+
<%- else -%>
|
16
22
|
Then("I'm logged in") do
|
17
|
-
account_page = Account.new(<% if
|
18
|
-
<%- if
|
23
|
+
account_page = Account.new(<% if watir? %>browser<% else %>driver<% end %>)
|
24
|
+
<%- if visual? -%>
|
19
25
|
check_page account_page
|
20
26
|
<%- else -%>
|
21
27
|
expect(account_page.header.customer_name).to eq "Welcome back #{@user['name']}"
|
22
28
|
<%- end -%>
|
23
29
|
end
|
30
|
+
<%- end -%>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
1
|
+
<%- if web? -%>
|
2
2
|
<%= ERB.new(File.read(File.expand_path('./partials/web_steps.tt', __dir__)), trim_mode: '-').result(binding).strip! -%>
|
3
|
-
|
3
|
+
<%- else -%>
|
4
4
|
<%= ERB.new(File.read(File.expand_path('./partials/mobile_steps.tt', __dir__)), trim_mode: '-').result(binding).strip! -%>
|
5
|
-
|
5
|
+
<%- end -%>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%- if
|
1
|
+
<%- if watir? -%>
|
2
2
|
<%=- ERB.new(File.read(File.expand_path('./partials/watir_world.tt', __dir__)), trim_mode: '-').result(binding).strip! -%>
|
3
3
|
<%- else -%>
|
4
4
|
<%=- ERB.new(File.read(File.expand_path('./partials/driver_world.tt', __dir__)), trim_mode: '-').result(binding).strip! -%>
|
data/lib/generators/generator.rb
CHANGED
@@ -8,8 +8,6 @@ class Generator < Thor::Group
|
|
8
8
|
argument :automation
|
9
9
|
argument :framework
|
10
10
|
argument :name
|
11
|
-
argument :visual_automation, optional: true
|
12
|
-
argument :axe_support, optional: true
|
13
11
|
|
14
12
|
def self.source_paths
|
15
13
|
base_path = File.dirname(__FILE__)
|
@@ -38,6 +36,14 @@ class Generator < Thor::Group
|
|
38
36
|
(args & %w[android ios]).count.positive?
|
39
37
|
end
|
40
38
|
|
39
|
+
def ios?
|
40
|
+
args.include?('ios')
|
41
|
+
end
|
42
|
+
|
43
|
+
def android?
|
44
|
+
args.include?('android')
|
45
|
+
end
|
46
|
+
|
41
47
|
def rspec?
|
42
48
|
args.include?('rspec')
|
43
49
|
end
|
@@ -47,7 +53,7 @@ class Generator < Thor::Group
|
|
47
53
|
end
|
48
54
|
|
49
55
|
def visual?
|
50
|
-
args
|
56
|
+
args.include?('applitools')
|
51
57
|
end
|
52
58
|
|
53
59
|
def watir?
|
@@ -55,11 +61,15 @@ class Generator < Thor::Group
|
|
55
61
|
end
|
56
62
|
|
57
63
|
def web?
|
58
|
-
(args & (%w[selenium watir])).count.positive?
|
64
|
+
(args & (%w[selenium watir axe applitools])).count.positive?
|
59
65
|
end
|
60
66
|
|
61
67
|
def axe?
|
62
|
-
args.
|
68
|
+
args.include?('axe')
|
69
|
+
end
|
70
|
+
|
71
|
+
def selenium_based?
|
72
|
+
(args & %w[selenium axe applitools]).count.positive?
|
63
73
|
end
|
64
74
|
|
65
75
|
private
|
@@ -19,9 +19,7 @@ module InvokeGenerators
|
|
19
19
|
automation: structure[:automation],
|
20
20
|
framework:,
|
21
21
|
generator:,
|
22
|
-
name: structure[:name]
|
23
|
-
visual: to_bool(structure[:visual]),
|
24
|
-
axe_support: to_bool(structure[:axe_support])
|
22
|
+
name: structure[:name]
|
25
23
|
})
|
26
24
|
end
|
27
25
|
end
|
@@ -34,9 +32,7 @@ module InvokeGenerators
|
|
34
32
|
Object.const_get("#{structure[:generator]}Generator")
|
35
33
|
.new([structure[:automation],
|
36
34
|
structure[:framework],
|
37
|
-
structure[:name]
|
38
|
-
structure[:visual],
|
39
|
-
structure[:axe_support]]).invoke_all
|
35
|
+
structure[:name]]).invoke_all
|
40
36
|
end
|
41
37
|
|
42
38
|
def to_bool(string)
|