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.
Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ffmpeg/build.sh +208 -0
  3. data/.github/ffmpeg/check.sh +72 -0
  4. data/.github/ffmpeg/frames.rb +34 -0
  5. data/.github/ffmpeg/probe.sh +17 -0
  6. data/.github/workflows/ffmpeg.yml +160 -0
  7. data/.github/workflows/runtime.yml +38 -0
  8. data/.github/workflows/system_tests.yml +1 -23
  9. data/.reek.yml +1 -0
  10. data/.rspec +1 -0
  11. data/Gemfile +2 -0
  12. data/README.md +172 -70
  13. data/RELEASE.md +29 -0
  14. data/bin/raider +5 -0
  15. data/lib/commands/scaffolding_commands.rb +2 -25
  16. data/lib/commands/utility_commands.rb +23 -3
  17. data/lib/generators/automation/automation_generator.rb +0 -5
  18. data/lib/generators/automation/templates/component.tt +1 -0
  19. data/lib/generators/automation/templates/home.tt +2 -2
  20. data/lib/generators/automation/templates/login.tt +6 -26
  21. data/lib/generators/automation/templates/page.tt +23 -18
  22. data/lib/generators/automation/templates/partials/home_page_selector.tt +1 -2
  23. data/lib/generators/automation/templates/partials/initialize_selector.tt +0 -8
  24. data/lib/generators/automation/templates/partials/pdp_page_selector.tt +1 -2
  25. data/lib/generators/automation/templates/partials/url_methods.tt +8 -2
  26. data/lib/generators/automation/templates/partials/visit_method.tt +0 -5
  27. data/lib/generators/automation/templates/pdp.tt +1 -9
  28. data/lib/generators/common_generator.rb +0 -2
  29. data/lib/generators/generator.rb +12 -19
  30. data/lib/generators/helper_generator.rb +21 -19
  31. data/lib/generators/infrastructure/templates/azure_pipelines.tt +1 -1
  32. data/lib/generators/infrastructure/templates/github.tt +2 -3
  33. data/lib/generators/infrastructure/templates/github_appium.tt +0 -8
  34. data/lib/generators/invoke_generators.rb +4 -23
  35. data/lib/generators/menu_generator.rb +1 -9
  36. data/lib/generators/rspec/templates/accessibility_spec.tt +1 -9
  37. data/lib/generators/rspec/templates/spec.tt +8 -24
  38. data/lib/generators/template_renderer/partial_cache.rb +3 -1
  39. data/lib/generators/template_renderer.rb +1 -1
  40. data/lib/generators/templates/common/gemfile.tt +3 -10
  41. data/lib/generators/templates/common/git_ignore.tt +0 -5
  42. data/lib/generators/templates/common/partials/mobile_config.tt +3 -1
  43. data/lib/generators/templates/common/partials/web_config.tt +10 -1
  44. data/lib/generators/templates/common/rakefile.tt +0 -15
  45. data/lib/generators/templates/common/read_me.tt +363 -257
  46. data/lib/generators/templates/common/rubocop.tt +0 -2
  47. data/lib/generators/templates/helpers/driver_helper.tt +8 -0
  48. data/lib/generators/templates/helpers/gesture_helper.tt +78 -0
  49. data/lib/generators/templates/helpers/network_helper.tt +521 -0
  50. data/lib/generators/templates/helpers/partials/quit_driver.tt +0 -2
  51. data/lib/generators/templates/helpers/partials/screenshot.tt +0 -2
  52. data/lib/generators/templates/helpers/partials/selenium_driver.tt +5 -2
  53. data/lib/generators/templates/helpers/screenshot_helper.tt +490 -0
  54. data/lib/generators/templates/helpers/spec_helper.tt +39 -29
  55. data/lib/generators/templates/helpers/trace_helper.tt +240 -95
  56. data/lib/generators/templates/helpers/video_helper.tt +4 -10
  57. data/lib/ruby_raider/ffmpeg.rb +38 -11
  58. data/lib/ruby_raider/runtime/actionability.rb +129 -0
  59. data/lib/ruby_raider/runtime/actionable.rb +49 -0
  60. data/lib/ruby_raider/runtime/by_role.rb +55 -0
  61. data/lib/ruby_raider/runtime/config.rb +79 -0
  62. data/lib/ruby_raider/runtime/context.rb +38 -0
  63. data/lib/ruby_raider/runtime/errors.rb +69 -0
  64. data/lib/ruby_raider/runtime/finders.rb +73 -0
  65. data/lib/ruby_raider/runtime/js/actionability.js +134 -0
  66. data/lib/ruby_raider/runtime/js/role_engine.js +315 -0
  67. data/lib/ruby_raider/runtime/locator_converter.rb +72 -0
  68. data/lib/ruby_raider/runtime/matchers/base.rb +222 -0
  69. data/lib/ruby_raider/runtime/matchers/element.rb +183 -0
  70. data/lib/ruby_raider/runtime/matchers/page.rb +71 -0
  71. data/lib/ruby_raider/runtime/matchers/presence.rb +41 -0
  72. data/lib/ruby_raider/runtime/matchers/retrying_block.rb +104 -0
  73. data/lib/ruby_raider/runtime/observer.rb +170 -0
  74. data/lib/ruby_raider/runtime/role_finder.rb +83 -0
  75. data/lib/ruby_raider/runtime/rspec.rb +78 -0
  76. data/lib/ruby_raider/runtime/selectors.rb +60 -0
  77. data/lib/ruby_raider/runtime/strict.rb +142 -0
  78. data/lib/ruby_raider/runtime/wait.rb +84 -0
  79. data/lib/ruby_raider/runtime.rb +20 -0
  80. data/lib/scaffolding/name_normalizer.rb +1 -1
  81. data/lib/scaffolding/project_detector.rb +2 -28
  82. data/lib/scaffolding/scaffolding.rb +0 -20
  83. data/lib/scaffolding/templates/component.tt +0 -14
  84. data/lib/scaffolding/templates/page_object.tt +2 -14
  85. data/lib/scaffolding/templates/spec.tt +1 -9
  86. data/lib/utilities/utilities.rb +10 -8
  87. data/lib/version +1 -1
  88. data/ruby_raider.gemspec +2 -1
  89. data/sig/commands/scaffolding_commands.rbs +0 -2
  90. data/sig/commands/utility_commands.rbs +6 -0
  91. data/sig/generators/generator.rbs +0 -4
  92. data/sig/generators/helper_generator.rbs +0 -1
  93. data/sig/generators/menu_generator.rbs +0 -1
  94. data/sig/ruby_raider/ffmpeg.rbs +1 -0
  95. data/sig/ruby_raider/runtime/actionability.rbs +25 -0
  96. data/sig/ruby_raider/runtime/actionable.rbs +13 -0
  97. data/sig/ruby_raider/runtime/by_role.rbs +15 -0
  98. data/sig/ruby_raider/runtime/config.rbs +26 -0
  99. data/sig/ruby_raider/runtime/context.rbs +12 -0
  100. data/sig/ruby_raider/runtime/errors.rbs +36 -0
  101. data/sig/ruby_raider/runtime/finders.rbs +26 -0
  102. data/sig/ruby_raider/runtime/locator_converter.rbs +21 -0
  103. data/sig/ruby_raider/runtime/matchers/base.rbs +64 -0
  104. data/sig/ruby_raider/runtime/matchers/element.rbs +78 -0
  105. data/sig/ruby_raider/runtime/matchers/page.rbs +38 -0
  106. data/sig/ruby_raider/runtime/matchers/presence.rbs +21 -0
  107. data/sig/ruby_raider/runtime/matchers/retrying_block.rbs +27 -0
  108. data/sig/ruby_raider/runtime/observer.rbs +46 -0
  109. data/sig/ruby_raider/runtime/role_finder.rbs +18 -0
  110. data/sig/ruby_raider/runtime/selectors.rbs +21 -0
  111. data/sig/ruby_raider/runtime/strict.rbs +35 -0
  112. data/sig/ruby_raider/runtime/wait.rbs +17 -0
  113. data/sig/ruby_raider/runtime.rbs +2 -0
  114. data/sig/scaffolding/project_detector.rbs +0 -4
  115. data/sig/scaffolding/scaffolding.rbs +0 -5
  116. data/sig/utilities/utilities.rbs +2 -1
  117. data/sig/vendor/selenium_webdriver.rbs +71 -0
  118. data/spec/commands/raider_commands_spec.rb +38 -3
  119. data/spec/commands/scaffolding_commands_spec.rb +27 -0
  120. data/spec/commands/utility_commands_spec.rb +53 -0
  121. data/spec/generators/gesture_helper_spec.rb +123 -0
  122. data/spec/generators/network_helper_spec.rb +634 -0
  123. data/spec/generators/screenshot_helper_spec.rb +776 -0
  124. data/spec/generators/template_renderer_spec.rb +0 -4
  125. data/spec/generators/trace_helper_spec.rb +489 -97
  126. data/spec/generators/video_helper_spec.rb +21 -13
  127. data/spec/integration/commands/browser_update_after_creation_spec.rb +0 -8
  128. data/spec/integration/commands/scaffolding_commands_spec.rb +12 -70
  129. data/spec/integration/commands/utility_commands_spec.rb +19 -41
  130. data/spec/integration/content/azure_content_spec.rb +2 -6
  131. data/spec/integration/content/ci_content_spec.rb +1 -55
  132. data/spec/integration/content/common_content_spec.rb +1 -118
  133. data/spec/integration/content/config_content_spec.rb +34 -31
  134. data/spec/integration/content/gemfile_content_spec.rb +7 -72
  135. data/spec/integration/content/helper_content_spec.rb +105 -99
  136. data/spec/integration/content/page_content_spec.rb +85 -87
  137. data/spec/integration/content/readme_content_spec.rb +141 -77
  138. data/spec/integration/content/rspec_reporter_content_spec.rb +2 -2
  139. data/spec/integration/content/rubocop_content_spec.rb +1 -1
  140. data/spec/integration/content/syntax_validation_spec.rb +2 -2
  141. data/spec/integration/content/test_content_spec.rb +23 -147
  142. data/spec/integration/end_to_end_features_spec.rb +1 -43
  143. data/spec/integration/end_to_end_spec.rb +334 -329
  144. data/spec/integration/generators/automation_generator_spec.rb +3 -37
  145. data/spec/integration/generators/axe_addon_spec.rb +2 -35
  146. data/spec/integration/generators/azure_generator_spec.rb +1 -1
  147. data/spec/integration/generators/common_generator_spec.rb +1 -40
  148. data/spec/integration/generators/config_features_spec.rb +1 -24
  149. data/spec/integration/generators/github_generator_spec.rb +0 -12
  150. data/spec/integration/generators/helpers_generator_spec.rb +74 -80
  151. data/spec/integration/generators/invoke_generators_spec.rb +54 -45
  152. data/spec/integration/generators/rspec_generator_spec.rb +0 -6
  153. data/spec/integration/scaffolding_e2e_spec.rb +17 -179
  154. data/spec/integration/spec_helper.rb +4 -6
  155. data/spec/integration/trace_format_checker.rb +11 -2
  156. data/spec/integration/trace_page_server.rb +72 -5
  157. data/spec/menus/menu_generator_spec.rb +14 -39
  158. data/spec/runtime/actionability_spec.rb +207 -0
  159. data/spec/runtime/actionable_spec.rb +125 -0
  160. data/spec/runtime/browser/actionability_script_browser_spec.rb +150 -0
  161. data/spec/runtime/browser/actionable_browser_spec.rb +98 -0
  162. data/spec/runtime/browser/finders_browser_spec.rb +148 -0
  163. data/spec/runtime/browser/matchers_browser_spec.rb +67 -0
  164. data/spec/runtime/browser/retrying_block_browser_spec.rb +37 -0
  165. data/spec/runtime/browser/role_engine_browser_spec.rb +184 -0
  166. data/spec/runtime/browser/strict_browser_spec.rb +38 -0
  167. data/spec/runtime/by_role_spec.rb +52 -0
  168. data/spec/runtime/config_spec.rb +79 -0
  169. data/spec/runtime/context_spec.rb +73 -0
  170. data/spec/runtime/errors_spec.rb +89 -0
  171. data/spec/runtime/finders_spec.rb +165 -0
  172. data/spec/runtime/fixtures/actionability.html +70 -0
  173. data/spec/runtime/fixtures/locators.html +46 -0
  174. data/spec/runtime/fixtures/matchers.html +33 -0
  175. data/spec/runtime/fixtures/roles.html +162 -0
  176. data/spec/runtime/matchers/base_spec.rb +165 -0
  177. data/spec/runtime/matchers/element_spec.rb +277 -0
  178. data/spec/runtime/matchers/page_spec.rb +102 -0
  179. data/spec/runtime/matchers/presence_spec.rb +59 -0
  180. data/spec/runtime/matchers/retrying_block_spec.rb +165 -0
  181. data/spec/runtime/observer_spec.rb +341 -0
  182. data/spec/runtime/role_finder_spec.rb +156 -0
  183. data/spec/runtime/role_query_spec.rb +75 -0
  184. data/spec/runtime/selectors_spec.rb +135 -0
  185. data/spec/runtime/strict_spec.rb +257 -0
  186. data/spec/runtime/support/browser.rb +48 -0
  187. data/spec/runtime/support/fake_bridge.rb +117 -0
  188. data/spec/runtime/wait_spec.rb +71 -0
  189. data/spec/scaffolding/name_normalizer_spec.rb +3 -2
  190. data/spec/scaffolding/scaffold_project_detector_spec.rb +4 -43
  191. data/spec/system/selenium_spec.rb +1 -5
  192. data/spec/system/support/system_test_helper.rb +2 -5
  193. data/spec/utilities/ffmpeg_spec.rb +80 -7
  194. data/spec/utilities/headless_config_spec.rb +0 -7
  195. data/spec/utilities/utilities_spec.rb +24 -0
  196. data/spec/utilities/video_command_spec.rb +13 -0
  197. metadata +118 -53
  198. data/docs/superpowers/plans/2026-10-25-failure-video-replay.md +0 -400
  199. data/docs/superpowers/plans/2026-10-26-parity-cleanup.md +0 -233
  200. data/docs/superpowers/plans/2026-10-28-failure-card.md +0 -295
  201. data/docs/superpowers/specs/2026-10-25-failure-video-replay-design.md +0 -214
  202. data/docs/superpowers/specs/2026-10-28-failure-card-design.md +0 -210
  203. data/lib/generators/automation/templates/header.tt +0 -9
  204. data/lib/generators/cucumber/cucumber_generator.rb +0 -58
  205. data/lib/generators/cucumber/templates/accessibility_feature.tt +0 -5
  206. data/lib/generators/cucumber/templates/accessibility_steps.tt +0 -17
  207. data/lib/generators/cucumber/templates/cucumber.tt +0 -1
  208. data/lib/generators/cucumber/templates/env.tt +0 -7
  209. data/lib/generators/cucumber/templates/feature.tt +0 -21
  210. data/lib/generators/cucumber/templates/partials/appium_env.tt +0 -26
  211. data/lib/generators/cucumber/templates/partials/driver_world.tt +0 -18
  212. data/lib/generators/cucumber/templates/partials/mobile_steps.tt +0 -20
  213. data/lib/generators/cucumber/templates/partials/selenium_env.tt +0 -120
  214. data/lib/generators/cucumber/templates/partials/watir_env.tt +0 -48
  215. data/lib/generators/cucumber/templates/partials/watir_world.tt +0 -4
  216. data/lib/generators/cucumber/templates/partials/web_steps.tt +0 -28
  217. data/lib/generators/cucumber/templates/steps.tt +0 -5
  218. data/lib/generators/cucumber/templates/user_factory.tt +0 -15
  219. data/lib/generators/cucumber/templates/world.tt +0 -7
  220. data/lib/generators/templates/helpers/browser_helper.tt +0 -31
  221. data/lib/generators/templates/helpers/raider_element.tt +0 -159
  222. data/lib/generators/templates/helpers/wait_helper.tt +0 -611
  223. data/lib/scaffolding/templates/feature.tt +0 -6
  224. data/lib/scaffolding/templates/steps.tt +0 -19
  225. data/sig/generators/cucumber/cucumber_generator.rbs +0 -12
  226. data/spec/fixtures/watir_master/cucumber_watir/Readme.md.snapshot +0 -175
  227. data/spec/fixtures/watir_master/cucumber_watir/features/step_definitions/login_steps.rb.snapshot +0 -24
  228. data/spec/fixtures/watir_master/cucumber_watir/page_objects/abstract/page.rb.snapshot +0 -37
  229. data/spec/fixtures/watir_master/cucumber_watir/page_objects/pages/login.rb.snapshot +0 -33
  230. data/spec/fixtures/watir_master/rspec_watir/Readme.md.snapshot +0 -174
  231. data/spec/fixtures/watir_master/rspec_watir/page_objects/abstract/page.rb.snapshot +0 -37
  232. data/spec/fixtures/watir_master/rspec_watir/page_objects/pages/login.rb.snapshot +0 -33
  233. data/spec/fixtures/watir_master/rspec_watir/spec/login_page_spec.rb.snapshot +0 -49
  234. data/spec/integration/content/cucumber_reporter_content_spec.rb +0 -161
  235. data/spec/integration/generators/cucumber_generator_spec.rb +0 -100
  236. data/spec/integration/helpers/wait_helper_mobile_spec.rb +0 -281
  237. data/spec/integration/helpers/wait_helper_spec.rb +0 -679
  238. data/spec/integration/helpers/wait_helper_support.rb +0 -183
  239. data/spec/system/watir_spec.rb +0 -38
@@ -4,21 +4,13 @@ require 'yaml'
4
4
 
5
5
  module ScaffoldProjectDetector
6
6
  AUTOMATION_GEMS = {
7
- 'watir' => 'watir',
8
7
  'selenium-webdriver' => 'selenium',
9
8
  'appium_lib' => 'appium',
10
9
  'eyes_selenium' => 'selenium',
11
- 'axe-core-rspec' => 'selenium',
12
- 'axe-core-cucumber' => 'selenium'
13
- }.freeze
14
-
15
- FRAMEWORK_GEMS = {
16
- 'rspec' => 'rspec',
17
- 'cucumber' => 'cucumber'
10
+ 'axe-core-rspec' => 'selenium'
18
11
  }.freeze
19
12
 
20
13
  CONFIG_PATH = 'config/config.yml'
21
- WAIT_HELPER_PATH = 'helpers/wait_helper.rb'
22
14
 
23
15
  class Error < StandardError; end
24
16
 
@@ -28,9 +20,7 @@ module ScaffoldProjectDetector
28
20
  gemfile = read_gemfile
29
21
  {
30
22
  automation: detect_automation(gemfile),
31
- framework: detect_framework(gemfile),
32
- has_spec: Dir.exist?('spec'),
33
- has_features: Dir.exist?('features')
23
+ has_spec: Dir.exist?('spec')
34
24
  }
35
25
  end
36
26
 
@@ -41,13 +31,6 @@ module ScaffoldProjectDetector
41
31
  'selenium'
42
32
  end
43
33
 
44
- def detect_framework(gemfile = read_gemfile)
45
- FRAMEWORK_GEMS.each do |gem_name, framework|
46
- return framework if gemfile.include?("'#{gem_name}'") || gemfile.include?("\"#{gem_name}\"")
47
- end
48
- 'rspec'
49
- end
50
-
51
34
  def read_gemfile
52
35
  return '' unless File.exist?('Gemfile')
53
36
 
@@ -58,15 +41,6 @@ module ScaffoldProjectDetector
58
41
  detect_automation == 'selenium'
59
42
  end
60
43
 
61
- def watir?
62
- detect_automation == 'watir'
63
- end
64
-
65
- # Projects made before WaitHelper, or whose owner removed it, do not have the file.
66
- def wait_helper?
67
- File.exist?(WAIT_HELPER_PATH)
68
- end
69
-
70
44
  # Validates that the current directory looks like a Ruby Raider project.
71
45
  # Returns an array of warning messages (empty = valid project).
72
46
  def validate_project
@@ -21,10 +21,6 @@ class Scaffolding < Thor::Group
21
21
  template('page_object.tt', default_path("page_objects/pages/#{normalized_name}.rb", '_page.rb'))
22
22
  end
23
23
 
24
- def generate_feature
25
- template('feature.tt', default_path("features/#{normalized_name}.feature", '.feature'))
26
- end
27
-
28
24
  def generate_spec
29
25
  template('spec.tt', default_path("spec/#{normalized_name}_page_spec.rb", '_spec.rb'))
30
26
  end
@@ -33,10 +29,6 @@ class Scaffolding < Thor::Group
33
29
  template('helper.tt', default_path("helpers/#{normalized_name}_helper.rb", '_helper.rb'))
34
30
  end
35
31
 
36
- def generate_steps
37
- template('steps.tt', default_path("features/step_definitions/#{normalized_name}_steps.rb", '_steps.rb'))
38
- end
39
-
40
32
  def generate_component
41
33
  template('component.tt', default_path("page_objects/components/#{normalized_name}.rb", '.rb'))
42
34
  end
@@ -76,10 +68,6 @@ class Scaffolding < Thor::Group
76
68
  ScaffoldProjectDetector.detect_automation
77
69
  end
78
70
 
79
- def framework_type
80
- ScaffoldProjectDetector.detect_framework
81
- end
82
-
83
71
  def project_config
84
72
  ScaffoldProjectDetector.config
85
73
  end
@@ -88,14 +76,6 @@ class Scaffolding < Thor::Group
88
76
  automation_type == 'selenium'
89
77
  end
90
78
 
91
- def watir?
92
- automation_type == 'watir'
93
- end
94
-
95
- def wait_helper?
96
- ScaffoldProjectDetector.wait_helper?
97
- end
98
-
99
79
  def default_path(standard_path, file_type)
100
80
  path ? "#{path}/#{normalized_name}#{file_type}" : standard_path
101
81
  end
@@ -12,20 +12,6 @@ class <%= class_name %> < Component
12
12
  private
13
13
 
14
14
  # Elements
15
- <%- if wait_helper? -%>
16
15
  # Example: component.find_element(css: '.selector').click
17
- <%- else -%>
18
- # Example: driver.find_element(css: '.selector')
19
- <%- end -%>
20
- <%- elsif watir? -%>
21
-
22
- def content
23
- component.text
24
- end
25
-
26
- private
27
-
28
- # Elements
29
- # Example: browser.element(css: '.selector')
30
16
  <%- end -%>
31
17
  end
@@ -18,13 +18,7 @@ require_relative '../abstract/page'
18
18
 
19
19
  <%= ' ' * module_parts.size %> # Elements
20
20
  <%- if selenium? -%>
21
- <%- if wait_helper? -%>
22
- <%= ' ' * module_parts.size %> # Example: click({ id: 'element_id' })
23
- <%- else -%>
24
- <%= ' ' * module_parts.size %> # Example: driver.find_element(id: 'element_id')
25
- <%- end -%>
26
- <%- elsif watir? -%>
27
- <%= ' ' * module_parts.size %> # Example: browser.text_field(id: 'element_id')
21
+ <%= ' ' * module_parts.size %> # Example: def submit_button = driver.find_element(by_role('button', name: 'Submit'))
28
22
  <%- end -%>
29
23
  <%= ' ' * module_parts.size %>end
30
24
  <% module_parts.each_with_index do |_mod, i| -%>
@@ -44,13 +38,7 @@ class <%= page_class_name %> < Page
44
38
 
45
39
  # Elements
46
40
  <%- if selenium? -%>
47
- <%- if wait_helper? -%>
48
- # Example: click({ id: 'element_id' })
49
- <%- else -%>
50
- # Example: driver.find_element(id: 'element_id')
51
- <%- end -%>
52
- <%- elsif watir? -%>
53
- # Example: browser.text_field(id: 'element_id')
41
+ # Example: def submit_button = driver.find_element(by_role('button', name: 'Submit'))
54
42
  <%- end -%>
55
43
  end
56
44
  <% end -%>
@@ -5,18 +5,10 @@ require_relative '../page_objects/pages/<%= normalized_name %>'
5
5
  describe '<%= page_class_name %>' do
6
6
  <%- if selenium? -%>
7
7
  let(:page) { <%= page_class_name %>.new(driver) }
8
- <%- elsif watir? -%>
9
- let(:page) { <%= page_class_name %>.new(browser) }
10
8
  <%- end -%>
11
9
  <%- if project_config['url'] -%>
12
10
 
13
- before do
14
- <%- if selenium? -%>
15
- driver.navigate.to "\#{project_config['url']}/<%= normalized_name %>"
16
- <%- elsif watir? -%>
17
- browser.goto "\#{project_config['url']}/<%= normalized_name %>"
18
- <%- end -%>
19
- end
11
+ before { page.visit }
20
12
  <%- end -%>
21
13
 
22
14
  it 'loads successfully' do
@@ -23,10 +23,6 @@ module Utilities
23
23
  set('spec_path', path)
24
24
  end
25
25
 
26
- def feature_path=(path)
27
- set('feature_path', path)
28
- end
29
-
30
26
  def helper_path=(path)
31
27
  set('helper_path', path)
32
28
  end
@@ -68,6 +64,14 @@ module Utilities
68
64
  set('headless', enabled)
69
65
  end
70
66
 
67
+ def strict=(enabled)
68
+ set('strict', enabled)
69
+ end
70
+
71
+ def actionability=(enabled)
72
+ set('actionability', enabled)
73
+ end
74
+
71
75
  def video_enabled=(enabled)
72
76
  reload_config
73
77
  video = @config['video']
@@ -91,13 +95,11 @@ module Utilities
91
95
  end
92
96
 
93
97
  def run(opts = nil)
94
- command = File.directory?('spec') ? 'rspec spec/' : 'cucumber features'
95
- system "#{command} #{opts}"
98
+ system "rspec spec/ #{opts}"
96
99
  end
97
100
 
98
101
  def parallel_run(opts = nil, _settings = nil)
99
- command = File.directory?('spec') ? 'parallel_rspec spec/' : 'parallel_cucumber features'
100
- system "#{command} #{opts}"
102
+ system "parallel_rspec spec/ #{opts}"
101
103
  end
102
104
 
103
105
  private
data/lib/version CHANGED
@@ -1 +1 @@
1
- 3.13.0
1
+ 4.0.1
data/ruby_raider.gemspec CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.bindir = 'bin'
15
15
  s.executables << 'raider'
16
16
  s.add_development_dependency 'bundler-audit', '~> 0.9'
17
+ s.add_development_dependency 'chunky_png', '~> 1.4'
17
18
  s.add_development_dependency 'rake', '~> 13.0.6'
18
19
  s.add_development_dependency 'reek', '~> 6.5'
19
20
  s.add_development_dependency 'rspec', '~> 3.11.0'
@@ -22,9 +23,9 @@ Gem::Specification.new do |s|
22
23
  s.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
23
24
  s.add_development_dependency 'ruby_audit', '~> 3.1'
24
25
  s.add_development_dependency 'rubyzip', '>= 2.3', '< 4'
25
- s.add_development_dependency 'selenium-webdriver', '~> 4.0'
26
26
  s.add_development_dependency 'steep', '~> 1.9'
27
27
 
28
+ s.add_runtime_dependency 'selenium-webdriver', '>= 4.30', '< 5'
28
29
  s.add_runtime_dependency 'thor', '~> 1.2.1'
29
30
  s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
30
31
  end
@@ -1,10 +1,8 @@
1
1
  # Type definitions for ScaffoldingCommands
2
2
  class ScaffoldingCommands < Thor
3
3
  def page: (String name) -> void
4
- def feature: (String name) -> void
5
4
  def spec: (String name) -> void
6
5
  def helper: (String name) -> void
7
- def steps: (String name) -> void
8
6
  def component: (String name) -> void
9
7
  def scaffold: (*String names) -> void
10
8
 
@@ -4,6 +4,8 @@ class UtilityCommands < Thor
4
4
  def url: (String default_url) -> void
5
5
  def browser: (?String? default_browser) -> void
6
6
  def browser_options: (*String opts) -> void
7
+ def strict: (String toggle) -> void
8
+ def actionability: (String toggle) -> void
7
9
  def raid: () -> void
8
10
  def timeout: (String seconds) -> void
9
11
  def viewport: (String dimensions) -> void
@@ -16,4 +18,8 @@ class UtilityCommands < Thor
16
18
  def video_toggle: (bool enabled) -> void
17
19
  def trace: (String action) -> void
18
20
  def trace_toggle: (bool enabled) -> void
21
+
22
+ private
23
+
24
+ def on?: (String toggle) -> bool
19
25
  end
@@ -8,18 +8,14 @@ class Generator < Thor::Group
8
8
  def self.template_cache_stats: () -> Hash[Symbol, untyped]
9
9
 
10
10
  # Predicate methods for framework/automation detection
11
- def cucumber?: () -> bool
12
11
  def cross_platform?: () -> bool
13
12
  def mobile?: () -> bool
14
13
  def single_platform?: () -> bool
15
14
  def ios?: () -> bool
16
15
  def android?: () -> bool
17
- def rspec?: () -> bool
18
16
  def azure?: () -> bool
19
17
  def github_ci?: () -> bool
20
18
  def selenium?: () -> bool
21
- def watir?: () -> bool
22
- def wait_helper?: () -> bool
23
19
  def trace_helper?: () -> bool
24
20
  def examples?: () -> bool
25
21
  def web?: () -> bool
@@ -4,7 +4,6 @@ class HelpersGenerator < Generator
4
4
 
5
5
  private
6
6
 
7
- def generate_browser_helper: () -> void
8
7
  def generate_spec_helper: () -> void
9
8
  def generate_driver_helper: () -> void
10
9
  def generate_appium_helper: () -> void
@@ -14,7 +14,6 @@ class MenuGenerator
14
14
  private
15
15
 
16
16
  def offer_desktop_download: () -> void
17
- def select_test_framework: (String automation) -> void
18
17
  def create_framework_options: (Hash[Symbol, untyped] params) -> untyped
19
18
  def select_accessibility: (String framework, String automation_type) -> void
20
19
  def mobile_automation?: (String automation_type) -> bool
@@ -5,6 +5,7 @@ module RubyRaider
5
5
 
6
6
  MAX_REDIRECTS: Integer
7
7
  DOWNLOAD_TIMEOUT: Integer
8
+ MAX_DOWNLOAD_BYTES: Integer
8
9
  RELEASE_BASE: String
9
10
  MANIFEST: manifest
10
11
  PLATFORMS: Array[String]
@@ -0,0 +1,25 @@
1
+ module Raider
2
+ module Actionability
3
+ CHECKS: Hash[Symbol, Array[String]]
4
+ NATIVE_CHECKS: Hash[Symbol, Array[String]]
5
+ PHRASES: Hash[String, String]
6
+ SCRIPT: String
7
+ FIRST_POLL: Hash[String, untyped]
8
+ NOTICE: String
9
+
10
+ def self.ensure: (untyped element, Symbol action, force: bool) -> Integer
11
+ def self.check: (untyped element, Symbol action) -> Hash[String, untyped]?
12
+ def self.reset_notice: () -> void
13
+
14
+ # private singleton helpers
15
+ def self.attached: (untyped element, bool web) -> Integer
16
+ def self.poll: (untyped element) { () -> Hash[String, untyped]? } -> Integer
17
+ def self.native_failure: (untyped element, Symbol action) -> Hash[String, String]?
18
+ def self.polled: (untyped element, Symbol action) -> Hash[String, untyped]?
19
+ def self.native_ready?: (untyped element, String name) -> bool
20
+ def self.clock: () -> Float
21
+ def self.not_actionable: (untyped element, Hash[String, untyped]? last, Float waited, Integer retries) -> NotActionable
22
+ def self.covering: (Hash[String, untyped] last) -> Hash[Symbol, untyped]?
23
+ def self.announce: () -> void
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ module Raider
2
+ module Actionable
3
+ def click: (?force: bool) -> untyped
4
+ def send_keys: (*untyped keys, ?force: bool) -> untyped
5
+ alias send_key send_keys
6
+ def clear: (?force: bool) -> untyped
7
+ def submit: (?force: bool) -> untyped
8
+
9
+ private
10
+
11
+ def raider_gate: (Observer::Run? run, Symbol action, bool force) -> untyped
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Raider
2
+ ROLES: Array[String]
3
+
4
+ module RoleLocator
5
+ def self.build: (String | Symbol role, String? name, bool exact, bool include_hidden, ?Integer? level) -> Hash[Symbol, Array[untyped]]
6
+ def self.validated_level: (String token, Integer? level) -> void
7
+ def self.validated_role: (String | Symbol role) -> String
8
+ end
9
+
10
+ def self.by_role: (String | Symbol role, ?name: String?, ?exact: bool, ?include_hidden: bool, ?level: Integer?) -> Hash[Symbol, Array[untyped]]
11
+
12
+ module Helpers
13
+ def by_role: (String | Symbol role, ?name: String?, ?exact: bool, ?include_hidden: bool, ?level: Integer?) -> Hash[Symbol, Array[untyped]]
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ module Raider
2
+ CONFIG_FILE: String
3
+ FALSY: Array[String]
4
+
5
+ class Error < StandardError
6
+ end
7
+
8
+ def self.strict: () -> bool
9
+ def self.actionability: () -> bool
10
+ def self.timeout: () -> Numeric
11
+ def self.test_id_attribute: () -> String
12
+ def self.strict=: (bool?) -> bool?
13
+ def self.actionability=: (bool?) -> bool?
14
+ def self.timeout=: (Numeric?) -> Numeric?
15
+ def self.test_id_attribute=: (String?) -> String?
16
+ def self.observer: () -> untyped
17
+ def self.observer=: (untyped) -> untyped
18
+ def self.reset: () -> void
19
+
20
+ # private singleton helpers
21
+ def self.resolve: (Symbol key, String env_name, untyped default) { (untyped) -> untyped } -> untyped
22
+ def self.file_config: () -> Hash[String, untyped]
23
+ def self.load_file: () -> Hash[String, untyped]
24
+ def self.truthy?: (untyped value) -> bool
25
+ def self.number: (untyped value) -> Numeric
26
+ end
@@ -0,0 +1,12 @@
1
+ module Raider
2
+ module Context
3
+ NATIVE: String
4
+
5
+ def self.web?: (untyped bridge) -> bool
6
+ def self.web_for?: (untyped search_context) -> bool
7
+
8
+ # private singleton helper
9
+ def self.contextual?: (untyped bridge) -> bool
10
+ def self.event_firing?: (untyped bridge) -> bool
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ module Raider
2
+ module Describe
3
+ TEXT_LIMIT: Integer
4
+ CLASS_LIMIT: Integer
5
+
6
+ def self.seconds: (Numeric value) -> Numeric
7
+ def self.element: (Selenium::WebDriver::Element element) -> String
8
+ def self.attribute_part: (String name, String value) -> String
9
+
10
+ def seconds: (Numeric value) -> Numeric
11
+ def element: (Selenium::WebDriver::Element element) -> String
12
+ def attribute_part: (String name, String value) -> String
13
+ end
14
+
15
+ class AmbiguousMatch < Selenium::WebDriver::Error::WebDriverError
16
+ SHOWN: Integer
17
+
18
+ attr_reader elements: Array[Selenium::WebDriver::Element]
19
+
20
+ def initialize: (String locator_description, Array[Selenium::WebDriver::Element] elements) -> void
21
+ end
22
+
23
+ class NotActionable < Selenium::WebDriver::Error::ElementNotInteractableError
24
+ attr_reader check: String
25
+ attr_reader covering: Hash[Symbol, untyped]?
26
+ attr_reader retries: Integer
27
+
28
+ def initialize: (String element_description, String check, ?covering: Hash[Symbol, untyped]?, ?waited: Numeric, ?retries: Integer) -> void
29
+ end
30
+
31
+ class NotSupported < Selenium::WebDriver::Error::UnsupportedOperationError
32
+ end
33
+
34
+ class TimeoutError < Selenium::WebDriver::Error::TimeoutError
35
+ end
36
+ end
@@ -0,0 +1,26 @@
1
+ module Raider
2
+ FINDERS: Hash[Symbol, String]
3
+
4
+ module Finders
5
+ BRIDGE: String
6
+ SEARCH_CONTEXT: String
7
+ SELENIUM_BRIDGES: Array[String]
8
+ APPIUM_BRIDGES: Array[String]
9
+
10
+ def self.register: () -> void
11
+ def self.ensure_registered: () -> void
12
+ def self.install_converter: (untyped bridge_class) -> void
13
+ def self.install: () -> void
14
+ def self.install_appium_converters: () -> void
15
+ def self.check_api: () -> void
16
+ def self.guard: () -> void
17
+
18
+ def register: () -> void
19
+ def ensure_registered: () -> void
20
+ def install_converter: (untyped bridge_class) -> void
21
+ def install: () -> void
22
+ def install_appium_converters: () -> void
23
+ def check_api: () -> void
24
+ def guard: () -> void
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ module Raider
2
+ class LocatorConverter
3
+ XPATH: Hash[String, Symbol]
4
+ ATTRIBUTES: Hash[String, String]
5
+ TEST_ID: String
6
+ ROLE: String
7
+
8
+ attr_reader inner: untyped
9
+
10
+ def initialize: (untyped inner) -> void
11
+ def convert: (String | Symbol how, untyped what) -> [String, untyped]
12
+
13
+ private
14
+
15
+ def owns?: (String key) -> bool
16
+ def translate: (String key, untyped value, bool exact) -> [String, String]
17
+ def split: (String key, untyped what) -> [untyped, bool]
18
+ def valid_pair?: (untyped pair) -> bool
19
+ def label_for: (String key) -> String
20
+ end
21
+ end
@@ -0,0 +1,64 @@
1
+ module Raider
2
+ module Matchers
3
+ class Base
4
+ module Chaining
5
+ def and: (untyped other) -> untyped
6
+ def or: (untyped other) -> untyped
7
+ def &: (untyped other) -> untyped
8
+ def |: (untyped other) -> untyped
9
+ end
10
+
11
+ STALE_HINT: String
12
+
13
+ class StaleActual < StandardError
14
+ end
15
+
16
+ NOT_FOUND: Object
17
+
18
+ class Poll < Struct[untyped]
19
+ attr_accessor actual: untyped
20
+ attr_accessor subject: untyped
21
+ attr_accessor value: untyped
22
+ attr_accessor waited: Numeric
23
+ attr_accessor elapsed: Numeric
24
+ attr_accessor stale: bool
25
+ end
26
+
27
+ attr_reader expected: untyped
28
+
29
+ def initialize: (untyped expected, ?wait: Numeric?, **untyped options) -> void
30
+ def matches?: (untyped actual) -> bool
31
+ def does_not_match?: (untyped actual) -> bool
32
+ def failure_message: () -> String
33
+ def failure_message_when_negated: () -> String
34
+ def supports_block_expectations?: () -> bool
35
+ def description: () -> String
36
+ def absent_passes?: () -> bool
37
+ def resolve: (untyped actual) -> untyped
38
+ def read_with_zero_wait: (untyped subject, Symbol method, *untyped args) -> untyped
39
+ def verb: () -> String
40
+ def read: (untyped subject) -> untyped
41
+ def pass?: (untyped value) -> bool
42
+
43
+ private
44
+
45
+ def option: (Symbol key) -> untyped
46
+
47
+ def polled_actual: () -> untyped
48
+ def wait_for: (untyped actual) -> Numeric
49
+ def poll: (untyped actual, negated: bool) -> bool
50
+ def clock: () -> Float
51
+ def settled?: (bool negated) -> bool
52
+ def gone: (Exception error, bool negated) -> bool
53
+ def negated_absent_passes?: () -> bool
54
+ def raw_element?: () -> bool
55
+ def raise_stale: () -> bot
56
+ def retried_errors: () -> Array[untyped]
57
+ def accepts_timeout?: (untyped subject, Symbol method) -> bool
58
+ def message: (String polarity) -> String
59
+ def target: () -> String
60
+ def last_seen: () -> String
61
+ def show: (untyped value) -> String
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,78 @@
1
+ module Raider
2
+ module Matchers
3
+ module Element
4
+ def self.normalise: (untyped text) -> String
5
+
6
+ class HaveText < Base
7
+ def initialize: (String | Regexp text, ?exact: bool, ?wait: Numeric?) -> void
8
+ def verb: () -> String
9
+ def read: (untyped subject) -> untyped
10
+ def pass?: (untyped value) -> bool
11
+ end
12
+
13
+ class HaveValue < Base
14
+ def verb: () -> String
15
+ def read: (untyped subject) -> untyped
16
+ def pass?: (untyped value) -> bool
17
+ end
18
+
19
+ class HaveAttribute < Base
20
+ PRESENT: Symbol
21
+
22
+ def initialize: (String name, ?untyped value, ?wait: Numeric?) -> void
23
+ def verb: () -> String
24
+ def read: (untyped subject) -> untyped
25
+ def pass?: (untyped value) -> bool
26
+ end
27
+
28
+ class State < Base
29
+ LABELS: Array[String]
30
+
31
+ def initialize: (?wait: Numeric?) -> void
32
+ def pass?: (untyped value) -> bool
33
+
34
+ private
35
+
36
+ def show: (untyped value) -> String
37
+ end
38
+
39
+ class BeVisible < State
40
+ def verb: () -> String
41
+ def read: (untyped subject) -> untyped
42
+
43
+ private
44
+
45
+ def negated_absent_passes?: () -> bool
46
+ end
47
+
48
+ class BeHidden < State
49
+ def verb: () -> String
50
+ def read: (untyped subject) -> bool
51
+ end
52
+
53
+ class BeEnabled < State
54
+ def verb: () -> String
55
+ def read: (untyped subject) -> untyped
56
+ end
57
+
58
+ class BeDisabled < State
59
+ def verb: () -> String
60
+ def read: (untyped subject) -> bool
61
+ end
62
+
63
+ class BeChecked < State
64
+ def verb: () -> String
65
+ def read: (untyped subject) -> untyped
66
+ end
67
+ end
68
+
69
+ def have_text: (String | Regexp text, ?exact: bool, ?wait: Numeric?) -> Element::HaveText
70
+ def have_value: (String | Regexp value, ?wait: Numeric?) -> Element::HaveValue
71
+ def have_attribute: (String name, ?untyped value, ?wait: Numeric?) -> Element::HaveAttribute
72
+ def be_visible: (?wait: Numeric?) -> Element::BeVisible
73
+ def be_hidden: (?wait: Numeric?) -> Element::BeHidden
74
+ def be_enabled: (?wait: Numeric?) -> Element::BeEnabled
75
+ def be_disabled: (?wait: Numeric?) -> Element::BeDisabled
76
+ def be_checked: (?wait: Numeric?) -> Element::BeChecked
77
+ end
78
+ end