ruby_raider 3.13.0 → 4.0.0
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/runtime.yml +38 -0
- data/.github/workflows/system_tests.yml +1 -23
- data/.reek.yml +1 -0
- data/.rspec +1 -0
- data/Gemfile +2 -0
- data/README.md +16 -49
- data/RELEASE.md +22 -0
- data/bin/raider +5 -0
- data/lib/commands/scaffolding_commands.rb +2 -25
- data/lib/commands/utility_commands.rb +23 -3
- data/lib/generators/automation/automation_generator.rb +0 -5
- data/lib/generators/automation/templates/component.tt +1 -0
- data/lib/generators/automation/templates/home.tt +2 -2
- data/lib/generators/automation/templates/login.tt +6 -26
- data/lib/generators/automation/templates/page.tt +23 -18
- data/lib/generators/automation/templates/partials/home_page_selector.tt +1 -2
- data/lib/generators/automation/templates/partials/initialize_selector.tt +0 -8
- data/lib/generators/automation/templates/partials/pdp_page_selector.tt +1 -2
- data/lib/generators/automation/templates/partials/url_methods.tt +8 -2
- data/lib/generators/automation/templates/partials/visit_method.tt +0 -5
- data/lib/generators/automation/templates/pdp.tt +1 -9
- data/lib/generators/common_generator.rb +0 -2
- data/lib/generators/generator.rb +12 -19
- data/lib/generators/helper_generator.rb +21 -19
- data/lib/generators/infrastructure/templates/azure_pipelines.tt +1 -1
- data/lib/generators/infrastructure/templates/github.tt +2 -3
- data/lib/generators/infrastructure/templates/github_appium.tt +0 -8
- data/lib/generators/invoke_generators.rb +4 -23
- data/lib/generators/menu_generator.rb +1 -9
- data/lib/generators/rspec/templates/accessibility_spec.tt +1 -9
- data/lib/generators/rspec/templates/spec.tt +8 -24
- data/lib/generators/template_renderer/partial_cache.rb +3 -1
- data/lib/generators/template_renderer.rb +1 -1
- data/lib/generators/templates/common/gemfile.tt +3 -10
- data/lib/generators/templates/common/git_ignore.tt +0 -5
- data/lib/generators/templates/common/partials/mobile_config.tt +3 -1
- data/lib/generators/templates/common/partials/web_config.tt +10 -1
- data/lib/generators/templates/common/rakefile.tt +0 -15
- data/lib/generators/templates/common/read_me.tt +357 -250
- data/lib/generators/templates/common/rubocop.tt +0 -2
- data/lib/generators/templates/helpers/driver_helper.tt +8 -0
- data/lib/generators/templates/helpers/gesture_helper.tt +78 -0
- data/lib/generators/templates/helpers/network_helper.tt +521 -0
- data/lib/generators/templates/helpers/partials/quit_driver.tt +0 -2
- data/lib/generators/templates/helpers/partials/screenshot.tt +0 -2
- data/lib/generators/templates/helpers/partials/selenium_driver.tt +5 -2
- data/lib/generators/templates/helpers/screenshot_helper.tt +490 -0
- data/lib/generators/templates/helpers/spec_helper.tt +39 -29
- data/lib/generators/templates/helpers/trace_helper.tt +240 -95
- data/lib/generators/templates/helpers/video_helper.tt +3 -8
- data/lib/ruby_raider/runtime/actionability.rb +129 -0
- data/lib/ruby_raider/runtime/actionable.rb +49 -0
- data/lib/ruby_raider/runtime/by_role.rb +55 -0
- data/lib/ruby_raider/runtime/config.rb +79 -0
- data/lib/ruby_raider/runtime/context.rb +38 -0
- data/lib/ruby_raider/runtime/errors.rb +69 -0
- data/lib/ruby_raider/runtime/finders.rb +73 -0
- data/lib/ruby_raider/runtime/js/actionability.js +134 -0
- data/lib/ruby_raider/runtime/js/role_engine.js +315 -0
- data/lib/ruby_raider/runtime/locator_converter.rb +72 -0
- data/lib/ruby_raider/runtime/matchers/base.rb +222 -0
- data/lib/ruby_raider/runtime/matchers/element.rb +183 -0
- data/lib/ruby_raider/runtime/matchers/page.rb +71 -0
- data/lib/ruby_raider/runtime/matchers/presence.rb +41 -0
- data/lib/ruby_raider/runtime/matchers/retrying_block.rb +104 -0
- data/lib/ruby_raider/runtime/observer.rb +170 -0
- data/lib/ruby_raider/runtime/role_finder.rb +83 -0
- data/lib/ruby_raider/runtime/rspec.rb +78 -0
- data/lib/ruby_raider/runtime/selectors.rb +60 -0
- data/lib/ruby_raider/runtime/strict.rb +142 -0
- data/lib/ruby_raider/runtime/wait.rb +84 -0
- data/lib/ruby_raider/runtime.rb +20 -0
- data/lib/scaffolding/name_normalizer.rb +1 -1
- data/lib/scaffolding/project_detector.rb +2 -28
- data/lib/scaffolding/scaffolding.rb +0 -20
- data/lib/scaffolding/templates/component.tt +0 -14
- data/lib/scaffolding/templates/page_object.tt +2 -14
- data/lib/scaffolding/templates/spec.tt +1 -9
- data/lib/utilities/utilities.rb +10 -8
- data/lib/version +1 -1
- data/ruby_raider.gemspec +2 -1
- data/sig/commands/scaffolding_commands.rbs +0 -2
- data/sig/commands/utility_commands.rbs +6 -0
- data/sig/generators/generator.rbs +0 -4
- data/sig/generators/helper_generator.rbs +0 -1
- data/sig/generators/menu_generator.rbs +0 -1
- data/sig/ruby_raider/runtime/actionability.rbs +25 -0
- data/sig/ruby_raider/runtime/actionable.rbs +13 -0
- data/sig/ruby_raider/runtime/by_role.rbs +15 -0
- data/sig/ruby_raider/runtime/config.rbs +26 -0
- data/sig/ruby_raider/runtime/context.rbs +12 -0
- data/sig/ruby_raider/runtime/errors.rbs +36 -0
- data/sig/ruby_raider/runtime/finders.rbs +26 -0
- data/sig/ruby_raider/runtime/locator_converter.rbs +21 -0
- data/sig/ruby_raider/runtime/matchers/base.rbs +64 -0
- data/sig/ruby_raider/runtime/matchers/element.rbs +78 -0
- data/sig/ruby_raider/runtime/matchers/page.rbs +38 -0
- data/sig/ruby_raider/runtime/matchers/presence.rbs +21 -0
- data/sig/ruby_raider/runtime/matchers/retrying_block.rbs +27 -0
- data/sig/ruby_raider/runtime/observer.rbs +46 -0
- data/sig/ruby_raider/runtime/role_finder.rbs +18 -0
- data/sig/ruby_raider/runtime/selectors.rbs +21 -0
- data/sig/ruby_raider/runtime/strict.rbs +35 -0
- data/sig/ruby_raider/runtime/wait.rbs +17 -0
- data/sig/ruby_raider/runtime.rbs +2 -0
- data/sig/scaffolding/project_detector.rbs +0 -4
- data/sig/scaffolding/scaffolding.rbs +0 -5
- data/sig/utilities/utilities.rbs +2 -1
- data/sig/vendor/selenium_webdriver.rbs +71 -0
- data/spec/commands/raider_commands_spec.rb +38 -3
- data/spec/commands/scaffolding_commands_spec.rb +27 -0
- data/spec/commands/utility_commands_spec.rb +53 -0
- data/spec/generators/gesture_helper_spec.rb +123 -0
- data/spec/generators/network_helper_spec.rb +634 -0
- data/spec/generators/screenshot_helper_spec.rb +776 -0
- data/spec/generators/template_renderer_spec.rb +0 -4
- data/spec/generators/trace_helper_spec.rb +489 -97
- data/spec/generators/video_helper_spec.rb +0 -9
- data/spec/integration/commands/browser_update_after_creation_spec.rb +0 -8
- data/spec/integration/commands/scaffolding_commands_spec.rb +12 -70
- data/spec/integration/commands/utility_commands_spec.rb +19 -41
- data/spec/integration/content/azure_content_spec.rb +2 -6
- data/spec/integration/content/ci_content_spec.rb +1 -55
- data/spec/integration/content/common_content_spec.rb +1 -118
- data/spec/integration/content/config_content_spec.rb +34 -31
- data/spec/integration/content/gemfile_content_spec.rb +7 -72
- data/spec/integration/content/helper_content_spec.rb +105 -99
- data/spec/integration/content/page_content_spec.rb +85 -87
- data/spec/integration/content/readme_content_spec.rb +134 -75
- data/spec/integration/content/rspec_reporter_content_spec.rb +2 -2
- data/spec/integration/content/rubocop_content_spec.rb +1 -1
- data/spec/integration/content/syntax_validation_spec.rb +2 -2
- data/spec/integration/content/test_content_spec.rb +23 -147
- data/spec/integration/end_to_end_features_spec.rb +1 -43
- data/spec/integration/end_to_end_spec.rb +319 -326
- data/spec/integration/generators/automation_generator_spec.rb +3 -37
- data/spec/integration/generators/axe_addon_spec.rb +2 -35
- data/spec/integration/generators/azure_generator_spec.rb +1 -1
- data/spec/integration/generators/common_generator_spec.rb +1 -40
- data/spec/integration/generators/config_features_spec.rb +1 -24
- data/spec/integration/generators/github_generator_spec.rb +0 -12
- data/spec/integration/generators/helpers_generator_spec.rb +74 -80
- data/spec/integration/generators/invoke_generators_spec.rb +54 -45
- data/spec/integration/generators/rspec_generator_spec.rb +0 -6
- data/spec/integration/scaffolding_e2e_spec.rb +17 -179
- data/spec/integration/spec_helper.rb +4 -6
- data/spec/integration/trace_format_checker.rb +11 -2
- data/spec/integration/trace_page_server.rb +72 -5
- data/spec/menus/menu_generator_spec.rb +14 -39
- data/spec/runtime/actionability_spec.rb +207 -0
- data/spec/runtime/actionable_spec.rb +125 -0
- data/spec/runtime/browser/actionability_script_browser_spec.rb +150 -0
- data/spec/runtime/browser/actionable_browser_spec.rb +98 -0
- data/spec/runtime/browser/finders_browser_spec.rb +148 -0
- data/spec/runtime/browser/matchers_browser_spec.rb +67 -0
- data/spec/runtime/browser/retrying_block_browser_spec.rb +37 -0
- data/spec/runtime/browser/role_engine_browser_spec.rb +184 -0
- data/spec/runtime/browser/strict_browser_spec.rb +38 -0
- data/spec/runtime/by_role_spec.rb +52 -0
- data/spec/runtime/config_spec.rb +79 -0
- data/spec/runtime/context_spec.rb +73 -0
- data/spec/runtime/errors_spec.rb +89 -0
- data/spec/runtime/finders_spec.rb +165 -0
- data/spec/runtime/fixtures/actionability.html +70 -0
- data/spec/runtime/fixtures/locators.html +46 -0
- data/spec/runtime/fixtures/matchers.html +33 -0
- data/spec/runtime/fixtures/roles.html +162 -0
- data/spec/runtime/matchers/base_spec.rb +165 -0
- data/spec/runtime/matchers/element_spec.rb +277 -0
- data/spec/runtime/matchers/page_spec.rb +102 -0
- data/spec/runtime/matchers/presence_spec.rb +59 -0
- data/spec/runtime/matchers/retrying_block_spec.rb +165 -0
- data/spec/runtime/observer_spec.rb +341 -0
- data/spec/runtime/role_finder_spec.rb +156 -0
- data/spec/runtime/role_query_spec.rb +75 -0
- data/spec/runtime/selectors_spec.rb +135 -0
- data/spec/runtime/strict_spec.rb +257 -0
- data/spec/runtime/support/browser.rb +48 -0
- data/spec/runtime/support/fake_bridge.rb +117 -0
- data/spec/runtime/wait_spec.rb +71 -0
- data/spec/scaffolding/name_normalizer_spec.rb +3 -2
- data/spec/scaffolding/scaffold_project_detector_spec.rb +4 -43
- data/spec/system/selenium_spec.rb +1 -5
- data/spec/system/support/system_test_helper.rb +2 -5
- data/spec/utilities/headless_config_spec.rb +0 -7
- data/spec/utilities/utilities_spec.rb +24 -0
- metadata +113 -48
- data/lib/generators/automation/templates/header.tt +0 -9
- data/lib/generators/cucumber/cucumber_generator.rb +0 -58
- data/lib/generators/cucumber/templates/accessibility_feature.tt +0 -5
- data/lib/generators/cucumber/templates/accessibility_steps.tt +0 -17
- data/lib/generators/cucumber/templates/cucumber.tt +0 -1
- data/lib/generators/cucumber/templates/env.tt +0 -7
- data/lib/generators/cucumber/templates/feature.tt +0 -21
- data/lib/generators/cucumber/templates/partials/appium_env.tt +0 -26
- data/lib/generators/cucumber/templates/partials/driver_world.tt +0 -18
- data/lib/generators/cucumber/templates/partials/mobile_steps.tt +0 -20
- data/lib/generators/cucumber/templates/partials/selenium_env.tt +0 -120
- data/lib/generators/cucumber/templates/partials/watir_env.tt +0 -48
- data/lib/generators/cucumber/templates/partials/watir_world.tt +0 -4
- data/lib/generators/cucumber/templates/partials/web_steps.tt +0 -28
- data/lib/generators/cucumber/templates/steps.tt +0 -5
- data/lib/generators/cucumber/templates/user_factory.tt +0 -15
- data/lib/generators/cucumber/templates/world.tt +0 -7
- data/lib/generators/templates/helpers/browser_helper.tt +0 -31
- data/lib/generators/templates/helpers/raider_element.tt +0 -159
- data/lib/generators/templates/helpers/wait_helper.tt +0 -611
- data/lib/scaffolding/templates/feature.tt +0 -6
- data/lib/scaffolding/templates/steps.tt +0 -19
- data/sig/generators/cucumber/cucumber_generator.rbs +0 -12
- data/spec/fixtures/watir_master/cucumber_watir/Readme.md.snapshot +0 -175
- data/spec/fixtures/watir_master/cucumber_watir/features/step_definitions/login_steps.rb.snapshot +0 -24
- data/spec/fixtures/watir_master/cucumber_watir/page_objects/abstract/page.rb.snapshot +0 -37
- data/spec/fixtures/watir_master/cucumber_watir/page_objects/pages/login.rb.snapshot +0 -33
- data/spec/fixtures/watir_master/rspec_watir/Readme.md.snapshot +0 -174
- data/spec/fixtures/watir_master/rspec_watir/page_objects/abstract/page.rb.snapshot +0 -37
- data/spec/fixtures/watir_master/rspec_watir/page_objects/pages/login.rb.snapshot +0 -33
- data/spec/fixtures/watir_master/rspec_watir/spec/login_page_spec.rb.snapshot +0 -49
- data/spec/integration/content/cucumber_reporter_content_spec.rb +0 -161
- data/spec/integration/generators/cucumber_generator_spec.rb +0 -100
- data/spec/integration/helpers/wait_helper_mobile_spec.rb +0 -281
- data/spec/integration/helpers/wait_helper_spec.rb +0 -679
- data/spec/integration/helpers/wait_helper_support.rb +0 -183
- data/spec/system/watir_spec.rb +0 -38
|
@@ -55,67 +55,6 @@ describe 'Test file content' do
|
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
shared_examples 'watir rspec spec' do |project_name|
|
|
59
|
-
subject(:spec) { read_generated(project_name, 'spec/login_page_spec.rb') }
|
|
60
|
-
|
|
61
|
-
it 'instantiates Login with browser' do
|
|
62
|
-
expect(spec).to include('Login.new(browser)')
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it 'uses visit method' do
|
|
66
|
-
expect(spec).to include('.visit')
|
|
67
|
-
expect(spec).not_to include('.visit_page')
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# --- Cucumber features and steps ---
|
|
72
|
-
|
|
73
|
-
shared_examples 'valid cucumber feature' do |project_name|
|
|
74
|
-
subject(:feature) { read_generated(project_name, 'features/login.feature') }
|
|
75
|
-
|
|
76
|
-
it 'has Feature keyword' do
|
|
77
|
-
expect(feature).to match(/Feature:/)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it 'has Scenario keyword' do
|
|
81
|
-
expect(feature).to match(/Scenario:/)
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it 'has Given/When/Then steps' do
|
|
85
|
-
expect(feature).to match(/Given/)
|
|
86
|
-
expect(feature).to match(/When/)
|
|
87
|
-
expect(feature).to match(/Then/)
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
shared_examples 'valid cucumber env' do |project_name|
|
|
92
|
-
subject(:env) { read_generated(project_name, 'features/support/env.rb') }
|
|
93
|
-
|
|
94
|
-
it 'has valid Ruby syntax' do
|
|
95
|
-
expect(env).to have_valid_ruby_syntax
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
shared_examples 'valid cucumber world' do |project_name|
|
|
100
|
-
subject(:world) { read_generated(project_name, 'features/support/world.rb') }
|
|
101
|
-
|
|
102
|
-
it 'has valid Ruby syntax' do
|
|
103
|
-
expect(world).to have_valid_ruby_syntax
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
shared_examples 'valid cucumber config' do |project_name|
|
|
108
|
-
subject(:config) { read_generated(project_name, 'cucumber.yml') }
|
|
109
|
-
|
|
110
|
-
it 'has default profile' do
|
|
111
|
-
expect(config).to include('default:')
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
it 'uses the pretty and rerun formatters, with the reporter activated from env.rb' do
|
|
115
|
-
expect(config.strip).to eq('default: --format pretty --format rerun --out rerun.txt --publish-quiet --retry 0')
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
58
|
shared_examples 'logged in example' do |project_name|
|
|
120
59
|
it 'adds a :logged_in example that reuses the saved login and keeps the login example' do
|
|
121
60
|
spec = read_generated(project_name, 'spec/login_page_spec.rb')
|
|
@@ -124,19 +63,6 @@ describe 'Test file content' do
|
|
|
124
63
|
end
|
|
125
64
|
end
|
|
126
65
|
|
|
127
|
-
shared_examples 'logged in scenario' do |project_name|
|
|
128
|
-
it 'adds a @logged_in scenario and keeps the login scenario' do
|
|
129
|
-
feature = read_generated(project_name, 'features/login.feature')
|
|
130
|
-
expect(feature).to include("@logged_in\nScenario: A logged-in user opens the account page",
|
|
131
|
-
"Given I'm a registered user\n", 'Scenario: A user can login')
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
it 'defines the step that picks the user without logging in' do
|
|
135
|
-
steps = read_generated(project_name, 'features/step_definitions/login_steps.rb')
|
|
136
|
-
expect(steps).to include(%q(Given("I'm a {user}") do |user|))
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
66
|
# --- RSpec contexts ---
|
|
141
67
|
|
|
142
68
|
context 'with rspec and selenium' do
|
|
@@ -145,91 +71,41 @@ describe 'Test file content' do
|
|
|
145
71
|
include_examples 'selenium rspec spec', name
|
|
146
72
|
include_examples 'logged in example', name
|
|
147
73
|
end
|
|
148
|
-
|
|
149
|
-
context 'with rspec and watir' do
|
|
150
|
-
name = "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
|
|
151
|
-
include_examples 'valid rspec spec', name
|
|
152
|
-
include_examples 'watir rspec spec', name
|
|
153
|
-
include_examples 'logged in example', name
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
# --- Cucumber contexts ---
|
|
157
|
-
|
|
158
|
-
context 'with cucumber and selenium' do
|
|
159
|
-
name = "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
|
|
160
|
-
include_examples 'valid cucumber feature', name
|
|
161
|
-
include_examples 'valid cucumber env', name
|
|
162
|
-
include_examples 'valid cucumber world', name
|
|
163
|
-
include_examples 'valid cucumber config', name
|
|
164
|
-
include_examples 'logged in scenario', name
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
context 'with cucumber and watir' do
|
|
168
|
-
name = "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
|
|
169
|
-
include_examples 'valid cucumber feature', name
|
|
170
|
-
include_examples 'valid cucumber env', name
|
|
171
|
-
include_examples 'valid cucumber world', name
|
|
172
|
-
include_examples 'valid cucumber config', name
|
|
173
|
-
include_examples 'logged in scenario', name
|
|
174
|
-
end
|
|
175
74
|
end
|
|
176
75
|
|
|
177
|
-
describe '
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
it 'leaves the watir world without WaitHelper' do
|
|
186
|
-
expect(read_generated('cucumber_watir', 'features/support/world.rb')).not_to include('WaitHelper')
|
|
76
|
+
describe 'Accessibility spec' do
|
|
77
|
+
it 'wraps the axe check in an immediate find' do
|
|
78
|
+
name = 'content_axe_rspec_selenium'
|
|
79
|
+
InvokeGenerators.generate_framework(automation: 'selenium', framework: 'rspec', name:, accessibility: true)
|
|
80
|
+
expect(read_generated(name, 'spec/accessibility_spec.rb'))
|
|
81
|
+
.to include('Raider::Wait.immediately { expect(driver).to be_axe_clean }')
|
|
82
|
+
ensure
|
|
83
|
+
FileUtils.rm_rf(name)
|
|
187
84
|
end
|
|
188
85
|
end
|
|
189
86
|
|
|
190
|
-
describe 'Example tests
|
|
191
|
-
it '
|
|
87
|
+
describe 'Example tests' do
|
|
88
|
+
it 'asserts the selenium rspec spec with have_text and no eventually' do
|
|
192
89
|
spec = read_generated('rspec_selenium', 'spec/login_page_spec.rb')
|
|
193
|
-
expect(spec.scan('
|
|
194
|
-
expect(spec.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
it "wraps the selenium cucumber Then step's assertion in eventually" do
|
|
198
|
-
steps = read_generated('cucumber_selenium', 'features/step_definitions/login_steps.rb')
|
|
199
|
-
expect(steps).to include('eventually { expect(account_page.header.customer_name).to eq ')
|
|
90
|
+
expect(spec.scan('expect { account_page.welcome_message }.to have_text("Welcome back #{user[\'name\']}")').size).to eq(2)
|
|
91
|
+
expect(spec).to include("expect { login_page.welcome_message }.to have_text('Login or register')")
|
|
92
|
+
expect(spec).not_to include('eventually')
|
|
200
93
|
end
|
|
201
94
|
|
|
202
95
|
%w[ios android cross_platform].each do |automation|
|
|
203
|
-
it "
|
|
96
|
+
it "asserts the #{automation} rspec spec with have_text and no eventually" do
|
|
204
97
|
spec = read_generated("rspec_#{automation}", 'spec/pdp_page_spec.rb')
|
|
205
|
-
expect(spec).to include("
|
|
98
|
+
expect(spec).to include("expect { pdp_page.add_to_cart_button }.to have_text('Add to Cart')")
|
|
99
|
+
expect(spec).not_to include('eventually')
|
|
206
100
|
end
|
|
207
101
|
|
|
208
|
-
it "
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
# The Watir output must stay as master generated it (1274a66), plus the 3.12.1 lint fixes; the snapshots in
|
|
216
|
-
# spec/fixtures/watir_master were generated from that commit's lib.
|
|
217
|
-
# To regenerate: `git archive 1274a66 lib` into a scratch dir, generate rspec and cucumber Watir projects there,
|
|
218
|
-
# then apply only the Readme deprecation-line delta (the `> **Deprecated:**` line under the heading block) and
|
|
219
|
-
# the 3.12.1 changes: RuboCop lint fixes (page.rb loses its extra blank lines, login_steps.rb ends with a newline)
|
|
220
|
-
# plus the frozen_string_literal comments the syntax spec requires (Style/FrozenStringLiteralComment is disabled
|
|
221
|
-
# in the generated .rubocop.yml, so RuboCop does not ask for them) on the Watir page, world and user_factory files.
|
|
222
|
-
describe 'Watir example output' do
|
|
223
|
-
snapshots = File.expand_path('../../fixtures/watir_master', __dir__)
|
|
224
|
-
|
|
225
|
-
{ 'rspec_watir' => %w[page_objects/pages/login.rb page_objects/abstract/page.rb spec/login_page_spec.rb Readme.md],
|
|
226
|
-
'cucumber_watir' => %w[page_objects/pages/login.rb page_objects/abstract/page.rb
|
|
227
|
-
features/step_definitions/login_steps.rb Readme.md] }.each do |project, files|
|
|
228
|
-
files.each do |file|
|
|
229
|
-
it "keeps #{project}/#{file} as master generates it" do
|
|
230
|
-
expected = File.read(File.join(snapshots, project, "#{file}.snapshot"))
|
|
231
|
-
expect(read_generated(project, file)).to eq(expected)
|
|
232
|
-
end
|
|
102
|
+
it "writes the #{automation} page objects in plain Appium" do
|
|
103
|
+
home = read_generated("rspec_#{automation}", 'page_objects/pages/home.rb')
|
|
104
|
+
pdp = read_generated("rspec_#{automation}", 'page_objects/pages/pdp.rb')
|
|
105
|
+
expect(home).to include('first_product.click')
|
|
106
|
+
expect(home).not_to match(/\btap\(/)
|
|
107
|
+
expect(pdp).to include('def add_to_cart_button').and match(/\b(driver\.find_element|element)\(/)
|
|
108
|
+
expect(pdp).not_to include('add_to_cart_text')
|
|
233
109
|
end
|
|
234
110
|
end
|
|
235
111
|
end
|
|
@@ -117,18 +117,12 @@ describe 'End-to-End Feature Validation' do
|
|
|
117
117
|
expect(helper).to include('config.verbose_retry = true')
|
|
118
118
|
expect(helper).to include("ENV.fetch('RETRY_COUNT', 0)")
|
|
119
119
|
end
|
|
120
|
-
|
|
121
|
-
it 'cucumber projects have --retry in cucumber.yml' do
|
|
122
|
-
cucumber_yml = read_generated("#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}", 'cucumber.yml')
|
|
123
|
-
expect(cucumber_yml).to include('--retry')
|
|
124
|
-
end
|
|
125
120
|
end
|
|
126
121
|
|
|
127
122
|
# --- Feature: Tag-based rake tasks (C5) ---
|
|
128
123
|
|
|
129
124
|
context 'Tag-based rake tasks' do
|
|
130
125
|
let(:rspec_project) { "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}" }
|
|
131
|
-
let(:cucumber_project) { "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}" }
|
|
132
126
|
|
|
133
127
|
it 'rspec Rakefile has smoke task' do
|
|
134
128
|
rakefile = read_generated(rspec_project, 'Rakefile')
|
|
@@ -142,11 +136,6 @@ describe 'End-to-End Feature Validation' do
|
|
|
142
136
|
expect(rakefile).to include("'--tag regression'")
|
|
143
137
|
end
|
|
144
138
|
|
|
145
|
-
it 'cucumber Rakefile has smoke task with cucumber tags' do
|
|
146
|
-
rakefile = read_generated(cucumber_project, 'Rakefile')
|
|
147
|
-
expect(rakefile).to include("'--tags @smoke'")
|
|
148
|
-
end
|
|
149
|
-
|
|
150
139
|
it 'rspec smoke rake task works', :slow do
|
|
151
140
|
skip 'Bundle install needed' unless bundle_install(rspec_project)
|
|
152
141
|
|
|
@@ -159,7 +148,6 @@ describe 'End-to-End Feature Validation' do
|
|
|
159
148
|
|
|
160
149
|
context 'Re-run failed tests' do
|
|
161
150
|
let(:rspec_project) { "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}" }
|
|
162
|
-
let(:cucumber_project) { "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}" }
|
|
163
151
|
|
|
164
152
|
it 'rspec projects have .rspec file' do
|
|
165
153
|
expect(File).to exist("#{rspec_project}/.rspec")
|
|
@@ -179,10 +167,6 @@ describe 'End-to-End Feature Validation' do
|
|
|
179
167
|
gitignore = read_generated(rspec_project, '.gitignore')
|
|
180
168
|
expect(gitignore).to include('spec/examples.txt')
|
|
181
169
|
end
|
|
182
|
-
|
|
183
|
-
it 'cucumber projects do not have .rspec file' do
|
|
184
|
-
expect(File).not_to exist("#{cucumber_project}/.rspec")
|
|
185
|
-
end
|
|
186
170
|
end
|
|
187
171
|
|
|
188
172
|
# --- Feature: Accessibility addon (axe) ---
|
|
@@ -193,14 +177,10 @@ describe 'End-to-End Feature Validation' do
|
|
|
193
177
|
automation: 'selenium', framework: 'rspec', name: 'e2e_axe_rspec',
|
|
194
178
|
accessibility: true
|
|
195
179
|
)
|
|
196
|
-
InvokeGenerators.generate_framework(
|
|
197
|
-
automation: 'selenium', framework: 'cucumber', name: 'e2e_axe_cucumber',
|
|
198
|
-
accessibility: true
|
|
199
|
-
)
|
|
200
180
|
end
|
|
201
181
|
|
|
202
182
|
after(:all) do # rubocop:disable RSpec/BeforeAfterAll
|
|
203
|
-
|
|
183
|
+
FileUtils.rm_rf('e2e_axe_rspec')
|
|
204
184
|
end
|
|
205
185
|
|
|
206
186
|
describe 'axe + RSpec' do
|
|
@@ -220,28 +200,6 @@ describe 'End-to-End Feature Validation' do
|
|
|
220
200
|
expect { RubyVM::InstructionSequence.compile(content) }.not_to raise_error
|
|
221
201
|
end
|
|
222
202
|
end
|
|
223
|
-
|
|
224
|
-
describe 'axe + Cucumber' do
|
|
225
|
-
it 'creates accessibility.feature' do
|
|
226
|
-
expect(File).to exist('e2e_axe_cucumber/features/accessibility.feature')
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
it 'creates accessibility_steps.rb' do
|
|
230
|
-
expect(File).to exist('e2e_axe_cucumber/features/step_definitions/accessibility_steps.rb')
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
it 'includes axe gems in Gemfile' do
|
|
234
|
-
gemfile = File.read('e2e_axe_cucumber/Gemfile')
|
|
235
|
-
expect(gemfile).to include('axe')
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
it 'all Ruby files have valid syntax' do
|
|
239
|
-
ruby_files('e2e_axe_cucumber').each do |file|
|
|
240
|
-
content = File.read(file)
|
|
241
|
-
expect(content).to have_valid_ruby_syntax, "#{file} has invalid syntax"
|
|
242
|
-
end
|
|
243
|
-
end
|
|
244
|
-
end
|
|
245
203
|
end
|
|
246
204
|
|
|
247
205
|
# --- Feature: GitHub Actions CI ---
|