ruby_raider 3.11.0 → 3.12.1
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/reek.yml +5 -1
- data/.github/workflows/release.yml +2 -1
- data/.github/workflows/system_tests.yml +1 -1
- data/.reek.yml +13 -0
- data/.ruby-version +1 -1
- data/README.md +43 -4
- data/lib/commands/utility_commands.rb +1 -1
- data/lib/generators/automation/automation_generator.rb +15 -10
- data/lib/generators/automation/templates/appium_caps.tt +2 -4
- data/lib/generators/automation/templates/home.tt +1 -2
- data/lib/generators/automation/templates/login.tt +6 -6
- data/lib/generators/automation/templates/page.tt +18 -6
- data/lib/generators/automation/templates/partials/home_page_selector.tt +4 -6
- data/lib/generators/automation/templates/partials/initialize_selector.tt +3 -3
- data/lib/generators/automation/templates/partials/pdp_page_selector.tt +4 -6
- data/lib/generators/automation/templates/partials/url_methods.tt +3 -2
- data/lib/generators/automation/templates/partials/visit_method.tt +5 -5
- data/lib/generators/automation/templates/pdp.tt +3 -2
- data/lib/generators/cucumber/cucumber_generator.rb +16 -3
- data/lib/generators/cucumber/templates/env.tt +3 -3
- data/lib/generators/cucumber/templates/partials/driver_world.tt +9 -0
- data/lib/generators/cucumber/templates/partials/mobile_steps.tt +1 -1
- data/lib/generators/cucumber/templates/partials/selenium_env.tt +4 -0
- data/lib/generators/cucumber/templates/partials/web_steps.tt +4 -0
- data/lib/generators/cucumber/templates/steps.tt +2 -2
- data/lib/generators/cucumber/templates/user_factory.tt +2 -0
- data/lib/generators/cucumber/templates/world.tt +5 -3
- data/lib/generators/generator.rb +29 -14
- data/lib/generators/helper_generator.rb +8 -0
- data/lib/generators/invoke_generators.rb +23 -0
- data/lib/generators/menu_generator.rb +26 -14
- data/lib/generators/rspec/rspec_generator.rb +10 -3
- data/lib/generators/rspec/templates/accessibility_spec.tt +10 -10
- data/lib/generators/rspec/templates/spec.tt +17 -2
- data/lib/generators/template_renderer/template_error.rb +8 -8
- data/lib/generators/templates/common/gemfile.tt +9 -9
- data/lib/generators/templates/common/partials/mobile_config.tt +1 -0
- data/lib/generators/templates/common/partials/web_config.tt +1 -1
- data/lib/generators/templates/common/read_me.tt +508 -24
- data/lib/generators/templates/helpers/appium_helper.tt +17 -15
- data/lib/generators/templates/helpers/browser_helper.tt +1 -2
- data/lib/generators/templates/helpers/partials/appium_driver.tt +1 -1
- data/lib/generators/templates/helpers/partials/selenium_driver.tt +1 -3
- data/lib/generators/templates/helpers/raider_element.tt +159 -0
- data/lib/generators/templates/helpers/session_state.tt +46 -6
- data/lib/generators/templates/helpers/spec_helper.tt +10 -2
- data/lib/generators/templates/helpers/wait_helper.tt +470 -0
- data/lib/ruby_raider/ffmpeg.rb +7 -7
- data/lib/ruby_raider.rb +9 -0
- data/lib/scaffolding/project_detector.rb +6 -0
- data/lib/scaffolding/scaffolding.rb +4 -0
- data/lib/scaffolding/templates/component.tt +4 -0
- data/lib/scaffolding/templates/page_object.tt +8 -0
- data/lib/version +1 -1
- data/sig/generators/generator.rbs +4 -0
- data/sig/ruby_raider.rbs +1 -0
- data/sig/scaffolding/project_detector.rbs +1 -0
- data/sig/scaffolding/scaffolding.rbs +1 -0
- data/spec/commands/raider_commands_spec.rb +48 -0
- data/spec/fixtures/watir_master/cucumber_watir/Readme.md.snapshot +175 -0
- data/spec/fixtures/watir_master/cucumber_watir/features/step_definitions/login_steps.rb.snapshot +24 -0
- data/spec/fixtures/watir_master/cucumber_watir/page_objects/abstract/page.rb.snapshot +37 -0
- data/spec/fixtures/watir_master/cucumber_watir/page_objects/pages/login.rb.snapshot +33 -0
- data/spec/fixtures/watir_master/rspec_watir/Readme.md.snapshot +174 -0
- data/spec/fixtures/watir_master/rspec_watir/page_objects/abstract/page.rb.snapshot +37 -0
- data/spec/fixtures/watir_master/rspec_watir/page_objects/pages/login.rb.snapshot +33 -0
- data/spec/fixtures/watir_master/rspec_watir/spec/login_page_spec.rb.snapshot +49 -0
- data/spec/integration/commands/scaffolding_commands_spec.rb +49 -0
- data/spec/integration/commands/utility_commands_spec.rb +8 -0
- data/spec/integration/content/config_content_spec.rb +44 -0
- data/spec/integration/content/content_helper.rb +1 -5
- data/spec/integration/content/helper_content_spec.rb +79 -0
- data/spec/integration/content/page_content_spec.rb +75 -4
- data/spec/integration/content/readme_content_spec.rb +126 -5
- data/spec/integration/content/rubocop_content_spec.rb +87 -0
- data/spec/integration/content/syntax_validation_spec.rb +33 -30
- data/spec/integration/content/test_content_spec.rb +60 -0
- data/spec/integration/end_to_end_spec.rb +73 -28
- data/spec/integration/frozen_string_literal_matcher.rb +13 -0
- data/spec/integration/generators/automation_generator_spec.rb +50 -0
- data/spec/integration/generators/common_generator_spec.rb +20 -0
- data/spec/integration/generators/config_features_spec.rb +2 -2
- data/spec/integration/generators/cucumber_generator_spec.rb +36 -0
- data/spec/integration/generators/helpers_generator_spec.rb +38 -0
- data/spec/integration/generators/invoke_generators_spec.rb +130 -0
- data/spec/integration/generators/rspec_generator_spec.rb +20 -0
- data/spec/integration/helpers/session_state_spec.rb +46 -0
- data/spec/integration/helpers/wait_helper_mobile_spec.rb +281 -0
- data/spec/integration/helpers/wait_helper_spec.rb +496 -0
- data/spec/integration/helpers/wait_helper_support.rb +183 -0
- data/spec/integration/scaffolding_e2e_spec.rb +1 -5
- data/spec/integration/settings_helper.rb +4 -1
- data/spec/integration/spec_helper.rb +2 -2
- data/spec/menus/menu_generator_spec.rb +64 -2
- data/spec/scaffolding/scaffold_project_detector_spec.rb +12 -0
- metadata +17 -2
data/lib/generators/generator.rb
CHANGED
|
@@ -23,61 +23,71 @@ class Generator < Thor::Group
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def cucumber?
|
|
26
|
-
|
|
26
|
+
framework == 'cucumber'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# The framework is cross platform when it supports Android and iOS
|
|
30
30
|
def cross_platform?
|
|
31
|
-
|
|
31
|
+
automation == 'cross_platform'
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def mobile?
|
|
35
|
-
|
|
35
|
+
%w[android ios cross_platform].include?(automation)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def single_platform?
|
|
39
|
-
|
|
39
|
+
%w[android ios].include?(automation)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def ios?
|
|
43
|
-
|
|
43
|
+
automation == 'ios'
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def android?
|
|
47
|
-
|
|
47
|
+
automation == 'android'
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def rspec?
|
|
51
|
-
|
|
51
|
+
framework == 'rspec'
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
# Only the options after automation, framework and name, so a project named "azure" is not Azure CI
|
|
55
54
|
def azure?
|
|
56
|
-
|
|
55
|
+
options_after_name.include?('azure')
|
|
57
56
|
end
|
|
58
57
|
|
|
59
58
|
def github_ci?
|
|
60
59
|
!azure?
|
|
61
60
|
end
|
|
62
61
|
|
|
62
|
+
# The automation arg only, so a project named "watir" or "selenium" keeps its own automation
|
|
63
63
|
def selenium?
|
|
64
|
-
|
|
64
|
+
automation == 'selenium'
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def watir?
|
|
68
|
-
|
|
68
|
+
automation == 'watir'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Selenium and Appium projects get the auto-waiting WaitHelper; Watir keeps its own waits
|
|
72
|
+
def wait_helper?
|
|
73
|
+
!watir?
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# False for `raider new -p examples:false`: an empty skeleton without the example pages, tests and wiring
|
|
77
|
+
def examples?
|
|
78
|
+
!options_after_name.include?('no_examples')
|
|
69
79
|
end
|
|
70
80
|
|
|
71
81
|
def web?
|
|
72
|
-
|
|
82
|
+
selenium? || watir?
|
|
73
83
|
end
|
|
74
84
|
|
|
75
85
|
def axe_addon?
|
|
76
|
-
|
|
86
|
+
options_after_name.include?('axe_addon')
|
|
77
87
|
end
|
|
78
88
|
|
|
79
89
|
def selenium_based?
|
|
80
|
-
|
|
90
|
+
selenium?
|
|
81
91
|
end
|
|
82
92
|
|
|
83
93
|
def ruby_raider_version_requirement
|
|
@@ -87,6 +97,11 @@ class Generator < Thor::Group
|
|
|
87
97
|
|
|
88
98
|
private
|
|
89
99
|
|
|
100
|
+
# Option flags only: everything after automation, framework and name
|
|
101
|
+
def options_after_name
|
|
102
|
+
args.drop(3)
|
|
103
|
+
end
|
|
104
|
+
|
|
90
105
|
def _initializer
|
|
91
106
|
@_initializer ||= super
|
|
92
107
|
end
|
|
@@ -10,6 +10,7 @@ class HelpersGenerator < Generator
|
|
|
10
10
|
generate_spec_helper
|
|
11
11
|
generate_video_helper
|
|
12
12
|
generate_session_state
|
|
13
|
+
generate_wait_helper
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
private
|
|
@@ -42,6 +43,13 @@ class HelpersGenerator < Generator
|
|
|
42
43
|
template('helpers/session_state.tt', "#{name}/helpers/session_state.rb")
|
|
43
44
|
end
|
|
44
45
|
|
|
46
|
+
def generate_wait_helper
|
|
47
|
+
return unless wait_helper?
|
|
48
|
+
|
|
49
|
+
template('helpers/wait_helper.tt', "#{name}/helpers/wait_helper.rb")
|
|
50
|
+
template('helpers/raider_element.tt', "#{name}/helpers/raider_element.rb")
|
|
51
|
+
end
|
|
52
|
+
|
|
45
53
|
def generate_appium_helper
|
|
46
54
|
return unless cross_platform?
|
|
47
55
|
|
|
@@ -11,6 +11,9 @@ module InvokeGenerators
|
|
|
11
11
|
FRAMEWORKS = %w[rspec cucumber].freeze
|
|
12
12
|
AUTOMATIONS = %w[selenium watir ios android cross_platform].freeze
|
|
13
13
|
|
|
14
|
+
WATIR_NOTICE = 'Watir is deprecated and will be removed in the next major version of ruby_raider; ' \
|
|
15
|
+
'new projects should use Selenium.'.freeze
|
|
16
|
+
|
|
14
17
|
module_function
|
|
15
18
|
|
|
16
19
|
def generate_framework(structure = {})
|
|
@@ -33,6 +36,8 @@ module InvokeGenerators
|
|
|
33
36
|
})
|
|
34
37
|
end
|
|
35
38
|
print_mobile_azure_notice(structure)
|
|
39
|
+
print_watir_notice(structure)
|
|
40
|
+
print_watir_examples_notice(structure)
|
|
36
41
|
end
|
|
37
42
|
|
|
38
43
|
def normalise_options(structure)
|
|
@@ -60,6 +65,12 @@ module InvokeGenerators
|
|
|
60
65
|
puts 'Azure Pipelines template for mobile projects is not available yet; see the README.'
|
|
61
66
|
end
|
|
62
67
|
|
|
68
|
+
def print_watir_notice(structure)
|
|
69
|
+
return unless structure[:automation] == 'watir'
|
|
70
|
+
|
|
71
|
+
puts WATIR_NOTICE
|
|
72
|
+
end
|
|
73
|
+
|
|
63
74
|
def add_generator(generators, *gens)
|
|
64
75
|
gens.each { |generator| generators.push generator }
|
|
65
76
|
end
|
|
@@ -81,9 +92,21 @@ module InvokeGenerators
|
|
|
81
92
|
flags = []
|
|
82
93
|
flags << 'axe_addon' if structure[:accessibility] && !mobile_automation?(structure[:automation])
|
|
83
94
|
flags << 'azure' if structure[:ci].to_s == 'azure'
|
|
95
|
+
flags << 'no_examples' if skeleton?(structure)
|
|
84
96
|
flags
|
|
85
97
|
end
|
|
86
98
|
|
|
99
|
+
# Watir templates are frozen, so a Watir project always gets the example tests
|
|
100
|
+
def skeleton?(structure)
|
|
101
|
+
structure[:examples] == false && structure[:automation] != 'watir'
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def print_watir_examples_notice(structure)
|
|
105
|
+
return unless structure[:examples] == false && structure[:automation] == 'watir'
|
|
106
|
+
|
|
107
|
+
puts 'Watir projects always include the example tests; examples:false applies to Selenium and Appium projects.'
|
|
108
|
+
end
|
|
109
|
+
|
|
87
110
|
def mobile_automation?(automation)
|
|
88
111
|
%w[ios android cross_platform].include?(automation)
|
|
89
112
|
end
|
|
@@ -31,6 +31,7 @@ class MenuGenerator
|
|
|
31
31
|
framework: options[:framework],
|
|
32
32
|
accessibility: options[:accessibility],
|
|
33
33
|
ci: options[:ci],
|
|
34
|
+
examples: options[:examples],
|
|
34
35
|
name: @name
|
|
35
36
|
}
|
|
36
37
|
generate_framework(structure)
|
|
@@ -70,32 +71,43 @@ class MenuGenerator
|
|
|
70
71
|
|
|
71
72
|
def select_test_framework(automation)
|
|
72
73
|
prompt.select('Please select your test framework') do |menu|
|
|
73
|
-
menu.choice :Cucumber, -> {
|
|
74
|
-
menu.choice :Rspec, -> {
|
|
74
|
+
menu.choice :Cucumber, -> { select_examples('Cucumber', automation) }
|
|
75
|
+
menu.choice :Rspec, -> { select_examples('Rspec', automation) }
|
|
75
76
|
menu.choice :Quit, -> { exit }
|
|
76
77
|
end
|
|
77
78
|
end
|
|
78
79
|
|
|
79
|
-
|
|
80
|
+
def select_examples(framework, automation_type)
|
|
81
|
+
prompt.select('Do you want example tests?') do |menu|
|
|
82
|
+
menu.choice :Yes, -> { select_accessibility(framework, automation_type, examples: true) }
|
|
83
|
+
menu.choice :No, -> { select_accessibility(framework, automation_type, examples: false) }
|
|
84
|
+
menu.choice :Quit, -> { exit }
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
FrameworkOptions = Struct.new(:automation, :framework, :accessibility, :ci, :examples)
|
|
80
89
|
|
|
81
90
|
def create_framework_options(params)
|
|
82
|
-
FrameworkOptions.new(params[:automation], params[:framework], params[:accessibility], params[:ci]
|
|
91
|
+
FrameworkOptions.new(params[:automation], params[:framework], params[:accessibility], params[:ci],
|
|
92
|
+
params[:examples])
|
|
83
93
|
end
|
|
84
94
|
|
|
85
|
-
def select_accessibility(framework, automation_type)
|
|
86
|
-
return create_framework(framework, automation_type) if mobile_automation?(automation_type)
|
|
95
|
+
def select_accessibility(framework, automation_type, examples: true)
|
|
96
|
+
return create_framework(framework, automation_type, examples:) if mobile_automation?(automation_type)
|
|
87
97
|
|
|
88
98
|
prompt.select('Add accessibility testing (axe)?') do |menu|
|
|
89
|
-
menu.choice :Yes, -> { select_ci(framework, automation_type, accessibility: true) }
|
|
90
|
-
menu.choice :No, -> { select_ci(framework, automation_type, accessibility: false) }
|
|
99
|
+
menu.choice :Yes, -> { select_ci(framework, automation_type, accessibility: true, examples:) }
|
|
100
|
+
menu.choice :No, -> { select_ci(framework, automation_type, accessibility: false, examples:) }
|
|
91
101
|
menu.choice :Quit, -> { exit }
|
|
92
102
|
end
|
|
93
103
|
end
|
|
94
104
|
|
|
95
|
-
def select_ci(framework, automation_type, accessibility:)
|
|
105
|
+
def select_ci(framework, automation_type, accessibility:, examples: true)
|
|
96
106
|
prompt.select('Which CI provider?') do |menu|
|
|
97
|
-
menu.choice 'GitHub Actions', -> { create_framework(framework, automation_type, accessibility:) }
|
|
98
|
-
menu.choice 'Azure Pipelines',
|
|
107
|
+
menu.choice 'GitHub Actions', -> { create_framework(framework, automation_type, accessibility:, examples:) }
|
|
108
|
+
menu.choice 'Azure Pipelines', lambda {
|
|
109
|
+
create_framework(framework, automation_type, accessibility:, ci_provider: 'azure', examples:)
|
|
110
|
+
}
|
|
99
111
|
menu.choice :Quit, -> { exit }
|
|
100
112
|
end
|
|
101
113
|
end
|
|
@@ -104,16 +116,17 @@ class MenuGenerator
|
|
|
104
116
|
%w[ios android cross_platform].include?(automation_type)
|
|
105
117
|
end
|
|
106
118
|
|
|
107
|
-
def create_framework(framework, automation_type, accessibility: false, ci_provider: nil)
|
|
119
|
+
def create_framework(framework, automation_type, accessibility: false, ci_provider: nil, examples: true)
|
|
108
120
|
options = create_framework_options(automation: automation_type,
|
|
109
121
|
framework: framework.downcase,
|
|
110
|
-
accessibility:, ci: ci_provider)
|
|
122
|
+
accessibility:, ci: ci_provider, examples:)
|
|
111
123
|
|
|
112
124
|
puts 'Chosen Options:'
|
|
113
125
|
puts " Automation Type: #{options[:automation]}"
|
|
114
126
|
puts " Framework: #{options[:framework]}"
|
|
115
127
|
puts ' Accessibility: enabled' if options[:accessibility]
|
|
116
128
|
puts ' CI: Azure Pipelines' if options[:ci] == 'azure'
|
|
129
|
+
puts ' Example tests: none' unless options[:examples]
|
|
117
130
|
|
|
118
131
|
set_up_framework(options)
|
|
119
132
|
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
|
@@ -135,6 +148,5 @@ class MenuGenerator
|
|
|
135
148
|
def automation_options(menu)
|
|
136
149
|
menu.choice :Selenium, -> { choose_test_framework('selenium') }
|
|
137
150
|
menu.choice :Appium, -> { choose_test_framework('appium') }
|
|
138
|
-
menu.choice :Watir, -> { choose_test_framework('watir') }
|
|
139
151
|
end
|
|
140
152
|
end
|
|
@@ -3,20 +3,27 @@
|
|
|
3
3
|
require_relative '../generator'
|
|
4
4
|
|
|
5
5
|
class RspecGenerator < Generator
|
|
6
|
+
# A skeleton has an empty spec/ (the generated CI runs `rspec spec`), and no example specs
|
|
7
|
+
def generate_empty_spec_folder
|
|
8
|
+
return if examples?
|
|
9
|
+
|
|
10
|
+
create_file("#{name}/spec/.keep", '')
|
|
11
|
+
end
|
|
12
|
+
|
|
6
13
|
def generate_login_spec
|
|
7
|
-
return unless web?
|
|
14
|
+
return unless web? && examples?
|
|
8
15
|
|
|
9
16
|
template('spec.tt', "#{name}/spec/login_page_spec.rb")
|
|
10
17
|
end
|
|
11
18
|
|
|
12
19
|
def generate_pdp_spec
|
|
13
|
-
return unless mobile?
|
|
20
|
+
return unless mobile? && examples?
|
|
14
21
|
|
|
15
22
|
template('spec.tt', "#{name}/spec/pdp_page_spec.rb")
|
|
16
23
|
end
|
|
17
24
|
|
|
18
25
|
def generate_accessibility_spec
|
|
19
|
-
return unless axe_addon? && web?
|
|
26
|
+
return unless axe_addon? && web? && examples?
|
|
20
27
|
|
|
21
28
|
template('accessibility_spec.tt', "#{name}/spec/accessibility_spec.rb")
|
|
22
29
|
end
|
|
@@ -4,18 +4,18 @@ require_relative '../helpers/spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe 'Accessibility' do
|
|
6
6
|
before do
|
|
7
|
-
|
|
8
|
-
browser.goto 'https://raider-test-site.onrender.com/'
|
|
9
|
-
|
|
10
|
-
driver.get 'https://raider-test-site.onrender.com/'
|
|
11
|
-
|
|
7
|
+
<%- if watir? -%>
|
|
8
|
+
browser.goto 'https://raider-test-site.onrender.com/'
|
|
9
|
+
<%- else -%>
|
|
10
|
+
driver.get 'https://raider-test-site.onrender.com/'
|
|
11
|
+
<%- end -%>
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it 'has no accessibility violations on the page' do
|
|
15
|
-
|
|
16
|
-
expect(browser.driver).to be_axe_clean
|
|
17
|
-
|
|
18
|
-
expect(driver).to be_axe_clean
|
|
19
|
-
|
|
15
|
+
<%- if watir? -%>
|
|
16
|
+
expect(browser.driver).to be_axe_clean
|
|
17
|
+
<%- else -%>
|
|
18
|
+
expect(driver).to be_axe_clean
|
|
19
|
+
<%- end -%>
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -8,8 +8,10 @@ require_relative '../page_objects/pages/login'
|
|
|
8
8
|
|
|
9
9
|
# rubocop:disable RSpec/MultipleDescribes
|
|
10
10
|
describe 'Login' do
|
|
11
|
+
<%- if watir? -%>
|
|
11
12
|
subject(:header) { account_page.header.customer_name }
|
|
12
13
|
|
|
14
|
+
<%- end -%>
|
|
13
15
|
let(:user) { ModelFactory.for('users')['registered user'] }
|
|
14
16
|
let(:login_page) { <% if watir? -%>Login.new(browser)<% else -%>Login.new(driver)<% end -%> }
|
|
15
17
|
let(:account_page) { <% if watir? -%>Account.new(browser)<% else -%>Account.new(driver)<% end -%> }
|
|
@@ -24,7 +26,11 @@ describe 'Login' do
|
|
|
24
26
|
|
|
25
27
|
it 'can successfully log in' do
|
|
26
28
|
account_page.visit
|
|
29
|
+
<%- if watir? -%>
|
|
27
30
|
expect(header).to eq "Welcome back #{user['name']}"
|
|
31
|
+
<%- else -%>
|
|
32
|
+
eventually { expect(account_page.header.customer_name).to eq "Welcome back #{user['name']}" }
|
|
33
|
+
<%- end -%>
|
|
28
34
|
end
|
|
29
35
|
end
|
|
30
36
|
|
|
@@ -33,7 +39,11 @@ describe 'Login' do
|
|
|
33
39
|
|
|
34
40
|
it 'cannot log in' do
|
|
35
41
|
login_page.visit
|
|
42
|
+
<%- if watir? -%>
|
|
36
43
|
expect(header).to eq 'Login or register'
|
|
44
|
+
<%- else -%>
|
|
45
|
+
eventually { expect(account_page.header.customer_name).to eq 'Login or register' }
|
|
46
|
+
<%- end -%>
|
|
37
47
|
end
|
|
38
48
|
end
|
|
39
49
|
end
|
|
@@ -44,11 +54,17 @@ describe 'Account', :logged_in do
|
|
|
44
54
|
|
|
45
55
|
it 'opens the account page with the saved login' do
|
|
46
56
|
account_page.visit
|
|
57
|
+
<%- if watir? -%>
|
|
47
58
|
expect(account_page.header.customer_name).to eq "Welcome back #{user['name']}"
|
|
59
|
+
<%- else -%>
|
|
60
|
+
eventually { expect(account_page.header.customer_name).to eq "Welcome back #{user['name']}" }
|
|
61
|
+
<%- end -%>
|
|
48
62
|
end
|
|
49
63
|
end
|
|
50
64
|
# rubocop:enable RSpec/MultipleDescribes
|
|
51
65
|
<%- else -%>
|
|
66
|
+
# frozen_string_literal: true
|
|
67
|
+
|
|
52
68
|
<% if cross_platform? -%>
|
|
53
69
|
require_relative '../helpers/appium_helper'
|
|
54
70
|
<%- end -%>
|
|
@@ -58,13 +74,12 @@ require_relative '../page_objects/pages/pdp'
|
|
|
58
74
|
|
|
59
75
|
class PdpSpec
|
|
60
76
|
describe 'PDP' do
|
|
61
|
-
|
|
62
77
|
let(:home_page) { Home.new(driver) }
|
|
63
78
|
let(:pdp_page) { Pdp.new(driver) }
|
|
64
79
|
|
|
65
80
|
it 'shows add to cart button' do
|
|
66
81
|
home_page.go_to_product_detail
|
|
67
|
-
expect(pdp_page.add_to_cart_text).to eq 'Add to Cart'
|
|
82
|
+
eventually { expect(pdp_page.add_to_cart_text).to eq 'Add to Cart' }
|
|
68
83
|
end
|
|
69
84
|
end
|
|
70
85
|
end
|
|
@@ -16,11 +16,11 @@ module TemplateRenderer
|
|
|
16
16
|
# Raised when a partial template cannot be found
|
|
17
17
|
class TemplateNotFoundError < TemplateError
|
|
18
18
|
def to_s
|
|
19
|
-
message_parts = ["Partial '#{
|
|
19
|
+
message_parts = ["Partial '#{partial_name}' not found."]
|
|
20
20
|
|
|
21
|
-
if
|
|
21
|
+
if searched_paths.any?
|
|
22
22
|
message_parts << "\nSearched in:"
|
|
23
|
-
message_parts.concat(
|
|
23
|
+
message_parts.concat(searched_paths.map { |path| " - #{path}" })
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
message_parts.join("\n")
|
|
@@ -34,13 +34,13 @@ module TemplateRenderer
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def to_s
|
|
37
|
-
message_parts = ["Error rendering partial '#{
|
|
37
|
+
message_parts = ["Error rendering partial '#{partial_name}': #{super()}"]
|
|
38
38
|
|
|
39
|
-
if
|
|
40
|
-
message_parts << "\nOriginal error: #{
|
|
41
|
-
if
|
|
39
|
+
if original_error
|
|
40
|
+
message_parts << "\nOriginal error: #{original_error.class}: #{original_error.message}"
|
|
41
|
+
if original_error.backtrace
|
|
42
42
|
message_parts << "\nBacktrace:"
|
|
43
|
-
message_parts.concat(
|
|
43
|
+
message_parts.concat(original_error.backtrace.first(5).map { |line| " #{line}" })
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
3
|
gem 'activesupport'
|
|
4
|
-
|
|
5
|
-
gem 'appium_lib'
|
|
4
|
+
<%- if mobile? -%>
|
|
6
5
|
gem 'appium_console'
|
|
7
|
-
|
|
6
|
+
gem 'appium_lib'
|
|
7
|
+
<%- end -%>
|
|
8
8
|
<%- if axe_addon? -%>
|
|
9
9
|
gem 'axe-core-rspec'
|
|
10
10
|
gem 'axe-core-selenium'
|
|
11
11
|
<%- end -%>
|
|
12
|
+
<%- if cucumber? -%>
|
|
13
|
+
gem 'cucumber'
|
|
14
|
+
<%- end -%>
|
|
12
15
|
gem 'parallel_split_test'
|
|
13
16
|
gem 'parallel_tests'
|
|
17
|
+
gem 'raider_reporter', '~> 0.10'
|
|
14
18
|
gem 'rake'
|
|
15
19
|
gem 'reek'
|
|
16
|
-
gem '
|
|
20
|
+
gem 'rspec'
|
|
17
21
|
<%- if rspec? -%>
|
|
18
22
|
gem 'rspec-retry'
|
|
19
23
|
<%- end -%>
|
|
20
|
-
gem '<%= framework %>'
|
|
21
|
-
<%- if cucumber? -%>
|
|
22
|
-
gem 'rspec'
|
|
23
|
-
<%- end -%>
|
|
24
24
|
gem 'rubocop'
|
|
25
25
|
<%- if rspec? -%>
|
|
26
26
|
gem 'rubocop-rspec'
|
|
27
27
|
<%- end -%>
|
|
28
28
|
gem 'ruby_raider', '<%= ruby_raider_version_requirement %>'
|
|
29
|
-
<%- if selenium_based?
|
|
29
|
+
<%- if selenium_based? -%>
|
|
30
30
|
gem 'selenium-webdriver'
|
|
31
31
|
<%- end -%>
|
|
32
32
|
<%- if watir? -%>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
browser: chrome
|
|
2
2
|
url: 'https://raider-test-site.onrender.com/'
|
|
3
|
-
timeout: 10 # seconds — used for implicit waits and max wait time
|
|
3
|
+
timeout: 10 # <%= wait_helper? ? 'seconds that actions and eventually wait before failing' : 'seconds — used for implicit waits and max wait time' %>
|
|
4
4
|
viewport:
|
|
5
5
|
width: 1920
|
|
6
6
|
height: 1080
|