ruby_raider 0.9.3 → 0.9.4
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/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/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/version +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8f98b7b75772a1d20015806b95e8194b357031dc4828181b0d3db2ed3bf9a65
|
|
4
|
+
data.tar.gz: 6ef9b9c02c12d85fc2da88706c92051fc19fd3da4788613038771b4ecbdbe5b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 85ab371da3692e9559efaff063b8403716c8f947b93d9504c65cd9ae7531c791c7545c82473661879b35a5896de664d103ca0d41cf526408a66dfc6e18d52700
|
|
7
|
+
data.tar.gz: 417edbb4b68ab62d0eba0d8c6eea8e60ef6df077f168d2d2fafb7019cc7a50b5528c086256b3d3a03c01ccf20abcc0e6018c572cd019c99c964bb5205c5ab4fe
|
|
@@ -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)
|
|
@@ -21,14 +21,6 @@ class MenuGenerator
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def choose_visual_automation
|
|
25
|
-
prompt.select('Do you want to add visual automation with Applitools?', yes_no_menu_choices)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def choose_axe_support
|
|
29
|
-
prompt.select('Do you want to add Axe accessibility testing tool?', yes_no_menu_choices)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
24
|
def choose_test_framework(automation)
|
|
33
25
|
return choose_mobile_platform if automation == 'appium'
|
|
34
26
|
|
|
@@ -39,9 +31,7 @@ class MenuGenerator
|
|
|
39
31
|
structure = {
|
|
40
32
|
automation: options[:automation],
|
|
41
33
|
framework: options[:framework],
|
|
42
|
-
name: @name
|
|
43
|
-
visual: options[:visual_automation],
|
|
44
|
-
axe_support: options[:axe_support]
|
|
34
|
+
name: @name
|
|
45
35
|
}
|
|
46
36
|
generate_framework(structure)
|
|
47
37
|
system "cd #{name} && gem install bundler && bundle install"
|
|
@@ -66,26 +56,20 @@ class MenuGenerator
|
|
|
66
56
|
end
|
|
67
57
|
end
|
|
68
58
|
|
|
69
|
-
FrameworkOptions = Struct.new(:automation, :framework
|
|
59
|
+
FrameworkOptions = Struct.new(:automation, :framework)
|
|
70
60
|
|
|
71
61
|
def create_framework_options(params)
|
|
72
|
-
FrameworkOptions.new(params[:automation], params[:framework]
|
|
62
|
+
FrameworkOptions.new(params[:automation], params[:framework])
|
|
73
63
|
end
|
|
74
64
|
|
|
75
65
|
def create_framework(framework, automation_type)
|
|
76
|
-
visual_automation = choose_visual_automation if %w[selenium].include?(automation_type)
|
|
77
|
-
axe = choose_axe_support if automation_type == 'selenium' && framework == 'Rspec' && visual_automation == false
|
|
78
66
|
options = create_framework_options(automation: automation_type,
|
|
79
|
-
framework: framework.downcase
|
|
80
|
-
visual_automation:,
|
|
81
|
-
axe_support: axe)
|
|
67
|
+
framework: framework.downcase)
|
|
82
68
|
|
|
83
69
|
# Print the chosen options
|
|
84
70
|
puts 'Chosen Options:'
|
|
85
71
|
puts " Automation Type: #{options[:automation]}"
|
|
86
72
|
puts " Framework: #{options[:framework]}"
|
|
87
|
-
puts " Visual Automation: #{options[:visual_automation]}"
|
|
88
|
-
puts " Axe Support: #{options[:axe_support]}"
|
|
89
73
|
|
|
90
74
|
set_up_framework(options)
|
|
91
75
|
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
|
@@ -100,9 +84,11 @@ class MenuGenerator
|
|
|
100
84
|
end
|
|
101
85
|
|
|
102
86
|
def select_automation_framework(menu)
|
|
103
|
-
menu.choice :Appium, -> { choose_test_framework('appium') }
|
|
104
87
|
menu.choice :Selenium, -> { choose_test_framework('selenium') }
|
|
88
|
+
menu.choice :Appium, -> { choose_test_framework('appium') }
|
|
105
89
|
menu.choice :Watir, -> { choose_test_framework('watir') }
|
|
90
|
+
menu.choice :Applitools, -> { choose_test_framework('applitools') }
|
|
91
|
+
menu.choice :Axe, -> { choose_test_framework('axe') }
|
|
106
92
|
menu.choice :Quit, -> { exit }
|
|
107
93
|
end
|
|
108
94
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%- if
|
|
1
|
+
<%- if selenium_based? || watir? -%>
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative '../helpers/spec_helper'
|
|
@@ -33,13 +33,13 @@ describe 'Login' do
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
|
-
<%- elsif
|
|
36
|
+
<%- elsif selenium_based? || watir? -%>
|
|
37
37
|
describe 'Login' do
|
|
38
38
|
subject(:header) { account_page.header.customer_name }
|
|
39
39
|
|
|
40
40
|
let(:user) { ModelFactory.for('users')['registered user'] }
|
|
41
|
-
let(:login_page) { Login.new(<% if
|
|
42
|
-
let(:account_page) { Account.new(<% if
|
|
41
|
+
let(:login_page) { Login.new(<% if watir? -%>browser<% else -%>driver<% end -%>) }
|
|
42
|
+
let(:account_page) { Account.new(<% if watir? -%>browser<% else -%>driver<% end -%>) }
|
|
43
43
|
|
|
44
44
|
before do
|
|
45
45
|
login_page.visit
|
|
@@ -50,7 +50,7 @@ describe 'Login' do
|
|
|
50
50
|
let(:password) { user['password'] }
|
|
51
51
|
|
|
52
52
|
it 'can successfully log in' do
|
|
53
|
-
<%- if
|
|
53
|
+
<%- if visual? -%>
|
|
54
54
|
check_page account_page
|
|
55
55
|
<%- else -%>
|
|
56
56
|
expect(header).to eq "Welcome back #{user['name']}"
|
|
@@ -62,7 +62,7 @@ describe 'Login' do
|
|
|
62
62
|
let(:password) { 'wrongPassword' }
|
|
63
63
|
|
|
64
64
|
it 'cannot log in' do
|
|
65
|
-
<%- if
|
|
65
|
+
<%- if visual? -%>
|
|
66
66
|
check_page login_page
|
|
67
67
|
<%- else -%>
|
|
68
68
|
expect(header).to eq 'Login or register'
|
|
@@ -72,7 +72,7 @@ describe 'Login' do
|
|
|
72
72
|
end
|
|
73
73
|
<%- end -%>
|
|
74
74
|
<%- else -%>
|
|
75
|
-
<% if
|
|
75
|
+
<% if cross_platform? -%>
|
|
76
76
|
require_relative '../helpers/appium_helper'
|
|
77
77
|
<%- end -%>
|
|
78
78
|
require_relative '../helpers/spec_helper'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% if
|
|
1
|
+
<% if mobile? -%>
|
|
2
2
|
<%= ERB.new(File.read(File.expand_path('./partials/mobile_config.tt', __dir__))).result(binding) %>
|
|
3
3
|
<% else -%>
|
|
4
4
|
<%= ERB.new(File.read(File.expand_path('./partials/web_config.tt', __dir__)), trim_mode: '-').result(binding) %>
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
3
|
gem 'activesupport'
|
|
4
|
-
|
|
4
|
+
<%- if cucumber? -%>
|
|
5
5
|
gem 'allure-cucumber'
|
|
6
|
-
|
|
6
|
+
<%- else -%>
|
|
7
7
|
gem 'allure-rspec'
|
|
8
8
|
gem 'allure-ruby-commons'
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
<%- end -%>
|
|
10
|
+
<%- if axe? -%>
|
|
11
11
|
gem 'axe-core-rspec'
|
|
12
12
|
gem 'axe-core-selenium'
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
<%- end -%>
|
|
14
|
+
<%- if visual? -%>
|
|
15
15
|
gem 'eyes_selenium', '~> 4.6', '>= 4.6.1'
|
|
16
16
|
gem 'eyes_universal', '~> 3.3', '>= 3.3.1'
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
<%- end -%>
|
|
18
|
+
<%- unless visual? -%>
|
|
19
19
|
gem 'parallel_split_test'
|
|
20
20
|
gem 'parallel_tests'
|
|
21
|
-
|
|
21
|
+
<%- end -%>
|
|
22
22
|
gem 'rake'
|
|
23
23
|
gem 'reek'
|
|
24
24
|
gem '<%= framework %>'
|
|
25
|
-
|
|
25
|
+
<%- if cucumber? -%>
|
|
26
26
|
gem 'rspec'
|
|
27
|
-
|
|
27
|
+
<%- end -%>
|
|
28
28
|
gem 'rubocop'
|
|
29
|
-
|
|
29
|
+
<%- if rspec? -%>
|
|
30
30
|
gem 'rubocop-rspec'
|
|
31
|
-
|
|
31
|
+
<%- end -%>
|
|
32
32
|
gem 'ruby_raider', '~> 0.9.0'
|
|
33
33
|
<%= ERB.new(File.read(File.expand_path('./partials/automation_gems.tt', __dir__))).result(binding).strip! %>
|
|
@@ -3,24 +3,26 @@
|
|
|
3
3
|
require 'axe-selenium'
|
|
4
4
|
<% end -%>
|
|
5
5
|
require 'yaml'
|
|
6
|
-
|
|
6
|
+
<%- unless axe? %>
|
|
7
|
+
<%- if selenium_based? -%>
|
|
7
8
|
require 'active_support/inflector'
|
|
8
9
|
require 'selenium-webdriver'
|
|
9
|
-
|
|
10
|
+
<%- else -%>
|
|
10
11
|
require 'appium_lib'
|
|
11
|
-
|
|
12
|
+
<%- end -%>
|
|
13
|
+
<%- end -%>
|
|
12
14
|
|
|
13
15
|
module DriverHelper
|
|
14
|
-
|
|
16
|
+
<%- if selenium_based? && !axe? -%>
|
|
15
17
|
def driver(*opts)
|
|
16
18
|
@driver ||= create_driver(*opts)
|
|
17
19
|
end
|
|
18
|
-
|
|
20
|
+
<%- elsif axe? -%>
|
|
19
21
|
def driver(browser = :chrome, js_path = nil, skip_iframes = nil)
|
|
20
22
|
@driver ||= create_driver(browser, js_path, skip_iframes)
|
|
21
23
|
end
|
|
22
|
-
|
|
23
|
-
def driver
|
|
24
|
+
<%- else -%>
|
|
25
|
+
def driver
|
|
24
26
|
@driver ||= create_driver
|
|
25
27
|
end
|
|
26
28
|
<%- end -%>
|
|
@@ -28,4 +30,4 @@ def driver
|
|
|
28
30
|
private
|
|
29
31
|
|
|
30
32
|
<%= ERB.new(File.read(File.expand_path('./partials/driver_and_options.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
|
|
31
|
-
end
|
|
33
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<% if
|
|
1
|
+
<% if axe? -%>
|
|
2
2
|
def create_driver(browser, js_path, skip_iframes)
|
|
3
3
|
AxeSelenium.configure(browser) do |config|
|
|
4
4
|
config.jslib_path = js_path if js_path
|
|
5
5
|
config.skip_iframes = skip_iframes if skip_iframes
|
|
6
6
|
end.page
|
|
7
7
|
end
|
|
8
|
-
<% elsif
|
|
8
|
+
<% elsif selenium_based? -%>
|
|
9
9
|
def create_driver(*opts)
|
|
10
10
|
@config = YAML.load_file('config/config.yml')
|
|
11
11
|
browser = @config['browser'].to_sym
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
driver_options.each { |opt| options.add_option(opt.first, opt.last) }
|
|
30
30
|
options
|
|
31
31
|
end
|
|
32
|
-
<% elsif
|
|
32
|
+
<% elsif cross_platform? -%>
|
|
33
33
|
def create_driver
|
|
34
34
|
@driver = Appium::Driver.new({ caps: parsed_caps })
|
|
35
35
|
end
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
screenshot = browser.screenshot.save("#{temp_folder}/#{example_name}.png")
|
|
1
|
+
<% if selenium_based? %>
|
|
2
|
+
screenshot = driver.save_screenshot("#{temp_folder}/#{example_name}.png")
|
|
3
|
+
<% elsif watir? %>
|
|
4
|
+
screenshot = browser.screenshot.save("#{temp_folder}/#{example_name}.png")
|
|
6
5
|
<% else %>
|
|
7
|
-
screenshot = driver.screenshot("#{temp_folder}/#{example_name}.png")
|
|
8
|
-
<% end %>
|
|
6
|
+
screenshot = driver.screenshot("#{temp_folder}/#{example_name}.png")
|
|
7
|
+
<% end %>
|
|
@@ -6,7 +6,7 @@ require 'axe-rspec'
|
|
|
6
6
|
require 'rspec'
|
|
7
7
|
require 'tmpdir'
|
|
8
8
|
require_relative 'allure_helper'
|
|
9
|
-
<%- if
|
|
9
|
+
<%- if watir? -%>
|
|
10
10
|
require_relative 'browser_helper'
|
|
11
11
|
<%- else -%>
|
|
12
12
|
require_relative 'driver_helper'
|
|
@@ -17,16 +17,16 @@ module SpecHelper
|
|
|
17
17
|
AllureHelper.configure
|
|
18
18
|
RSpec.configure do |config|
|
|
19
19
|
config.formatter = AllureHelper.formatter
|
|
20
|
-
<% if
|
|
21
|
-
<%- if
|
|
20
|
+
<% if watir? %>config.include(BrowserHelper)<% else %>config.include(DriverHelper)<% end %>
|
|
21
|
+
<%- if mobile? -%>
|
|
22
22
|
config.before(:each) do
|
|
23
23
|
driver.start_driver
|
|
24
24
|
end
|
|
25
|
-
<%- elsif
|
|
25
|
+
<%- elsif selenium_based? -%>
|
|
26
26
|
config.before(:each) do
|
|
27
27
|
driver.manage.window.maximize
|
|
28
28
|
end
|
|
29
|
-
<%- elsif
|
|
29
|
+
<%- elsif watir? -%>
|
|
30
30
|
config.before(:each) do
|
|
31
31
|
browser.window.maximize
|
|
32
32
|
end
|
data/lib/version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.9.
|
|
1
|
+
0.9.4
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_raider
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Agustin Pequeno
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-07-
|
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|