ruby_raider 3.13.0 → 4.0.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/ffmpeg/build.sh +208 -0
- data/.github/ffmpeg/check.sh +72 -0
- data/.github/ffmpeg/frames.rb +34 -0
- data/.github/ffmpeg/probe.sh +17 -0
- data/.github/workflows/ffmpeg.yml +160 -0
- 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 +172 -70
- data/RELEASE.md +29 -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 +363 -257
- 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 +4 -10
- data/lib/ruby_raider/ffmpeg.rb +38 -11
- 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/ffmpeg.rbs +1 -0
- 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 +21 -13
- 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 +141 -77
- 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 +334 -329
- 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/ffmpeg_spec.rb +80 -7
- data/spec/utilities/headless_config_spec.rb +0 -7
- data/spec/utilities/utilities_spec.rb +24 -0
- data/spec/utilities/video_command_spec.rb +13 -0
- metadata +118 -53
- data/docs/superpowers/plans/2026-10-25-failure-video-replay.md +0 -400
- data/docs/superpowers/plans/2026-10-26-parity-cleanup.md +0 -233
- data/docs/superpowers/plans/2026-10-28-failure-card.md +0 -295
- data/docs/superpowers/specs/2026-10-25-failure-video-replay-design.md +0 -214
- data/docs/superpowers/specs/2026-10-28-failure-card-design.md +0 -210
- 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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'yaml'
|
|
3
4
|
require_relative 'content_helper'
|
|
4
5
|
|
|
5
6
|
describe 'Page object content' do
|
|
@@ -36,16 +37,15 @@ describe 'Page object content' do
|
|
|
36
37
|
shared_examples 'selenium login page' do |project_name|
|
|
37
38
|
subject(:login) { read_generated(project_name, 'page_objects/pages/login.rb') }
|
|
38
39
|
|
|
39
|
-
it 'returns
|
|
40
|
-
expect(login).to include("
|
|
41
|
-
|
|
42
|
-
expect(login).not_to include('
|
|
40
|
+
it 'returns Selenium elements from the element methods' do
|
|
41
|
+
expect(login).to include("driver.find_element(id: 'loginFrm_loginname')", "driver.find_element(id: 'loginFrm_password')",
|
|
42
|
+
"driver.find_element(by_role('button', name: 'Login'))")
|
|
43
|
+
expect(login).not_to include('browser.')
|
|
43
44
|
end
|
|
44
45
|
|
|
45
|
-
it 'logs in
|
|
46
|
-
expect(login).to include('send_keys(
|
|
47
|
-
|
|
48
|
-
expect(login).not_to include('.send_keys', '.click')
|
|
46
|
+
it 'logs in by acting on the elements' do
|
|
47
|
+
expect(login).to include('username_field.send_keys(username)', 'password_field.send_keys(password)', 'login_button.click')
|
|
48
|
+
expect(login).to include('alias log_as login')
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
it 'has private element methods' do
|
|
@@ -59,28 +59,6 @@ describe 'Page object content' do
|
|
|
59
59
|
expect(login).not_to include('Capybara::DSL')
|
|
60
60
|
expect(login).not_to include('fill_in')
|
|
61
61
|
end
|
|
62
|
-
|
|
63
|
-
it 'does not include Watir methods' do
|
|
64
|
-
expect(login).not_to include('browser.text_field')
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
shared_examples 'watir login page' do |project_name|
|
|
69
|
-
subject(:login) { read_generated(project_name, 'page_objects/pages/login.rb') }
|
|
70
|
-
|
|
71
|
-
it 'uses browser methods for elements' do
|
|
72
|
-
expect(login).to include('browser.text_field')
|
|
73
|
-
expect(login).to include('browser.button')
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it 'uses set for input' do
|
|
77
|
-
expect(login).to include('.set ')
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it 'does not include Selenium methods' do
|
|
81
|
-
expect(login).not_to include('find_element')
|
|
82
|
-
expect(login).not_to include('send_keys')
|
|
83
|
-
end
|
|
84
62
|
end
|
|
85
63
|
|
|
86
64
|
# --- Abstract page ---
|
|
@@ -99,6 +77,39 @@ describe 'Page object content' do
|
|
|
99
77
|
it 'defines to_s method' do
|
|
100
78
|
expect(page).to match(/def to_s/)
|
|
101
79
|
end
|
|
80
|
+
|
|
81
|
+
describe 'full_url' do
|
|
82
|
+
# The generated full_url and base_url, loaded without the helpers the abstract page requires.
|
|
83
|
+
let(:page_class) do
|
|
84
|
+
methods = page[/^ def full_url.*?^ end\n\n(?: #.*\n)* def base_url.*?^ end\n/m]
|
|
85
|
+
expect(methods).not_to be_nil
|
|
86
|
+
Class.new { def url(_page) = 'index.php?rt=account/login' }.tap { |klass| klass.class_eval(methods) }
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def full_url_with(base_url, path = nil)
|
|
90
|
+
allow(YAML).to receive(:load_file).with('config/config.yml').and_return('url' => base_url)
|
|
91
|
+
klass = page_class
|
|
92
|
+
klass.define_method(:url) { |_page| path } if path
|
|
93
|
+
klass.new.full_url(nil)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'adds the missing slash between a base url with a path and the page path' do
|
|
97
|
+
expect(full_url_with('https://example.org/login')).to eq('https://example.org/login/index.php?rt=account/login')
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it 'keeps a single slash when the base url already ends with one' do
|
|
101
|
+
expect(full_url_with('https://example.org/login/')).to eq('https://example.org/login/index.php?rt=account/login')
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it 'does not double the slash when the page path starts with one' do
|
|
105
|
+
expect(full_url_with('https://example.org', '/index.php')).to eq('https://example.org/index.php')
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it 'returns the page path alone when the config has no url' do
|
|
109
|
+
expect(full_url_with(nil, 'https://other.example/index.php')).to eq('https://other.example/index.php')
|
|
110
|
+
expect(full_url_with(nil, '/index.php')).to eq('/index.php')
|
|
111
|
+
end
|
|
112
|
+
end
|
|
102
113
|
end
|
|
103
114
|
|
|
104
115
|
shared_examples 'selenium abstract page' do |project_name|
|
|
@@ -121,22 +132,6 @@ describe 'Page object content' do
|
|
|
121
132
|
end
|
|
122
133
|
end
|
|
123
134
|
|
|
124
|
-
shared_examples 'watir abstract page' do |project_name|
|
|
125
|
-
subject(:page) { read_generated(project_name, 'page_objects/abstract/page.rb') }
|
|
126
|
-
|
|
127
|
-
it 'has attr_reader :browser' do
|
|
128
|
-
expect(page).to include('attr_reader :browser')
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
it 'has initialize accepting browser' do
|
|
132
|
-
expect(page).to match(/def initialize\(browser\)/)
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
it 'has visit with browser.goto' do
|
|
136
|
-
expect(page).to include('browser.goto')
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
135
|
# --- Contexts ---
|
|
141
136
|
|
|
142
137
|
context 'with rspec and selenium' do
|
|
@@ -146,49 +141,29 @@ describe 'Page object content' do
|
|
|
146
141
|
include_examples 'valid abstract page', name
|
|
147
142
|
include_examples 'selenium abstract page', name
|
|
148
143
|
end
|
|
149
|
-
|
|
150
|
-
context 'with rspec and watir' do
|
|
151
|
-
name = "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
|
|
152
|
-
include_examples 'valid login page', name
|
|
153
|
-
include_examples 'watir login page', name
|
|
154
|
-
include_examples 'valid abstract page', name
|
|
155
|
-
include_examples 'watir abstract page', name
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
context 'with cucumber and selenium' do
|
|
159
|
-
name = "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
|
|
160
|
-
include_examples 'valid login page', name
|
|
161
|
-
include_examples 'selenium login page', name
|
|
162
|
-
include_examples 'valid abstract page', name
|
|
163
|
-
include_examples 'selenium abstract page', name
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
context 'with cucumber and watir' do
|
|
167
|
-
name = "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
|
|
168
|
-
include_examples 'valid login page', name
|
|
169
|
-
include_examples 'watir login page', name
|
|
170
|
-
include_examples 'valid abstract page', name
|
|
171
|
-
include_examples 'watir abstract page', name
|
|
172
|
-
end
|
|
173
144
|
end
|
|
174
145
|
|
|
175
|
-
describe 'Page
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
146
|
+
describe 'Page helper wiring' do
|
|
147
|
+
FRAMEWORKS.each do |framework|
|
|
148
|
+
it "includes NetworkHelper only in #{framework} selenium" do
|
|
149
|
+
%w[selenium ios android cross_platform].each do |automation|
|
|
179
150
|
page = read_generated("#{framework}_#{automation}", 'page_objects/abstract/page.rb')
|
|
180
|
-
expect(page).to
|
|
151
|
+
expect(page.include?('include NetworkHelper')).to eq(automation == 'selenium')
|
|
181
152
|
end
|
|
182
153
|
end
|
|
183
154
|
|
|
184
|
-
it "
|
|
185
|
-
|
|
155
|
+
it "includes ScreenshotHelper only in #{framework} selenium" do
|
|
156
|
+
%w[selenium ios android cross_platform].each do |automation|
|
|
157
|
+
page = read_generated("#{framework}_#{automation}", 'page_objects/abstract/page.rb')
|
|
158
|
+
expect(page.include?('include ScreenshotHelper')).to eq(automation == 'selenium')
|
|
159
|
+
expect(page.include?("require_relative '../../helpers/screenshot_helper'")).to eq(automation == 'selenium')
|
|
160
|
+
end
|
|
186
161
|
end
|
|
187
162
|
end
|
|
188
163
|
end
|
|
189
164
|
|
|
190
165
|
describe 'Abstract page layout' do
|
|
191
|
-
|
|
166
|
+
FRAMEWORKS.each do |framework|
|
|
192
167
|
%w[selenium ios android cross_platform].each do |automation|
|
|
193
168
|
[true, false].each do |examples|
|
|
194
169
|
it "has no blank line before the class end in #{framework} #{automation}#{' (skeleton)' unless examples}" do
|
|
@@ -200,12 +175,12 @@ describe 'Abstract page layout' do
|
|
|
200
175
|
end
|
|
201
176
|
end
|
|
202
177
|
|
|
203
|
-
describe 'Example pages
|
|
204
|
-
|
|
205
|
-
it "
|
|
178
|
+
describe 'Example pages' do
|
|
179
|
+
FRAMEWORKS.each do |framework|
|
|
180
|
+
it "defines welcome_message on the abstract page in #{framework} selenium" do
|
|
206
181
|
page = read_generated("#{framework}_selenium", 'page_objects/abstract/page.rb')
|
|
207
|
-
expect(page).to include("
|
|
208
|
-
expect(page).not_to include('
|
|
182
|
+
expect(page).to include("def welcome_message\n driver.find_element(css: '.welcome-msg')")
|
|
183
|
+
expect(page).not_to include('Header', 'components/header')
|
|
209
184
|
end
|
|
210
185
|
|
|
211
186
|
%w[ios android cross_platform].each do |automation|
|
|
@@ -213,10 +188,12 @@ describe 'Example pages on the wait helper' do
|
|
|
213
188
|
let(:home) { read_generated("#{framework}_#{automation}", 'page_objects/pages/home.rb') }
|
|
214
189
|
let(:pdp) { read_generated("#{framework}_#{automation}", 'page_objects/pages/pdp.rb') }
|
|
215
190
|
|
|
216
|
-
it '
|
|
217
|
-
|
|
218
|
-
expect(
|
|
219
|
-
expect(
|
|
191
|
+
it 'clicks the first product and exposes the add to cart button as plain Appium' do
|
|
192
|
+
finder = automation == 'cross_platform' ? 'element(' : 'driver.find_element('
|
|
193
|
+
expect(home).to include('first_product.click', " private\n", "def first_product\n #{finder}")
|
|
194
|
+
expect(pdp).to include('def add_to_cart_button')
|
|
195
|
+
expect(pdp).not_to include('add_to_cart_text', 'private')
|
|
196
|
+
expect(home + pdp).not_to include('tap(', 'text(', 'driver.wait')
|
|
220
197
|
end
|
|
221
198
|
|
|
222
199
|
it 'returns locator hashes from the element methods' do
|
|
@@ -238,3 +215,24 @@ describe 'Example pages on the wait helper' do
|
|
|
238
215
|
end
|
|
239
216
|
end
|
|
240
217
|
end
|
|
218
|
+
|
|
219
|
+
describe 'Page runtime wiring' do
|
|
220
|
+
it 'requires the appium helper that the cross platform page includes' do
|
|
221
|
+
page = read_generated("#{FrameworkIndex::RSPEC}_cross_platform", 'page_objects/abstract/page.rb')
|
|
222
|
+
expect(page).to include("require_relative '../../helpers/appium_helper'", 'include AppiumHelper')
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
it 'leaves the appium helper out of the other pages' do
|
|
226
|
+
%w[selenium ios android].each do |automation|
|
|
227
|
+
page = read_generated("#{FrameworkIndex::RSPEC}_#{automation}", 'page_objects/abstract/page.rb')
|
|
228
|
+
expect(page).not_to include('appium_helper')
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
AUTOMATION_TYPES.each do |automation|
|
|
233
|
+
it "requires the runtime and includes Raider::Helpers in #{automation}" do
|
|
234
|
+
page = read_generated("#{FrameworkIndex::RSPEC}_#{automation}", 'page_objects/abstract/page.rb')
|
|
235
|
+
expect(page).to include("require 'ruby_raider/runtime'", 'include Raider::Helpers')
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
@@ -8,7 +8,7 @@ describe 'Generated Readme content' do
|
|
|
8
8
|
subject(:section) { readme[/^### Video replay\n.*?(?=^##)/m]&.gsub(/\s+/, ' ') }
|
|
9
9
|
|
|
10
10
|
let(:readme) { read_generated("#{framework}_#{automation}", 'Readme.md') }
|
|
11
|
-
let(:web) {
|
|
11
|
+
let(:web) { automation == 'selenium' }
|
|
12
12
|
|
|
13
13
|
it 'exists and covers the defaults, VIDEO=off, the install commands and the cache' do
|
|
14
14
|
expect(section).not_to be_nil
|
|
@@ -17,8 +17,13 @@ describe 'Generated Readme content' do
|
|
|
17
17
|
'RAIDER_CACHE_DIR', 'raider-results/attachments/')
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
it '
|
|
21
|
-
expect(section).to include('ffmpeg-7.1'
|
|
20
|
+
it 'names the ffmpeg-7.1 release and no longer says it is unpublished' do
|
|
21
|
+
expect(section).to include('ffmpeg-7.1') if web
|
|
22
|
+
expect(section).not_to include('not published yet')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'lists the platforms with an ffmpeg download for web projects' do
|
|
26
|
+
expect(section).to include('macOS (Apple silicon and Intel), Linux x64 and Windows x64') if web
|
|
22
27
|
end
|
|
23
28
|
|
|
24
29
|
it 'names the right video format and how to turn video off for this project' do
|
|
@@ -86,59 +91,84 @@ describe 'Generated Readme content' do
|
|
|
86
91
|
expect(section).to include('Failure messages can contain typed text too, because an assertion message is kept as it is')
|
|
87
92
|
end
|
|
88
93
|
|
|
89
|
-
it 'says how to remove the trace helper
|
|
90
|
-
expect(readme).to include('Removing the trace helper', 'require_relative'
|
|
91
|
-
'without WaitHelper a trace records only navigation and the failure')
|
|
94
|
+
it 'says how to remove the trace helper' do
|
|
95
|
+
expect(readme).to include('Removing the trace helper', 'require_relative')
|
|
92
96
|
expect(readme).not_to match(/allure/i)
|
|
93
97
|
expect(readme).not_to include('—')
|
|
94
98
|
end
|
|
99
|
+
|
|
100
|
+
it 'says which element actions the trace records' do
|
|
101
|
+
expect(section).to include('records `click`, `send_keys`, `clear` and `submit` with their locators',
|
|
102
|
+
'`by_role` as `button, name: Save`', 'not steps')
|
|
103
|
+
end
|
|
95
104
|
else
|
|
96
105
|
it 'does not mention trace replay' do
|
|
97
106
|
expect(readme).not_to include('Trace replay', 'TRACE=', 'trace_helper')
|
|
98
107
|
end
|
|
99
108
|
end
|
|
100
109
|
end
|
|
101
|
-
end
|
|
102
110
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
subject(:readme) { read_generated("#{FrameworkIndex::RSPEC}_#{automation}", 'Readme.md') }
|
|
111
|
+
context "with #{framework} and #{automation}, the network mocking section" do
|
|
112
|
+
subject(:readme) { read_generated("#{framework}_#{automation}", 'Readme.md') }
|
|
106
113
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
if automation == 'selenium'
|
|
115
|
+
it 'documents the API, the examples, BIDI=off and how to remove the helper' do
|
|
116
|
+
expect(readme).to include('## Mocking network requests', "mock_request('**/api/users', json: { users: [] })",
|
|
117
|
+
'BIDI=off', '### Removing the network helper', 'status: 500',
|
|
118
|
+
"block_request('**/*.png')", 'NetworkHelper::MockError')
|
|
119
|
+
expect(readme).to include('expect { users.called? }.to be(true)',
|
|
120
|
+
"expect { users.calls.first&.method }.to eq('GET')")
|
|
121
|
+
end
|
|
110
122
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
it 'names the files to edit for this framework' do
|
|
124
|
+
section = readme[/^### Removing the network helper\n.*?(?=^##)/m]
|
|
125
|
+
expect(section).to include('helpers/network_helper.rb', 'NetworkHelper.finish', 'raise mock_error')
|
|
126
|
+
expect(section).to include(framework == 'rspec' ? 'config.include(NetworkHelper)' : 'World(NetworkHelper)')
|
|
127
|
+
end
|
|
115
128
|
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
it 'says that TRACE=off keeps BiDi on' do
|
|
130
|
+
expect(readme).to include('BiDi stays on')
|
|
131
|
+
end
|
|
132
|
+
else
|
|
133
|
+
it 'does not mention network mocking' do
|
|
134
|
+
expect(readme).not_to include('Mocking network requests', 'NetworkHelper')
|
|
135
|
+
end
|
|
118
136
|
end
|
|
137
|
+
end
|
|
119
138
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
'raider-reporter gate', 'raider-gate', 'exits 1 when the gate fails',
|
|
123
|
-
'2 when it gets no verdict', 'RAIDER_GATE_TIMEOUT', 'RAIDER_SHARD_TOTAL',
|
|
124
|
-
'RAIDER_SHARD_INDEX')
|
|
125
|
-
end
|
|
139
|
+
context "with #{framework} and #{automation}, the screenshot comparison section" do
|
|
140
|
+
subject(:readme) { read_generated("#{framework}_#{automation}", 'Readme.md') }
|
|
126
141
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
142
|
+
if automation == 'selenium'
|
|
143
|
+
it 'documents the call, SCREENSHOTS=update, tolerances, CI baselines and removal' do
|
|
144
|
+
expect(readme).to include('## Screenshot comparison', "match_screenshot('home')", 'SCREENSHOTS=update',
|
|
145
|
+
'screenshots/baselines/', 'max_diff_pixels', 'Retina', 'Generate baselines where CI runs',
|
|
146
|
+
'### Removing screenshot comparison')
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
it 'names the files to edit for this framework' do
|
|
150
|
+
section = readme[/^### Removing screenshot comparison\n.*?(?=^##)/m]
|
|
151
|
+
expect(section).to include('helpers/screenshot_helper.rb', 'ScreenshotHelper.reset', "gem 'chunky_png'")
|
|
152
|
+
expect(section).to include(framework == 'rspec' ? 'config.include(ScreenshotHelper)' : 'World(ScreenshotHelper)')
|
|
153
|
+
end
|
|
154
|
+
else
|
|
155
|
+
it 'does not mention screenshot comparison' do
|
|
156
|
+
expect(readme).not_to include('Screenshot comparison', 'ScreenshotHelper', 'match_screenshot')
|
|
157
|
+
end
|
|
130
158
|
end
|
|
131
159
|
end
|
|
160
|
+
end
|
|
132
161
|
|
|
133
|
-
|
|
134
|
-
|
|
162
|
+
AUTOMATION_TYPES.each do |automation|
|
|
163
|
+
context "with rspec and #{automation}" do
|
|
164
|
+
subject(:readme) { read_generated("#{FrameworkIndex::RSPEC}_#{automation}", 'Readme.md') }
|
|
135
165
|
|
|
136
166
|
it 'has a Reporting section' do
|
|
137
167
|
expect(readme).to include('## Reporting')
|
|
138
168
|
end
|
|
139
169
|
|
|
140
|
-
it 'documents local results, upload settings
|
|
141
|
-
expect(readme).to include('raider-results/', 'RAIDER_TOKEN', 'RAIDER_ENDPOINT',
|
|
170
|
+
it 'documents local results, upload settings and the raider_reporter README' do
|
|
171
|
+
expect(readme).to include('raider-results/', 'RAIDER_TOKEN', 'RAIDER_ENDPOINT',
|
|
142
172
|
'https://github.com/RaiderHQ/raider_reporter')
|
|
143
173
|
end
|
|
144
174
|
|
|
@@ -153,7 +183,8 @@ describe 'Generated Readme content' do
|
|
|
153
183
|
'RAIDER_SHARD_INDEX')
|
|
154
184
|
end
|
|
155
185
|
|
|
156
|
-
it '
|
|
186
|
+
it 'points to the local HTML report' do
|
|
187
|
+
expect(readme).to include('raider-results/index.html')
|
|
157
188
|
expect(readme).not_to match(/allure/i)
|
|
158
189
|
end
|
|
159
190
|
end
|
|
@@ -163,11 +194,11 @@ describe 'Generated Readme content' do
|
|
|
163
194
|
context "with #{framework} and #{automation}, the login reuse section" do
|
|
164
195
|
subject(:readme) { read_generated("#{framework}_#{automation}", 'Readme.md') }
|
|
165
196
|
|
|
166
|
-
if
|
|
197
|
+
if automation == 'selenium'
|
|
167
198
|
it 'documents the tags, other roles, max_age, the env switch and the secrets warning' do
|
|
168
199
|
section = readme[/^## Reusing the login\n.*?(?=^##)/m].gsub(/\s+/, ' ')
|
|
169
|
-
expect(section).to include('`:logged_in`',
|
|
170
|
-
'
|
|
200
|
+
expect(section).to include('`:logged_in`', "SessionState.new(driver, name: 'admin')",
|
|
201
|
+
'login_state', 'max_age', 'RAIDER_LOGIN_STATE=off',
|
|
171
202
|
'RAIDER_LOGIN_STATE=refresh', '.raider/auth/', 'git-ignored',
|
|
172
203
|
'live session tokens', 'must not be committed, cached or uploaded')
|
|
173
204
|
end
|
|
@@ -204,36 +235,55 @@ describe 'Generated Readme: How the framework works' do
|
|
|
204
235
|
expect(readme.index("\n## Reusing the login\n")).to be > works
|
|
205
236
|
end
|
|
206
237
|
|
|
207
|
-
it 'covers the
|
|
238
|
+
it 'covers the folders, the settings, running the tests and the helpers without a wait helper' do
|
|
208
239
|
section = section_of(readme)
|
|
209
|
-
expect(section).to include('
|
|
210
|
-
|
|
211
|
-
'select_by', 'hover', 'drag_and_drop', 'eventually', 'timeout: 0',
|
|
212
|
-
'find_elements', 'config/config.yml', '[Reporting](#reporting)',
|
|
213
|
-
'[Reusing the login](#reusing-the-login)', 'parallel_tests', 'HEADLESS',
|
|
240
|
+
expect(section).to include('config/config.yml', '[Reporting](#reporting)', '[Reusing the login](#reusing-the-login)',
|
|
241
|
+
'parallel_tests', 'HEADLESS', 'requires the Raider runtime',
|
|
214
242
|
framework == 'rspec' ? 'RETRY_COUNT' : '--retry 2')
|
|
215
|
-
expect(section).
|
|
243
|
+
expect(section).to include('`timeout`', '`strict`', '`actionability`')
|
|
244
|
+
expect(section).not_to include('scroll_to', 'swipe', 'gesture_helper')
|
|
216
245
|
end
|
|
217
246
|
|
|
218
|
-
it '
|
|
219
|
-
|
|
220
|
-
expect(
|
|
221
|
-
'`timeout: 2` gets 2 seconds per try', '(still failing after 10s)')
|
|
247
|
+
it 'has no wait helper, RaiderElement, eventually or implicit wait advice' do
|
|
248
|
+
expect(readme).not_to match(/WaitHelper|RaiderElement|wait_helper|raider_element|eventually|wait helper/i)
|
|
249
|
+
expect(readme).not_to include('Removing the wait helper', 'implicit_wait = ')
|
|
222
250
|
end
|
|
223
251
|
|
|
224
|
-
it '
|
|
225
|
-
|
|
226
|
-
expect(
|
|
227
|
-
|
|
228
|
-
|
|
252
|
+
it 'documents the locators, with by_role, the exact form, strictness and find_elements' do
|
|
253
|
+
locators = section_of(readme)[/^### Locators\n.*?(?=^### )/m].gsub(/\s+/, ' ')
|
|
254
|
+
expect(locators).to include('id:', 'css:', 'xpath:', 'name:', 'class:', 'link_text:', 'label:', 'placeholder:',
|
|
255
|
+
'alt:', 'title:', 'text:', 'test_id:', 'data-testid', 'RAIDER_TEST_ID_ATTRIBUTE',
|
|
256
|
+
"by_role('button', name: 'Login')", 'exact:', 'include_hidden:', 'level:',
|
|
257
|
+
"label: ['Email', { exact: true }]", 'matches more than one element',
|
|
258
|
+
'AmbiguousMatch', 'find_elements')
|
|
229
259
|
end
|
|
230
260
|
|
|
231
|
-
it '
|
|
232
|
-
|
|
233
|
-
expect(
|
|
234
|
-
'
|
|
235
|
-
'
|
|
236
|
-
|
|
261
|
+
it 'documents the waiting finds, the per-action checks, force and the settings' do
|
|
262
|
+
waiting = section_of(readme)[/^### Waiting and actionability\n.*?(?=^### )/m].gsub(/\s+/, ' ')
|
|
263
|
+
expect(waiting).to include('`find_element` and `find_elements` wait for a match', '`find_elements` returns `[]`',
|
|
264
|
+
'| `click` | visible, enabled, not inert, stable, receives events |',
|
|
265
|
+
'| `send_keys` | visible, enabled, editable, not inert |',
|
|
266
|
+
'| `clear` | visible, enabled, editable, not inert |',
|
|
267
|
+
'| `submit` | visible, enabled, not inert |',
|
|
268
|
+
'force: true', 'Raider.actionability = false', 'RAIDER_STRICT', 'RAIDER_ACTIONABILITY',
|
|
269
|
+
'RAIDER_TIMEOUT', 'RAIDER_QUIET', 'raider u strict', 'raider u actionability',
|
|
270
|
+
'no such element: { id: "x" } (waited 10s)', 'NotActionable', 'select_by',
|
|
271
|
+
'implicit wait')
|
|
272
|
+
expect(waiting).not_to include('driver.manage.timeouts.implicit_wait')
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
it 'documents the matchers, wait:, the block form and its limits' do
|
|
276
|
+
assertions = section_of(readme)[/^### Assertions\n.*?(?=^### )/m].gsub(/\s+/, ' ')
|
|
277
|
+
expect(assertions).to include('have_text', 'have_value', 'have_attribute', 'be_visible', 'be_hidden', 'be_enabled',
|
|
278
|
+
'be_disabled', 'be_checked', 'have_count', 'have_title', 'have_url', 'have_element',
|
|
279
|
+
'have_css', 'have_xpath', 'wait: 5', 'expect { account_page.welcome_message }',
|
|
280
|
+
'expect { value }.to eq(', 'raise_error', 'does not retry',
|
|
281
|
+
'once per poll', 'aggregate_failures')
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
it 'lists the web helpers and the page base class without a wait helper' do
|
|
285
|
+
section = section_of(readme)
|
|
286
|
+
expect(section).to include('`driver_helper.rb` starts the browser', '`video_helper.rb`', '`session_state.rb`')
|
|
237
287
|
end
|
|
238
288
|
end
|
|
239
289
|
|
|
@@ -248,15 +298,40 @@ describe 'Generated Readme: How the framework works' do
|
|
|
248
298
|
expect(readme.index("\n## Reporting\n")).to be > works
|
|
249
299
|
end
|
|
250
300
|
|
|
251
|
-
it 'covers the
|
|
301
|
+
it 'covers the folders, per-OS locators, Appium setup and the gesture helper' do
|
|
252
302
|
section = section_of(readme)
|
|
253
|
-
expect(section).to include('
|
|
254
|
-
'
|
|
255
|
-
'
|
|
256
|
-
expect(section).not_to include('select_by', 'hover', 'drag_and_drop', 'Reusing the login', '/wd/hub'
|
|
303
|
+
expect(section).to include('capabilities.yml', 'raider u start_appium', '[Reporting](#reporting)',
|
|
304
|
+
'timeout: 15', 'http://127.0.0.1:4723', '`gesture_helper.rb`',
|
|
305
|
+
'`swipe`', '`scroll_to`', 'requires the Raider runtime')
|
|
306
|
+
expect(section).not_to include('select_by', 'hover', 'drag_and_drop', 'Reusing the login', '/wd/hub',
|
|
307
|
+
'by_role', 'wait_helper', 'raider_element')
|
|
257
308
|
expect(section).to include('ios: {') if automation == 'cross_platform'
|
|
258
309
|
end
|
|
259
310
|
|
|
311
|
+
it 'has no wait helper, RaiderElement or eventually' do
|
|
312
|
+
expect(readme).not_to match(/WaitHelper|RaiderElement|wait_helper|raider_element|eventually|wait helper/i)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
it 'documents the Appium locators and the waiting finds and actions' do
|
|
316
|
+
section = section_of(readme)
|
|
317
|
+
locators = section[/^### Locators\n.*?(?=^### )/m].gsub(/\s+/, ' ')
|
|
318
|
+
expect(locators).to include('accessibility_id:', 'xpath:', 'id:', 'class_name:', 'find_elements')
|
|
319
|
+
expect(section).to include('element(ios: { … }, android: { … })') if automation == 'cross_platform'
|
|
320
|
+
waiting = section[/^### Waiting\n.*?(?=^### )/m].gsub(/\s+/, ' ')
|
|
321
|
+
expect(waiting).to include('`find_element` and `find_elements` wait for a match',
|
|
322
|
+
'`click`, `send_keys` and `clear` wait until the element is displayed and enabled',
|
|
323
|
+
'`submit` is not checked', 'strict is off', 'force: true', 'Raider.actionability = false',
|
|
324
|
+
'NotActionable', 'XCUITest', 'RAIDER_TIMEOUT', 'RAIDER_STRICT', 'RAIDER_ACTIONABILITY')
|
|
325
|
+
expect(section[/^### Settings\n.*?(?=^### )/m]).to include('no `config/config.yml`') unless automation == 'cross_platform'
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
it 'documents the gestures and the assertions' do
|
|
329
|
+
section = section_of(readme)
|
|
330
|
+
gestures = section[/^### Gestures\n.*?(?=^### )/m].gsub(/\s+/, ' ')
|
|
331
|
+
expect(gestures).to include("swipe('left', element)", "scroll('down')", 'scroll_to({ accessibility_id: ')
|
|
332
|
+
expect(section[/^### Assertions\n.*?(?=^### )/m]).to include('have_text', 'expect { pdp_page.add_to_cart_button }')
|
|
333
|
+
end
|
|
334
|
+
|
|
260
335
|
it 'says the device capabilities sit under appium:options' do
|
|
261
336
|
settings = section_of(readme)[/^### Settings\n.*?(?=^### )/m]
|
|
262
337
|
expect(settings).to include('under `appium:options`')
|
|
@@ -264,26 +339,15 @@ describe 'Generated Readme: How the framework works' do
|
|
|
264
339
|
end
|
|
265
340
|
end
|
|
266
341
|
end
|
|
267
|
-
|
|
268
|
-
it "marks the #{framework} watir Readme as deprecated and not the selenium one" do
|
|
269
|
-
watir = read_generated("#{framework}_watir", 'Readme.md')
|
|
270
|
-
expect(watir).to include('> **Deprecated:** Watir is deprecated', 'only available through `-p automation:watir`',
|
|
271
|
-
'https://github.com/RaiderHQ/ruby_raider#migrating-from-watir')
|
|
272
|
-
expect(read_generated("#{framework}_selenium", 'Readme.md')).not_to include('**Deprecated:**')
|
|
273
|
-
end
|
|
274
|
-
|
|
275
|
-
it "has no such section for #{framework} and watir" do
|
|
276
|
-
expect(read_generated("#{framework}_watir", 'Readme.md')).not_to include('How the framework works')
|
|
277
|
-
end
|
|
278
342
|
end
|
|
279
343
|
|
|
280
344
|
describe 'without example tests' do
|
|
281
|
-
|
|
345
|
+
FRAMEWORKS.product(%w[selenium ios cross_platform]).each do |framework, automation|
|
|
282
346
|
context "with #{framework} and #{automation}" do
|
|
283
347
|
subject(:readme) { read_generated(ensure_project(framework:, automation:, examples: false), 'Readme.md') }
|
|
284
348
|
|
|
285
349
|
it 'still explains how the framework works' do
|
|
286
|
-
expect(readme).to include('## How the framework works', '###
|
|
350
|
+
expect(readme).to include('## How the framework works', '### Locators', '### Assertions')
|
|
287
351
|
end
|
|
288
352
|
|
|
289
353
|
it 'points at no example file' do
|
|
@@ -298,7 +362,7 @@ describe 'Generated Readme: How the framework works' do
|
|
|
298
362
|
end
|
|
299
363
|
end
|
|
300
364
|
|
|
301
|
-
|
|
365
|
+
FRAMEWORKS.each do |framework|
|
|
302
366
|
it "shows how to add the login hook for the project's own login page in #{framework}" do
|
|
303
367
|
readme = read_generated(ensure_project(framework:, automation: 'selenium', examples: false), 'Readme.md')
|
|
304
368
|
section = readme[/^## Reusing the login\n.*?(?=^## )/m]
|
|
@@ -18,8 +18,8 @@ describe 'RSpec projects without Allure' do
|
|
|
18
18
|
expect(File).not_to exist(File.join(project_name, 'allure-results'))
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
it 'pins raider_reporter 0
|
|
22
|
-
expect(read_generated(project_name, 'Gemfile')).to include("gem 'raider_reporter', '~> 0
|
|
21
|
+
it 'pins raider_reporter 1.0' do
|
|
22
|
+
expect(read_generated(project_name, 'Gemfile')).to include("gem 'raider_reporter', '~> 1.0'")
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -6,7 +6,7 @@ require 'stringio'
|
|
|
6
6
|
require 'tmpdir'
|
|
7
7
|
require_relative 'content_helper'
|
|
8
8
|
|
|
9
|
-
RUBOCOP_WEB_AUTOMATIONS = %w[selenium
|
|
9
|
+
RUBOCOP_WEB_AUTOMATIONS = %w[selenium].freeze
|
|
10
10
|
|
|
11
11
|
# Every generated project must pass the RuboCop it ships: its own .rubocop.yml, run in-process with
|
|
12
12
|
# this gem's bundle. The project is linted from a copy outside this repo, so RuboCop resolves the
|
|
@@ -38,8 +38,8 @@ describe 'Ruby syntax validation' do
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
SYNTAX_MOBILE_AUTOMATIONS.each do |automation|
|
|
41
|
-
it "#{framework}_#{automation}
|
|
42
|
-
content = File.read(File.join(ensure_project(framework:, automation:), 'helpers/
|
|
41
|
+
it "#{framework}_#{automation} gesture_helper has the mobile gestures and no web-only methods" do
|
|
42
|
+
content = File.read(File.join(ensure_project(framework:, automation:), 'helpers/gesture_helper.rb'))
|
|
43
43
|
expect(content).to include("'mobile: swipeGesture'").and include('def scroll_to(')
|
|
44
44
|
expect(content).not_to include('def drag_and_drop(')
|
|
45
45
|
end
|