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
data/lib/generators/generator.rb
CHANGED
|
@@ -13,7 +13,7 @@ class Generator < Thor::Group
|
|
|
13
13
|
|
|
14
14
|
def self.source_paths
|
|
15
15
|
base_path = File.dirname(__FILE__)
|
|
16
|
-
%W[#{base_path}/automation/templates
|
|
16
|
+
%W[#{base_path}/automation/templates
|
|
17
17
|
#{base_path}/rspec/templates
|
|
18
18
|
#{base_path}/templates #{base_path}/infrastructure/templates ]
|
|
19
19
|
end
|
|
@@ -22,10 +22,6 @@ class Generator < Thor::Group
|
|
|
22
22
|
initializer.first
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def cucumber?
|
|
26
|
-
framework == 'cucumber'
|
|
27
|
-
end
|
|
28
|
-
|
|
29
25
|
# The framework is cross platform when it supports Android and iOS
|
|
30
26
|
def cross_platform?
|
|
31
27
|
automation == 'cross_platform'
|
|
@@ -47,10 +43,6 @@ class Generator < Thor::Group
|
|
|
47
43
|
automation == 'android'
|
|
48
44
|
end
|
|
49
45
|
|
|
50
|
-
def rspec?
|
|
51
|
-
framework == 'rspec'
|
|
52
|
-
end
|
|
53
|
-
|
|
54
46
|
def azure?
|
|
55
47
|
options_after_name.include?('azure')
|
|
56
48
|
end
|
|
@@ -59,23 +51,24 @@ class Generator < Thor::Group
|
|
|
59
51
|
!azure?
|
|
60
52
|
end
|
|
61
53
|
|
|
62
|
-
# The automation arg only, so a project named "
|
|
54
|
+
# The automation arg only, so a project named "selenium" keeps its own automation
|
|
63
55
|
def selenium?
|
|
64
56
|
automation == 'selenium'
|
|
65
57
|
end
|
|
66
58
|
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
# Selenium web projects record a trace per test; mobile has none yet
|
|
60
|
+
def trace_helper?
|
|
61
|
+
!mobile?
|
|
69
62
|
end
|
|
70
63
|
|
|
71
|
-
#
|
|
72
|
-
def
|
|
73
|
-
|
|
64
|
+
# Network mocking needs the same Selenium web projects (WebDriver BiDi, no mobile)
|
|
65
|
+
def network_helper?
|
|
66
|
+
trace_helper?
|
|
74
67
|
end
|
|
75
68
|
|
|
76
|
-
#
|
|
77
|
-
def
|
|
78
|
-
|
|
69
|
+
# Screenshot comparison needs the same Selenium web projects
|
|
70
|
+
def screenshot_helper?
|
|
71
|
+
trace_helper?
|
|
79
72
|
end
|
|
80
73
|
|
|
81
74
|
# False for `raider new -p examples:false`: an empty skeleton without the example pages, tests and wiring
|
|
@@ -84,7 +77,7 @@ class Generator < Thor::Group
|
|
|
84
77
|
end
|
|
85
78
|
|
|
86
79
|
def web?
|
|
87
|
-
selenium?
|
|
80
|
+
selenium?
|
|
88
81
|
end
|
|
89
82
|
|
|
90
83
|
def axe_addon?
|
|
@@ -4,33 +4,24 @@ require_relative 'generator'
|
|
|
4
4
|
|
|
5
5
|
class HelpersGenerator < Generator
|
|
6
6
|
def generate_helpers
|
|
7
|
-
generate_browser_helper
|
|
8
7
|
generate_driver_helper
|
|
9
8
|
generate_appium_helper
|
|
9
|
+
generate_gesture_helper
|
|
10
10
|
generate_spec_helper
|
|
11
11
|
generate_video_helper
|
|
12
12
|
generate_session_state
|
|
13
|
-
generate_wait_helper
|
|
14
13
|
generate_trace_helper
|
|
14
|
+
generate_network_helper
|
|
15
|
+
generate_screenshot_helper
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
private
|
|
18
19
|
|
|
19
|
-
def generate_browser_helper
|
|
20
|
-
return if selenium_based? || mobile?
|
|
21
|
-
|
|
22
|
-
template('helpers/browser_helper.tt', "#{name}/helpers/browser_helper.rb")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
20
|
def generate_spec_helper
|
|
26
|
-
return if cucumber?
|
|
27
|
-
|
|
28
21
|
template('helpers/spec_helper.tt', "#{name}/helpers/spec_helper.rb")
|
|
29
22
|
end
|
|
30
23
|
|
|
31
24
|
def generate_driver_helper
|
|
32
|
-
return if watir?
|
|
33
|
-
|
|
34
25
|
template('helpers/driver_helper.tt', "#{name}/helpers/driver_helper.rb")
|
|
35
26
|
end
|
|
36
27
|
|
|
@@ -44,19 +35,30 @@ class HelpersGenerator < Generator
|
|
|
44
35
|
template('helpers/session_state.tt', "#{name}/helpers/session_state.rb")
|
|
45
36
|
end
|
|
46
37
|
|
|
47
|
-
def generate_wait_helper
|
|
48
|
-
return unless wait_helper?
|
|
49
|
-
|
|
50
|
-
template('helpers/wait_helper.tt', "#{name}/helpers/wait_helper.rb")
|
|
51
|
-
template('helpers/raider_element.tt', "#{name}/helpers/raider_element.rb")
|
|
52
|
-
end
|
|
53
|
-
|
|
54
38
|
def generate_trace_helper
|
|
55
39
|
return unless trace_helper?
|
|
56
40
|
|
|
57
41
|
template('helpers/trace_helper.tt', "#{name}/helpers/trace_helper.rb")
|
|
58
42
|
end
|
|
59
43
|
|
|
44
|
+
def generate_network_helper
|
|
45
|
+
return unless network_helper?
|
|
46
|
+
|
|
47
|
+
template('helpers/network_helper.tt', "#{name}/helpers/network_helper.rb")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def generate_screenshot_helper
|
|
51
|
+
return unless screenshot_helper?
|
|
52
|
+
|
|
53
|
+
template('helpers/screenshot_helper.tt', "#{name}/helpers/screenshot_helper.rb")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def generate_gesture_helper
|
|
57
|
+
return unless mobile?
|
|
58
|
+
|
|
59
|
+
template('helpers/gesture_helper.tt', "#{name}/helpers/gesture_helper.rb")
|
|
60
|
+
end
|
|
61
|
+
|
|
60
62
|
def generate_appium_helper
|
|
61
63
|
return unless cross_platform?
|
|
62
64
|
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
- script: bundle exec raider u video install
|
|
33
33
|
displayName: Install ffmpeg for failure videos
|
|
34
34
|
continueOnError: true
|
|
35
|
-
- script:
|
|
35
|
+
- script: bundle exec raider-reporter exec -- bundle exec rspec spec/ --format documentation
|
|
36
36
|
displayName: Run tests
|
|
37
37
|
env:
|
|
38
38
|
RAIDER_TOKEN: $(RAIDER_TOKEN)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
name:
|
|
2
|
-
|
|
1
|
+
name: Rspec Tests
|
|
3
2
|
on:
|
|
4
3
|
push:
|
|
5
4
|
branches: [ main, master ]
|
|
@@ -45,7 +44,7 @@ jobs:
|
|
|
45
44
|
continue-on-error: true
|
|
46
45
|
|
|
47
46
|
- name: Run tests
|
|
48
|
-
run:
|
|
47
|
+
run: bundle exec raider-reporter exec -- bundle exec rspec spec --format documentation
|
|
49
48
|
# RAIDER_ENDPOINT: your Raider Hideout URL (repository variable); RAIDER_TOKEN: a project token (secret).
|
|
50
49
|
env:
|
|
51
50
|
HEADLESS: true
|
|
@@ -56,11 +56,7 @@ jobs:
|
|
|
56
56
|
continue-on-error: true
|
|
57
57
|
|
|
58
58
|
- name: Run tests
|
|
59
|
-
<%- if cucumber? -%>
|
|
60
|
-
run: bundle exec raider-reporter exec -- bundle exec cucumber features/ --format pretty
|
|
61
|
-
<%- else -%>
|
|
62
59
|
run: bundle exec raider-reporter exec -- bundle exec rspec spec/ --format documentation
|
|
63
|
-
<%- end -%>
|
|
64
60
|
# RAIDER_ENDPOINT: your Raider Hideout URL (repository variable); RAIDER_TOKEN: a project token (secret).
|
|
65
61
|
env:
|
|
66
62
|
APP_PATH: ${{ github.workspace }}/apps/RaiderTestApp.app
|
|
@@ -132,11 +128,7 @@ jobs:
|
|
|
132
128
|
arch: x86_64
|
|
133
129
|
profile: pixel_8
|
|
134
130
|
script: |
|
|
135
|
-
<%- if cucumber? -%>
|
|
136
|
-
bundle exec raider-reporter exec -- bundle exec cucumber features/ --format pretty
|
|
137
|
-
<%- else -%>
|
|
138
131
|
bundle exec raider-reporter exec -- bundle exec rspec spec/ --format documentation
|
|
139
|
-
<%- end -%>
|
|
140
132
|
env:
|
|
141
133
|
APP_PATH: ${{ github.workspace }}/apps/app-release.apk
|
|
142
134
|
RAIDER_TOKEN: ${{ secrets.RAIDER_TOKEN }}
|
|
@@ -3,16 +3,12 @@ require_relative 'infrastructure/github_generator'
|
|
|
3
3
|
require_relative 'infrastructure/azure_generator'
|
|
4
4
|
require_relative 'automation/automation_generator'
|
|
5
5
|
require_relative 'common_generator'
|
|
6
|
-
require_relative 'cucumber/cucumber_generator'
|
|
7
6
|
require_relative 'helper_generator'
|
|
8
7
|
require_relative 'rspec/rspec_generator'
|
|
9
8
|
|
|
10
9
|
module InvokeGenerators
|
|
11
|
-
FRAMEWORKS = %w[rspec
|
|
12
|
-
AUTOMATIONS = %w[selenium
|
|
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
|
|
10
|
+
FRAMEWORKS = %w[rspec].freeze
|
|
11
|
+
AUTOMATIONS = %w[selenium ios android cross_platform].freeze
|
|
16
12
|
|
|
17
13
|
module_function
|
|
18
14
|
|
|
@@ -36,13 +32,11 @@ module InvokeGenerators
|
|
|
36
32
|
})
|
|
37
33
|
end
|
|
38
34
|
print_mobile_azure_notice(structure)
|
|
39
|
-
print_watir_notice(structure)
|
|
40
|
-
print_watir_examples_notice(structure)
|
|
41
35
|
end
|
|
42
36
|
|
|
43
37
|
def normalise_options(structure)
|
|
44
38
|
structure.merge(
|
|
45
|
-
framework: structure[:framework].to_s.downcase,
|
|
39
|
+
framework: structure[:framework].to_s.downcase.then { |f| f.empty? ? 'rspec' : f },
|
|
46
40
|
automation: structure[:automation].to_s.downcase
|
|
47
41
|
)
|
|
48
42
|
end
|
|
@@ -65,12 +59,6 @@ module InvokeGenerators
|
|
|
65
59
|
puts 'Azure Pipelines template for mobile projects is not available yet; see the README.'
|
|
66
60
|
end
|
|
67
61
|
|
|
68
|
-
def print_watir_notice(structure)
|
|
69
|
-
return unless structure[:automation] == 'watir'
|
|
70
|
-
|
|
71
|
-
puts WATIR_NOTICE
|
|
72
|
-
end
|
|
73
|
-
|
|
74
62
|
def add_generator(generators, *gens)
|
|
75
63
|
gens.each { |generator| generators.push generator }
|
|
76
64
|
end
|
|
@@ -96,15 +84,8 @@ module InvokeGenerators
|
|
|
96
84
|
flags
|
|
97
85
|
end
|
|
98
86
|
|
|
99
|
-
# Watir templates are frozen, so a Watir project always gets the example tests
|
|
100
87
|
def skeleton?(structure)
|
|
101
|
-
structure[:examples] == false
|
|
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.'
|
|
88
|
+
structure[:examples] == false
|
|
108
89
|
end
|
|
109
90
|
|
|
110
91
|
def mobile_automation?(automation)
|
|
@@ -22,7 +22,7 @@ class MenuGenerator
|
|
|
22
22
|
def choose_test_framework(automation)
|
|
23
23
|
return choose_mobile_platform if automation == 'appium'
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
select_examples('Rspec', automation)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def set_up_framework(options)
|
|
@@ -69,14 +69,6 @@ class MenuGenerator
|
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
def select_test_framework(automation)
|
|
73
|
-
prompt.select('Please select your test framework') do |menu|
|
|
74
|
-
menu.choice :Cucumber, -> { select_examples('Cucumber', automation) }
|
|
75
|
-
menu.choice :Rspec, -> { select_examples('Rspec', automation) }
|
|
76
|
-
menu.choice :Quit, -> { exit }
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
72
|
def select_examples(framework, automation_type)
|
|
81
73
|
prompt.select('Do you want example tests?') do |menu|
|
|
82
74
|
menu.choice :Yes, -> { select_accessibility(framework, automation_type, examples: true) }
|
|
@@ -4,18 +4,10 @@ require_relative '../helpers/spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe 'Accessibility' do
|
|
6
6
|
before do
|
|
7
|
-
<%- if watir? -%>
|
|
8
|
-
browser.goto 'https://raider-test-site.onrender.com/'
|
|
9
|
-
<%- else -%>
|
|
10
7
|
driver.get 'https://raider-test-site.onrender.com/'
|
|
11
|
-
<%- end -%>
|
|
12
8
|
end
|
|
13
9
|
|
|
14
10
|
it 'has no accessibility violations on the page' do
|
|
15
|
-
|
|
16
|
-
expect(browser.driver).to be_axe_clean
|
|
17
|
-
<%- else -%>
|
|
18
|
-
expect(driver).to be_axe_clean
|
|
19
|
-
<%- end -%>
|
|
11
|
+
Raider::Wait.immediately { expect(driver).to be_axe_clean }
|
|
20
12
|
end
|
|
21
13
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%- if selenium_based?
|
|
1
|
+
<%- if selenium_based? -%>
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative '../helpers/spec_helper'
|
|
@@ -8,13 +8,9 @@ require_relative '../page_objects/pages/login'
|
|
|
8
8
|
|
|
9
9
|
# rubocop:disable RSpec/MultipleDescribes
|
|
10
10
|
describe 'Login' do
|
|
11
|
-
<%- if watir? -%>
|
|
12
|
-
subject(:header) { account_page.header.customer_name }
|
|
13
|
-
|
|
14
|
-
<%- end -%>
|
|
15
11
|
let(:user) { ModelFactory.for('users')['registered user'] }
|
|
16
|
-
let(:login_page) {
|
|
17
|
-
let(:account_page) {
|
|
12
|
+
let(:login_page) { Login.new(driver) }
|
|
13
|
+
let(:account_page) { Account.new(driver) }
|
|
18
14
|
|
|
19
15
|
before do
|
|
20
16
|
login_page.visit
|
|
@@ -26,11 +22,7 @@ describe 'Login' do
|
|
|
26
22
|
|
|
27
23
|
it 'can successfully log in' do
|
|
28
24
|
account_page.visit
|
|
29
|
-
|
|
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 -%>
|
|
25
|
+
expect { account_page.welcome_message }.to have_text("Welcome back #{user['name']}")
|
|
34
26
|
end
|
|
35
27
|
end
|
|
36
28
|
|
|
@@ -39,26 +31,18 @@ describe 'Login' do
|
|
|
39
31
|
|
|
40
32
|
it 'cannot log in' do
|
|
41
33
|
login_page.visit
|
|
42
|
-
|
|
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 -%>
|
|
34
|
+
expect { login_page.welcome_message }.to have_text('Login or register')
|
|
47
35
|
end
|
|
48
36
|
end
|
|
49
37
|
end
|
|
50
38
|
|
|
51
39
|
describe 'Account', :logged_in do
|
|
52
40
|
let(:user) { ModelFactory.for('users')['registered user'] }
|
|
53
|
-
let(:account_page) {
|
|
41
|
+
let(:account_page) { Account.new(driver) }
|
|
54
42
|
|
|
55
43
|
it 'opens the account page with the saved login' do
|
|
56
44
|
account_page.visit
|
|
57
|
-
|
|
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 -%>
|
|
45
|
+
expect { account_page.welcome_message }.to have_text("Welcome back #{user['name']}")
|
|
62
46
|
end
|
|
63
47
|
end
|
|
64
48
|
# rubocop:enable RSpec/MultipleDescribes
|
|
@@ -79,7 +63,7 @@ class PdpSpec
|
|
|
79
63
|
|
|
80
64
|
it 'shows add to cart button' do
|
|
81
65
|
home_page.go_to_product_detail
|
|
82
|
-
|
|
66
|
+
expect { pdp_page.add_to_cart_button }.to have_text('Add to Cart')
|
|
83
67
|
end
|
|
84
68
|
end
|
|
85
69
|
end
|
|
@@ -113,7 +113,9 @@ module TemplateRenderer
|
|
|
113
113
|
|
|
114
114
|
# Compile an ERB template
|
|
115
115
|
def compile_template(path, trim_mode)
|
|
116
|
-
|
|
116
|
+
# Templates are UTF-8 whatever the locale: a plain File.read follows Encoding.default_external, and a
|
|
117
|
+
# US-ASCII locale (no LANG, as macOS gives GUI apps) then made ERB fail on any non-ASCII byte.
|
|
118
|
+
content = File.read(path, encoding: 'UTF-8')
|
|
117
119
|
ERB.new(content, trim_mode:)
|
|
118
120
|
end
|
|
119
121
|
|
|
@@ -19,7 +19,7 @@ require_relative 'template_renderer/template_error'
|
|
|
19
19
|
# <%= partial('driver_config', trim_mode: '<>') %> # Custom trim_mode
|
|
20
20
|
#
|
|
21
21
|
# The partial() method automatically has access to all generator instance
|
|
22
|
-
# variables and methods (
|
|
22
|
+
# variables and methods (mobile?, selenium?, etc.) through binding.
|
|
23
23
|
module TemplateRenderer
|
|
24
24
|
# Render a partial template with caching and smart path resolution
|
|
25
25
|
#
|
|
@@ -9,26 +9,19 @@ gem 'appium_lib'
|
|
|
9
9
|
gem 'axe-core-rspec'
|
|
10
10
|
gem 'axe-core-selenium'
|
|
11
11
|
<%- end -%>
|
|
12
|
-
<%- if
|
|
13
|
-
gem '
|
|
12
|
+
<%- if screenshot_helper? -%>
|
|
13
|
+
gem 'chunky_png'
|
|
14
14
|
<%- end -%>
|
|
15
15
|
gem 'parallel_split_test'
|
|
16
16
|
gem 'parallel_tests'
|
|
17
|
-
gem 'raider_reporter', '~> 0
|
|
17
|
+
gem 'raider_reporter', '~> 1.0'
|
|
18
18
|
gem 'rake'
|
|
19
19
|
gem 'reek'
|
|
20
20
|
gem 'rspec'
|
|
21
|
-
<%- if rspec? -%>
|
|
22
21
|
gem 'rspec-retry'
|
|
23
|
-
<%- end -%>
|
|
24
22
|
gem 'rubocop'
|
|
25
|
-
<%- if rspec? -%>
|
|
26
23
|
gem 'rubocop-rspec'
|
|
27
|
-
<%- end -%>
|
|
28
24
|
gem 'ruby_raider', '<%= ruby_raider_version_requirement %>'
|
|
29
25
|
<%- if selenium_based? -%>
|
|
30
26
|
gem 'selenium-webdriver'
|
|
31
27
|
<%- end -%>
|
|
32
|
-
<%- if watir? -%>
|
|
33
|
-
gem 'watir'
|
|
34
|
-
<%- end -%>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
platform: :ios
|
|
2
|
-
timeout: 10 # seconds that actions and
|
|
2
|
+
timeout: 10 # seconds that finds, actions and assertions wait before failing
|
|
3
|
+
strict: true # find_element fails when a locator matches more than one element; find_elements never does
|
|
4
|
+
actionability: true # actions wait until the element is ready (visible, enabled, stable, receives events; on native apps visible and enabled); force: true skips it
|
|
3
5
|
|
|
4
6
|
video:
|
|
5
7
|
enabled: true
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
browser: chrome
|
|
2
2
|
url: 'https://raider-test-site.onrender.com/'
|
|
3
|
-
timeout: 10 #
|
|
3
|
+
timeout: 10 # seconds that finds, actions and assertions wait before failing
|
|
4
|
+
strict: true # find_element fails when a locator matches more than one element; find_elements never does
|
|
5
|
+
actionability: true # actions wait until the element is ready (visible, enabled, stable, receives events; on native apps visible and enabled); force: true skips it
|
|
4
6
|
viewport:
|
|
5
7
|
width: 1920
|
|
6
8
|
height: 1080
|
|
@@ -26,6 +28,13 @@ trace:
|
|
|
26
28
|
max_steps: 200 # newest steps are kept; older ones lose screenshots and snapshots first
|
|
27
29
|
max_mb: 20 # the zip stays under this; see Cost
|
|
28
30
|
<%- end -%>
|
|
31
|
+
<%- if screenshot_helper? -%>
|
|
32
|
+
|
|
33
|
+
screenshots:
|
|
34
|
+
threshold: 0.2 # per-pixel colour difference allowed, 0 (exact) to 1
|
|
35
|
+
max_diff_pixels: 0 # pixels allowed to differ
|
|
36
|
+
# max_diff_ratio: 0.001 # or a share of all pixels
|
|
37
|
+
<%- end -%>
|
|
29
38
|
|
|
30
39
|
login_state:
|
|
31
40
|
max_age: 3600 # seconds a saved login is reused before logging in again
|
|
@@ -2,7 +2,6 @@ desc 'Print Ruby Raider version'
|
|
|
2
2
|
task :raider do
|
|
3
3
|
system 'raider version'
|
|
4
4
|
end
|
|
5
|
-
<%- if rspec? -%>
|
|
6
5
|
|
|
7
6
|
require 'rspec/core/rake_task'
|
|
8
7
|
|
|
@@ -15,17 +14,3 @@ RSpec::Core::RakeTask.new(:regression) do |t|
|
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
task default: :spec
|
|
18
|
-
<%- elsif cucumber? -%>
|
|
19
|
-
|
|
20
|
-
require 'cucumber/rake/task'
|
|
21
|
-
|
|
22
|
-
Cucumber::Rake::Task.new(:features)
|
|
23
|
-
Cucumber::Rake::Task.new(:smoke) do |t|
|
|
24
|
-
t.cucumber_opts = '--tags @smoke'
|
|
25
|
-
end
|
|
26
|
-
Cucumber::Rake::Task.new(:regression) do |t|
|
|
27
|
-
t.cucumber_opts = '--tags @regression'
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
task default: :features
|
|
31
|
-
<%- end -%>
|