ruby_raider 3.12.1 → 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.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/runtime.yml +38 -0
  3. data/.github/workflows/system_tests.yml +1 -23
  4. data/.reek.yml +1 -0
  5. data/.rspec +1 -0
  6. data/Gemfile +2 -0
  7. data/README.md +17 -48
  8. data/RELEASE.md +22 -0
  9. data/bin/raider +5 -0
  10. data/lib/commands/scaffolding_commands.rb +2 -25
  11. data/lib/commands/utility_commands.rb +39 -3
  12. data/lib/generators/automation/automation_generator.rb +0 -5
  13. data/lib/generators/automation/templates/component.tt +1 -0
  14. data/lib/generators/automation/templates/home.tt +2 -2
  15. data/lib/generators/automation/templates/login.tt +6 -26
  16. data/lib/generators/automation/templates/page.tt +23 -18
  17. data/lib/generators/automation/templates/partials/home_page_selector.tt +1 -2
  18. data/lib/generators/automation/templates/partials/initialize_selector.tt +0 -8
  19. data/lib/generators/automation/templates/partials/pdp_page_selector.tt +1 -2
  20. data/lib/generators/automation/templates/partials/url_methods.tt +8 -2
  21. data/lib/generators/automation/templates/partials/visit_method.tt +0 -5
  22. data/lib/generators/automation/templates/pdp.tt +1 -9
  23. data/lib/generators/common_generator.rb +0 -2
  24. data/lib/generators/generator.rb +19 -17
  25. data/lib/generators/helper_generator.rb +25 -16
  26. data/lib/generators/infrastructure/templates/azure_pipelines.tt +1 -1
  27. data/lib/generators/infrastructure/templates/github.tt +2 -3
  28. data/lib/generators/infrastructure/templates/github_appium.tt +0 -8
  29. data/lib/generators/invoke_generators.rb +4 -23
  30. data/lib/generators/menu_generator.rb +1 -9
  31. data/lib/generators/rspec/templates/accessibility_spec.tt +1 -9
  32. data/lib/generators/rspec/templates/spec.tt +8 -24
  33. data/lib/generators/template_renderer/partial_cache.rb +3 -1
  34. data/lib/generators/template_renderer.rb +1 -1
  35. data/lib/generators/templates/common/gemfile.tt +3 -10
  36. data/lib/generators/templates/common/git_ignore.tt +0 -5
  37. data/lib/generators/templates/common/partials/mobile_config.tt +3 -1
  38. data/lib/generators/templates/common/partials/web_config.tt +17 -1
  39. data/lib/generators/templates/common/rakefile.tt +0 -15
  40. data/lib/generators/templates/common/read_me.tt +394 -242
  41. data/lib/generators/templates/common/rubocop.tt +0 -2
  42. data/lib/generators/templates/helpers/driver_helper.tt +30 -0
  43. data/lib/generators/templates/helpers/gesture_helper.tt +78 -0
  44. data/lib/generators/templates/helpers/network_helper.tt +521 -0
  45. data/lib/generators/templates/helpers/partials/quit_driver.tt +0 -2
  46. data/lib/generators/templates/helpers/partials/screenshot.tt +0 -2
  47. data/lib/generators/templates/helpers/partials/selenium_driver.tt +14 -1
  48. data/lib/generators/templates/helpers/screenshot_helper.tt +490 -0
  49. data/lib/generators/templates/helpers/spec_helper.tt +56 -27
  50. data/lib/generators/templates/helpers/trace_helper.tt +1242 -0
  51. data/lib/generators/templates/helpers/video_helper.tt +3 -8
  52. data/lib/ruby_raider/runtime/actionability.rb +129 -0
  53. data/lib/ruby_raider/runtime/actionable.rb +49 -0
  54. data/lib/ruby_raider/runtime/by_role.rb +55 -0
  55. data/lib/ruby_raider/runtime/config.rb +79 -0
  56. data/lib/ruby_raider/runtime/context.rb +38 -0
  57. data/lib/ruby_raider/runtime/errors.rb +69 -0
  58. data/lib/ruby_raider/runtime/finders.rb +73 -0
  59. data/lib/ruby_raider/runtime/js/actionability.js +134 -0
  60. data/lib/ruby_raider/runtime/js/role_engine.js +315 -0
  61. data/lib/ruby_raider/runtime/locator_converter.rb +72 -0
  62. data/lib/ruby_raider/runtime/matchers/base.rb +222 -0
  63. data/lib/ruby_raider/runtime/matchers/element.rb +183 -0
  64. data/lib/ruby_raider/runtime/matchers/page.rb +71 -0
  65. data/lib/ruby_raider/runtime/matchers/presence.rb +41 -0
  66. data/lib/ruby_raider/runtime/matchers/retrying_block.rb +104 -0
  67. data/lib/ruby_raider/runtime/observer.rb +170 -0
  68. data/lib/ruby_raider/runtime/role_finder.rb +83 -0
  69. data/lib/ruby_raider/runtime/rspec.rb +78 -0
  70. data/lib/ruby_raider/runtime/selectors.rb +60 -0
  71. data/lib/ruby_raider/runtime/strict.rb +142 -0
  72. data/lib/ruby_raider/runtime/wait.rb +84 -0
  73. data/lib/ruby_raider/runtime.rb +20 -0
  74. data/lib/scaffolding/name_normalizer.rb +1 -1
  75. data/lib/scaffolding/project_detector.rb +2 -28
  76. data/lib/scaffolding/scaffolding.rb +0 -20
  77. data/lib/scaffolding/templates/component.tt +0 -14
  78. data/lib/scaffolding/templates/page_object.tt +2 -14
  79. data/lib/scaffolding/templates/spec.tt +1 -9
  80. data/lib/utilities/utilities.rb +17 -8
  81. data/lib/version +1 -1
  82. data/ruby_raider.gemspec +3 -1
  83. data/sig/commands/scaffolding_commands.rbs +0 -2
  84. data/sig/commands/utility_commands.rbs +8 -0
  85. data/sig/generators/generator.rbs +4 -4
  86. data/sig/generators/helper_generator.rbs +1 -1
  87. data/sig/generators/menu_generator.rbs +0 -1
  88. data/sig/ruby_raider/runtime/actionability.rbs +25 -0
  89. data/sig/ruby_raider/runtime/actionable.rbs +13 -0
  90. data/sig/ruby_raider/runtime/by_role.rbs +15 -0
  91. data/sig/ruby_raider/runtime/config.rbs +26 -0
  92. data/sig/ruby_raider/runtime/context.rbs +12 -0
  93. data/sig/ruby_raider/runtime/errors.rbs +36 -0
  94. data/sig/ruby_raider/runtime/finders.rbs +26 -0
  95. data/sig/ruby_raider/runtime/locator_converter.rbs +21 -0
  96. data/sig/ruby_raider/runtime/matchers/base.rbs +64 -0
  97. data/sig/ruby_raider/runtime/matchers/element.rbs +78 -0
  98. data/sig/ruby_raider/runtime/matchers/page.rbs +38 -0
  99. data/sig/ruby_raider/runtime/matchers/presence.rbs +21 -0
  100. data/sig/ruby_raider/runtime/matchers/retrying_block.rbs +27 -0
  101. data/sig/ruby_raider/runtime/observer.rbs +46 -0
  102. data/sig/ruby_raider/runtime/role_finder.rbs +18 -0
  103. data/sig/ruby_raider/runtime/selectors.rbs +21 -0
  104. data/sig/ruby_raider/runtime/strict.rbs +35 -0
  105. data/sig/ruby_raider/runtime/wait.rbs +17 -0
  106. data/sig/ruby_raider/runtime.rbs +2 -0
  107. data/sig/scaffolding/project_detector.rbs +0 -4
  108. data/sig/scaffolding/scaffolding.rbs +0 -5
  109. data/sig/utilities/utilities.rbs +3 -1
  110. data/sig/vendor/selenium_webdriver.rbs +71 -0
  111. data/spec/commands/raider_commands_spec.rb +38 -3
  112. data/spec/commands/scaffolding_commands_spec.rb +27 -0
  113. data/spec/commands/utility_commands_spec.rb +53 -0
  114. data/spec/generators/fixtures/video_helper_stubs/selenium-webdriver.rb +11 -2
  115. data/spec/generators/gesture_helper_spec.rb +123 -0
  116. data/spec/generators/network_helper_spec.rb +634 -0
  117. data/spec/generators/screenshot_helper_spec.rb +776 -0
  118. data/spec/generators/template_renderer_spec.rb +0 -4
  119. data/spec/generators/trace_helper_spec.rb +1337 -0
  120. data/spec/generators/video_helper_spec.rb +0 -9
  121. data/spec/integration/commands/browser_update_after_creation_spec.rb +0 -8
  122. data/spec/integration/commands/scaffolding_commands_spec.rb +12 -70
  123. data/spec/integration/commands/utility_commands_spec.rb +19 -41
  124. data/spec/integration/content/azure_content_spec.rb +2 -6
  125. data/spec/integration/content/ci_content_spec.rb +1 -55
  126. data/spec/integration/content/common_content_spec.rb +1 -118
  127. data/spec/integration/content/config_content_spec.rb +52 -29
  128. data/spec/integration/content/gemfile_content_spec.rb +7 -72
  129. data/spec/integration/content/helper_content_spec.rb +158 -93
  130. data/spec/integration/content/page_content_spec.rb +85 -87
  131. data/spec/integration/content/readme_content_spec.rb +176 -71
  132. data/spec/integration/content/rspec_reporter_content_spec.rb +2 -2
  133. data/spec/integration/content/rubocop_content_spec.rb +1 -1
  134. data/spec/integration/content/syntax_validation_spec.rb +2 -2
  135. data/spec/integration/content/test_content_spec.rb +23 -147
  136. data/spec/integration/end_to_end_features_spec.rb +1 -43
  137. data/spec/integration/end_to_end_spec.rb +648 -292
  138. data/spec/integration/generators/automation_generator_spec.rb +3 -37
  139. data/spec/integration/generators/axe_addon_spec.rb +2 -35
  140. data/spec/integration/generators/azure_generator_spec.rb +1 -1
  141. data/spec/integration/generators/common_generator_spec.rb +1 -40
  142. data/spec/integration/generators/config_features_spec.rb +1 -24
  143. data/spec/integration/generators/github_generator_spec.rb +0 -12
  144. data/spec/integration/generators/helpers_generator_spec.rb +91 -71
  145. data/spec/integration/generators/invoke_generators_spec.rb +54 -45
  146. data/spec/integration/generators/rspec_generator_spec.rb +0 -6
  147. data/spec/integration/scaffolding_e2e_spec.rb +17 -179
  148. data/spec/integration/spec_helper.rb +4 -6
  149. data/spec/integration/trace_format_checker.rb +150 -0
  150. data/spec/integration/trace_page_server.rb +147 -0
  151. data/spec/menus/menu_generator_spec.rb +14 -39
  152. data/spec/runtime/actionability_spec.rb +207 -0
  153. data/spec/runtime/actionable_spec.rb +125 -0
  154. data/spec/runtime/browser/actionability_script_browser_spec.rb +150 -0
  155. data/spec/runtime/browser/actionable_browser_spec.rb +98 -0
  156. data/spec/runtime/browser/finders_browser_spec.rb +148 -0
  157. data/spec/runtime/browser/matchers_browser_spec.rb +67 -0
  158. data/spec/runtime/browser/retrying_block_browser_spec.rb +37 -0
  159. data/spec/runtime/browser/role_engine_browser_spec.rb +184 -0
  160. data/spec/runtime/browser/strict_browser_spec.rb +38 -0
  161. data/spec/runtime/by_role_spec.rb +52 -0
  162. data/spec/runtime/config_spec.rb +79 -0
  163. data/spec/runtime/context_spec.rb +73 -0
  164. data/spec/runtime/errors_spec.rb +89 -0
  165. data/spec/runtime/finders_spec.rb +165 -0
  166. data/spec/runtime/fixtures/actionability.html +70 -0
  167. data/spec/runtime/fixtures/locators.html +46 -0
  168. data/spec/runtime/fixtures/matchers.html +33 -0
  169. data/spec/runtime/fixtures/roles.html +162 -0
  170. data/spec/runtime/matchers/base_spec.rb +165 -0
  171. data/spec/runtime/matchers/element_spec.rb +277 -0
  172. data/spec/runtime/matchers/page_spec.rb +102 -0
  173. data/spec/runtime/matchers/presence_spec.rb +59 -0
  174. data/spec/runtime/matchers/retrying_block_spec.rb +165 -0
  175. data/spec/runtime/observer_spec.rb +341 -0
  176. data/spec/runtime/role_finder_spec.rb +156 -0
  177. data/spec/runtime/role_query_spec.rb +75 -0
  178. data/spec/runtime/selectors_spec.rb +135 -0
  179. data/spec/runtime/strict_spec.rb +257 -0
  180. data/spec/runtime/support/browser.rb +48 -0
  181. data/spec/runtime/support/fake_bridge.rb +117 -0
  182. data/spec/runtime/wait_spec.rb +71 -0
  183. data/spec/scaffolding/name_normalizer_spec.rb +3 -2
  184. data/spec/scaffolding/scaffold_project_detector_spec.rb +4 -43
  185. data/spec/system/selenium_spec.rb +1 -5
  186. data/spec/system/support/system_test_helper.rb +2 -5
  187. data/spec/utilities/headless_config_spec.rb +0 -7
  188. data/spec/utilities/trace_command_spec.rb +66 -0
  189. data/spec/utilities/utilities_spec.rb +24 -0
  190. metadata +134 -44
  191. data/lib/generators/automation/templates/header.tt +0 -9
  192. data/lib/generators/cucumber/cucumber_generator.rb +0 -58
  193. data/lib/generators/cucumber/templates/accessibility_feature.tt +0 -5
  194. data/lib/generators/cucumber/templates/accessibility_steps.tt +0 -17
  195. data/lib/generators/cucumber/templates/cucumber.tt +0 -1
  196. data/lib/generators/cucumber/templates/env.tt +0 -7
  197. data/lib/generators/cucumber/templates/feature.tt +0 -21
  198. data/lib/generators/cucumber/templates/partials/appium_env.tt +0 -26
  199. data/lib/generators/cucumber/templates/partials/driver_world.tt +0 -18
  200. data/lib/generators/cucumber/templates/partials/mobile_steps.tt +0 -20
  201. data/lib/generators/cucumber/templates/partials/selenium_env.tt +0 -56
  202. data/lib/generators/cucumber/templates/partials/watir_env.tt +0 -48
  203. data/lib/generators/cucumber/templates/partials/watir_world.tt +0 -4
  204. data/lib/generators/cucumber/templates/partials/web_steps.tt +0 -28
  205. data/lib/generators/cucumber/templates/steps.tt +0 -5
  206. data/lib/generators/cucumber/templates/user_factory.tt +0 -15
  207. data/lib/generators/cucumber/templates/world.tt +0 -7
  208. data/lib/generators/templates/helpers/browser_helper.tt +0 -31
  209. data/lib/generators/templates/helpers/raider_element.tt +0 -159
  210. data/lib/generators/templates/helpers/wait_helper.tt +0 -470
  211. data/lib/scaffolding/templates/feature.tt +0 -6
  212. data/lib/scaffolding/templates/steps.tt +0 -19
  213. data/sig/generators/cucumber/cucumber_generator.rbs +0 -12
  214. data/spec/fixtures/watir_master/cucumber_watir/Readme.md.snapshot +0 -175
  215. data/spec/fixtures/watir_master/cucumber_watir/features/step_definitions/login_steps.rb.snapshot +0 -24
  216. data/spec/fixtures/watir_master/cucumber_watir/page_objects/abstract/page.rb.snapshot +0 -37
  217. data/spec/fixtures/watir_master/cucumber_watir/page_objects/pages/login.rb.snapshot +0 -33
  218. data/spec/fixtures/watir_master/rspec_watir/Readme.md.snapshot +0 -174
  219. data/spec/fixtures/watir_master/rspec_watir/page_objects/abstract/page.rb.snapshot +0 -37
  220. data/spec/fixtures/watir_master/rspec_watir/page_objects/pages/login.rb.snapshot +0 -33
  221. data/spec/fixtures/watir_master/rspec_watir/spec/login_page_spec.rb.snapshot +0 -49
  222. data/spec/integration/content/cucumber_reporter_content_spec.rb +0 -110
  223. data/spec/integration/generators/cucumber_generator_spec.rb +0 -100
  224. data/spec/integration/helpers/wait_helper_mobile_spec.rb +0 -281
  225. data/spec/integration/helpers/wait_helper_spec.rb +0 -496
  226. data/spec/integration/helpers/wait_helper_support.rb +0 -183
  227. data/spec/system/watir_spec.rb +0 -38
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec'
4
+ require_relative '../../lib/ruby_raider/runtime/wait'
5
+
6
+ RSpec.describe 'Raider::Wait' do
7
+ after { Raider.reset }
8
+
9
+ def clock
10
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
11
+ end
12
+
13
+ describe '.until' do
14
+ it 'returns the block value' do
15
+ expect(Raider::Wait.until(timeout: 1) { :ready }).to eq(:ready)
16
+ end
17
+
18
+ it 'polls until the block succeeds' do
19
+ calls = 0
20
+ result = Raider::Wait.until(timeout: 1, interval: 0) { (calls += 1) >= 3 && calls }
21
+ expect([result, calls]).to eq([3, 3])
22
+ end
23
+
24
+ it 'raises with the thrown reason on the deadline' do
25
+ expect { Raider::Wait.until(timeout: 0.05, interval: 0) { throw :not_ready, 'still moving' } }
26
+ .to raise_error(Raider::TimeoutError, 'still moving')
27
+ end
28
+
29
+ it 'raises a default reason when nothing was thrown' do
30
+ expect { Raider::Wait.until(timeout: 0.05, interval: 0) { false } }
31
+ .to raise_error(Raider::TimeoutError, 'condition not met')
32
+ end
33
+
34
+ it 'uses Raider.timeout when none is given' do
35
+ Raider.timeout = 0.05
36
+ expect { Raider::Wait.until(interval: 0) { nil } }.to raise_error(Raider::TimeoutError)
37
+ end
38
+
39
+ it 'restores the deadline afterwards' do
40
+ Raider::Wait.until(timeout: 1) { Raider::Wait.deadline }
41
+ expect(Raider::Wait.deadline).to be_nil
42
+ end
43
+ end
44
+
45
+ describe 'eventually' do
46
+ it 'is gone' do
47
+ expect(Raider.respond_to?(:eventually)).to be(false)
48
+ expect(Raider::Wait.respond_to?(:eventually)).to be(false)
49
+ end
50
+ end
51
+
52
+ describe '.immediately' do
53
+ it 'returns the block value and flags the block as immediate' do
54
+ expect(Raider::Wait.immediate?).to be(false)
55
+ expect(Raider::Wait.immediately { Raider::Wait.immediate? }).to be(true)
56
+ expect(Raider::Wait.immediate?).to be(false)
57
+ end
58
+
59
+ it 'stays immediate when an inner call leaves' do
60
+ Raider::Wait.immediately do
61
+ Raider::Wait.immediately { :inner }
62
+ expect(Raider::Wait.immediate?).to be(true)
63
+ end
64
+ end
65
+
66
+ it 'restores the flag when the block raises' do
67
+ expect { Raider::Wait.immediately { raise ArgumentError } }.to raise_error(ArgumentError)
68
+ expect(Raider::Wait.immediate?).to be(false)
69
+ end
70
+ end
71
+ end
@@ -12,8 +12,9 @@ RSpec.describe NameNormalizer do
12
12
  expect(described_class.normalize('login_spec')).to eq('login')
13
13
  end
14
14
 
15
- it 'strips _steps suffix' do
16
- expect(described_class.normalize('login_steps')).to eq('login')
15
+ it 'keeps a _steps or _feature ending' do
16
+ expect(described_class.normalize('login_steps')).to eq('login_steps')
17
+ expect(described_class.normalize('login_feature')).to eq('login_feature')
17
18
  end
18
19
 
19
20
  it 'strips _helper suffix' do
@@ -26,42 +26,15 @@ RSpec.describe ScaffoldProjectDetector do
26
26
  expect(described_class.detect_automation).to eq('selenium')
27
27
  end
28
28
 
29
- it 'detects rspec framework' do
30
- expect(described_class.detect_framework).to eq('rspec')
31
- end
32
-
33
29
  it 'reports selenium?' do
34
30
  expect(described_class.selenium?).to be true
35
31
  end
36
32
  end
37
33
 
38
- context 'with watir project' do
39
- before do
40
- File.write('Gemfile', "gem 'watir'\ngem 'rspec'\n")
41
- FileUtils.mkdir_p('spec')
42
- end
43
-
44
- it 'detects watir automation' do
45
- expect(described_class.detect_automation).to eq('watir')
46
- end
47
-
48
- it 'detects rspec framework' do
49
- expect(described_class.detect_framework).to eq('rspec')
50
- end
51
-
52
- it 'reports watir?' do
53
- expect(described_class.watir?).to be true
54
- end
55
- end
56
-
57
34
  context 'with no Gemfile' do
58
35
  it 'defaults to selenium' do
59
36
  expect(described_class.detect_automation).to eq('selenium')
60
37
  end
61
-
62
- it 'defaults to rspec' do
63
- expect(described_class.detect_framework).to eq('rspec')
64
- end
65
38
  end
66
39
 
67
40
  describe '.validate_project' do
@@ -84,16 +57,8 @@ RSpec.describe ScaffoldProjectDetector do
84
57
  end
85
58
  end
86
59
 
87
- describe '.wait_helper?' do
88
- it 'is true when helpers/wait_helper.rb exists' do
89
- FileUtils.mkdir_p('helpers')
90
- File.write('helpers/wait_helper.rb', "# frozen_string_literal: true\n")
91
- expect(described_class.wait_helper?).to be true
92
- end
93
-
94
- it 'is false when the file does not exist' do
95
- expect(described_class.wait_helper?).to be false
96
- end
60
+ it 'no longer detects a wait helper' do
61
+ expect(described_class).not_to respond_to(:wait_helper?)
97
62
  end
98
63
 
99
64
  describe '.config' do
@@ -120,12 +85,8 @@ RSpec.describe ScaffoldProjectDetector do
120
85
  FileUtils.mkdir_p('spec')
121
86
  end
122
87
 
123
- it 'returns full detection hash' do
124
- result = described_class.detect
125
- expect(result[:automation]).to eq('selenium')
126
- expect(result[:framework]).to eq('rspec')
127
- expect(result[:has_spec]).to be true
128
- expect(result[:has_features]).to be false
88
+ it 'returns the automation and whether there is a spec folder, and nothing else' do
89
+ expect(described_class.detect).to eq(automation: 'selenium', has_spec: true)
129
90
  end
130
91
  end
131
92
  end
@@ -3,7 +3,7 @@
3
3
  require_relative '../../lib/ruby_raider'
4
4
  require_relative 'support/system_test_helper'
5
5
 
6
- FRAMEWORKS = %w[cucumber rspec].freeze
6
+ FRAMEWORKS = %w[rspec].freeze
7
7
 
8
8
  describe 'Selenium based frameworks' do
9
9
  include SystemTestHelper
@@ -31,8 +31,4 @@ describe 'Selenium based frameworks' do
31
31
  context 'with rspec' do
32
32
  include_examples 'runs tests successfully', 'rspec'
33
33
  end
34
-
35
- context 'with cucumber' do
36
- include_examples 'runs tests successfully', 'cucumber'
37
- end
38
34
  end
@@ -3,11 +3,8 @@
3
3
  require 'open3'
4
4
 
5
5
  module SystemTestHelper
6
- def test_command_for(framework)
7
- case framework
8
- when 'cucumber' then 'bundle exec cucumber features --format pretty'
9
- else 'bundle exec rspec spec --format documentation'
10
- end
6
+ def test_command_for(_framework)
7
+ 'bundle exec rspec spec --format documentation'
11
8
  end
12
9
 
13
10
  def run_tests_with(framework, automation)
@@ -31,13 +31,6 @@ RSpec.describe 'Headless config support in driver templates' do
31
31
  end
32
32
  end
33
33
 
34
- describe 'browser helper template (watir)' do
35
- it 'checks config headless key' do
36
- content = File.read(File.expand_path('../../lib/generators/templates/helpers/browser_helper.tt', __dir__))
37
- expect(content).to include("config['headless']")
38
- end
39
- end
40
-
41
34
  describe 'headless via config.yml' do
42
35
  it 'config key is used when YAML has headless: true' do
43
36
  FileUtils.mkdir_p('config')
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tmpdir'
4
+ require 'fileutils'
5
+ require 'yaml'
6
+ require 'stringio'
7
+ require_relative '../../lib/commands/utility_commands'
8
+
9
+ # rubocop:disable RSpec/FilePath
10
+ RSpec.describe UtilityCommands do
11
+ let(:dir) { Dir.mktmpdir('raider-trace-project') }
12
+ let(:config_path) { File.join(dir, 'config', 'config.yml') }
13
+
14
+ around do |example|
15
+ FileUtils.mkdir_p(File.join(dir, 'config'))
16
+ File.write(config_path, "browser: chrome\ntimeout: 10\ntrace:\n enabled: true\n max_steps: 200\n max_mb: 20\n")
17
+ Dir.chdir(dir) { example.run }
18
+ ensure
19
+ FileUtils.rm_rf(dir)
20
+ end
21
+
22
+ def run_cli(*args)
23
+ out = StringIO.new
24
+ err = StringIO.new
25
+ status = 0
26
+ $stdout = out
27
+ $stderr = err
28
+ begin
29
+ described_class.start(args)
30
+ rescue SystemExit => e
31
+ status = e.status
32
+ ensure
33
+ $stdout = STDOUT
34
+ $stderr = STDERR
35
+ end
36
+ [out.string, err.string, status]
37
+ end
38
+
39
+ describe 'trace on/off' do
40
+ it 'round-trips trace.enabled, keeping the other trace keys and config keys' do
41
+ out, _err, status = run_cli('trace', 'off')
42
+ config = YAML.load_file(config_path)
43
+ expect([status, out]).to match([0, /Trace capture disabled/])
44
+ expect(config).to include('browser' => 'chrome', 'timeout' => 10, 'trace' => { 'enabled' => false, 'max_steps' => 200, 'max_mb' => 20 })
45
+
46
+ out, = run_cli('trace', 'on')
47
+ expect(out).to include('Trace capture enabled')
48
+ expect(YAML.load_file(config_path)['trace']).to eq('enabled' => true, 'max_steps' => 200, 'max_mb' => 20)
49
+ end
50
+
51
+ it 'adds a trace block to a config that has none' do
52
+ File.write(config_path, "browser: chrome\n")
53
+ run_cli('trace', 'off')
54
+ expect(YAML.load_file(config_path)['trace']).to eq('enabled' => false)
55
+ end
56
+ end
57
+
58
+ describe 'trace with an unknown subcommand' do
59
+ it 'exits 1 with usage' do
60
+ _out, err, status = run_cli('trace', 'bogus')
61
+ expect(status).to eq(1)
62
+ expect(err).to include("Unknown trace command 'bogus'", 'on|off')
63
+ end
64
+ end
65
+ end
66
+ # rubocop:enable RSpec/FilePath
@@ -104,6 +104,30 @@ RSpec.describe Utilities do
104
104
  end
105
105
  end
106
106
 
107
+ describe '.strict=' do
108
+ it 'sets strict to false' do
109
+ described_class.strict = false
110
+ expect(YAML.load_file(config_path)['strict']).to be false
111
+ end
112
+
113
+ it 'sets strict to true' do
114
+ described_class.strict = true
115
+ expect(YAML.load_file(config_path)['strict']).to be true
116
+ end
117
+ end
118
+
119
+ describe '.actionability=' do
120
+ it 'sets actionability to true' do
121
+ described_class.actionability = true
122
+ expect(YAML.load_file(config_path)['actionability']).to be true
123
+ end
124
+
125
+ it 'sets actionability to false' do
126
+ described_class.actionability = false
127
+ expect(YAML.load_file(config_path)['actionability']).to be false
128
+ end
129
+ end
130
+
107
131
  describe '.viewport=' do
108
132
  it 'sets viewport dimensions' do
109
133
  described_class.viewport = '375x812'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_raider
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-01 00:00:00.000000000 Z
11
+ date: 2026-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: chunky_png
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.4'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -123,19 +137,25 @@ dependencies:
123
137
  - !ruby/object:Gem::Version
124
138
  version: '3.1'
125
139
  - !ruby/object:Gem::Dependency
126
- name: selenium-webdriver
140
+ name: rubyzip
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "~>"
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '2.3'
146
+ - - "<"
130
147
  - !ruby/object:Gem::Version
131
- version: '4.0'
148
+ version: '4'
132
149
  type: :development
133
150
  prerelease: false
134
151
  version_requirements: !ruby/object:Gem::Requirement
135
152
  requirements:
136
- - - "~>"
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '2.3'
156
+ - - "<"
137
157
  - !ruby/object:Gem::Version
138
- version: '4.0'
158
+ version: '4'
139
159
  - !ruby/object:Gem::Dependency
140
160
  name: steep
141
161
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +170,26 @@ dependencies:
150
170
  - - "~>"
151
171
  - !ruby/object:Gem::Version
152
172
  version: '1.9'
173
+ - !ruby/object:Gem::Dependency
174
+ name: selenium-webdriver
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '4.30'
180
+ - - "<"
181
+ - !ruby/object:Gem::Version
182
+ version: '5'
183
+ type: :runtime
184
+ prerelease: false
185
+ version_requirements: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '4.30'
190
+ - - "<"
191
+ - !ruby/object:Gem::Version
192
+ version: '5'
153
193
  - !ruby/object:Gem::Dependency
154
194
  name: thor
155
195
  requirement: !ruby/object:Gem::Requirement
@@ -194,11 +234,13 @@ files:
194
234
  - ".github/workflows/reek.yml"
195
235
  - ".github/workflows/release.yml"
196
236
  - ".github/workflows/rubocop.yml"
237
+ - ".github/workflows/runtime.yml"
197
238
  - ".github/workflows/security.yml"
198
239
  - ".github/workflows/steep.yml"
199
240
  - ".github/workflows/system_tests.yml"
200
241
  - ".gitignore"
201
242
  - ".reek.yml"
243
+ - ".rspec"
202
244
  - ".rubocop.yml"
203
245
  - ".ruby-version"
204
246
  - CODE_OF_CONDUCT.md
@@ -224,7 +266,6 @@ files:
224
266
  - lib/generators/automation/templates/account.tt
225
267
  - lib/generators/automation/templates/appium_caps.tt
226
268
  - lib/generators/automation/templates/component.tt
227
- - lib/generators/automation/templates/header.tt
228
269
  - lib/generators/automation/templates/home.tt
229
270
  - lib/generators/automation/templates/login.tt
230
271
  - lib/generators/automation/templates/page.tt
@@ -236,22 +277,6 @@ files:
236
277
  - lib/generators/automation/templates/partials/visit_method.tt
237
278
  - lib/generators/automation/templates/pdp.tt
238
279
  - lib/generators/common_generator.rb
239
- - lib/generators/cucumber/cucumber_generator.rb
240
- - lib/generators/cucumber/templates/accessibility_feature.tt
241
- - lib/generators/cucumber/templates/accessibility_steps.tt
242
- - lib/generators/cucumber/templates/cucumber.tt
243
- - lib/generators/cucumber/templates/env.tt
244
- - lib/generators/cucumber/templates/feature.tt
245
- - lib/generators/cucumber/templates/partials/appium_env.tt
246
- - lib/generators/cucumber/templates/partials/driver_world.tt
247
- - lib/generators/cucumber/templates/partials/mobile_steps.tt
248
- - lib/generators/cucumber/templates/partials/selenium_env.tt
249
- - lib/generators/cucumber/templates/partials/watir_env.tt
250
- - lib/generators/cucumber/templates/partials/watir_world.tt
251
- - lib/generators/cucumber/templates/partials/web_steps.tt
252
- - lib/generators/cucumber/templates/steps.tt
253
- - lib/generators/cucumber/templates/user_factory.tt
254
- - lib/generators/cucumber/templates/world.tt
255
280
  - lib/generators/generator.rb
256
281
  - lib/generators/helper_generator.rb
257
282
  - lib/generators/infrastructure/azure_generator.rb
@@ -281,30 +306,51 @@ files:
281
306
  - lib/generators/templates/common/rspec.tt
282
307
  - lib/generators/templates/common/rubocop.tt
283
308
  - lib/generators/templates/helpers/appium_helper.tt
284
- - lib/generators/templates/helpers/browser_helper.tt
285
309
  - lib/generators/templates/helpers/driver_helper.tt
310
+ - lib/generators/templates/helpers/gesture_helper.tt
311
+ - lib/generators/templates/helpers/network_helper.tt
286
312
  - lib/generators/templates/helpers/partials/appium_driver.tt
287
313
  - lib/generators/templates/helpers/partials/browserstack_config.tt
288
314
  - lib/generators/templates/helpers/partials/driver_and_options.tt
289
315
  - lib/generators/templates/helpers/partials/quit_driver.tt
290
316
  - lib/generators/templates/helpers/partials/screenshot.tt
291
317
  - lib/generators/templates/helpers/partials/selenium_driver.tt
292
- - lib/generators/templates/helpers/raider_element.tt
318
+ - lib/generators/templates/helpers/screenshot_helper.tt
293
319
  - lib/generators/templates/helpers/session_state.tt
294
320
  - lib/generators/templates/helpers/spec_helper.tt
321
+ - lib/generators/templates/helpers/trace_helper.tt
295
322
  - lib/generators/templates/helpers/video_helper.tt
296
- - lib/generators/templates/helpers/wait_helper.tt
297
323
  - lib/ruby_raider.rb
298
324
  - lib/ruby_raider/ffmpeg.rb
325
+ - lib/ruby_raider/runtime.rb
326
+ - lib/ruby_raider/runtime/actionability.rb
327
+ - lib/ruby_raider/runtime/actionable.rb
328
+ - lib/ruby_raider/runtime/by_role.rb
329
+ - lib/ruby_raider/runtime/config.rb
330
+ - lib/ruby_raider/runtime/context.rb
331
+ - lib/ruby_raider/runtime/errors.rb
332
+ - lib/ruby_raider/runtime/finders.rb
333
+ - lib/ruby_raider/runtime/js/actionability.js
334
+ - lib/ruby_raider/runtime/js/role_engine.js
335
+ - lib/ruby_raider/runtime/locator_converter.rb
336
+ - lib/ruby_raider/runtime/matchers/base.rb
337
+ - lib/ruby_raider/runtime/matchers/element.rb
338
+ - lib/ruby_raider/runtime/matchers/page.rb
339
+ - lib/ruby_raider/runtime/matchers/presence.rb
340
+ - lib/ruby_raider/runtime/matchers/retrying_block.rb
341
+ - lib/ruby_raider/runtime/observer.rb
342
+ - lib/ruby_raider/runtime/role_finder.rb
343
+ - lib/ruby_raider/runtime/rspec.rb
344
+ - lib/ruby_raider/runtime/selectors.rb
345
+ - lib/ruby_raider/runtime/strict.rb
346
+ - lib/ruby_raider/runtime/wait.rb
299
347
  - lib/scaffolding/name_normalizer.rb
300
348
  - lib/scaffolding/project_detector.rb
301
349
  - lib/scaffolding/scaffolding.rb
302
350
  - lib/scaffolding/templates/component.tt
303
- - lib/scaffolding/templates/feature.tt
304
351
  - lib/scaffolding/templates/helper.tt
305
352
  - lib/scaffolding/templates/page_object.tt
306
353
  - lib/scaffolding/templates/spec.tt
307
- - lib/scaffolding/templates/steps.tt
308
354
  - lib/utilities/desktop_downloader.rb
309
355
  - lib/utilities/logger.rb
310
356
  - lib/utilities/logo.rb
@@ -316,7 +362,6 @@ files:
316
362
  - sig/commands/utility_commands.rbs
317
363
  - sig/generators/automation/automation_generator.rbs
318
364
  - sig/generators/common_generator.rbs
319
- - sig/generators/cucumber/cucumber_generator.rbs
320
365
  - sig/generators/generator.rbs
321
366
  - sig/generators/helper_generator.rbs
322
367
  - sig/generators/infrastructure/azure_generator.rbs
@@ -330,6 +375,25 @@ files:
330
375
  - sig/generators/template_renderer/template_error.rbs
331
376
  - sig/ruby_raider.rbs
332
377
  - sig/ruby_raider/ffmpeg.rbs
378
+ - sig/ruby_raider/runtime.rbs
379
+ - sig/ruby_raider/runtime/actionability.rbs
380
+ - sig/ruby_raider/runtime/actionable.rbs
381
+ - sig/ruby_raider/runtime/by_role.rbs
382
+ - sig/ruby_raider/runtime/config.rbs
383
+ - sig/ruby_raider/runtime/context.rbs
384
+ - sig/ruby_raider/runtime/errors.rbs
385
+ - sig/ruby_raider/runtime/finders.rbs
386
+ - sig/ruby_raider/runtime/locator_converter.rbs
387
+ - sig/ruby_raider/runtime/matchers/base.rbs
388
+ - sig/ruby_raider/runtime/matchers/element.rbs
389
+ - sig/ruby_raider/runtime/matchers/page.rbs
390
+ - sig/ruby_raider/runtime/matchers/presence.rbs
391
+ - sig/ruby_raider/runtime/matchers/retrying_block.rbs
392
+ - sig/ruby_raider/runtime/observer.rbs
393
+ - sig/ruby_raider/runtime/role_finder.rbs
394
+ - sig/ruby_raider/runtime/selectors.rbs
395
+ - sig/ruby_raider/runtime/strict.rbs
396
+ - sig/ruby_raider/runtime/wait.rbs
333
397
  - sig/scaffolding/name_normalizer.rbs
334
398
  - sig/scaffolding/project_detector.rbs
335
399
  - sig/scaffolding/scaffolding.rbs
@@ -337,22 +401,20 @@ files:
337
401
  - sig/utilities/logger.rbs
338
402
  - sig/utilities/logo.rbs
339
403
  - sig/utilities/utilities.rbs
404
+ - sig/vendor/selenium_webdriver.rbs
340
405
  - sig/vendor/thor.rbs
341
406
  - sig/vendor/tty_prompt.rbs
342
407
  - spec/commands/raider_commands_spec.rb
343
408
  - spec/commands/scaffolding_commands_spec.rb
344
- - spec/fixtures/watir_master/cucumber_watir/Readme.md.snapshot
345
- - spec/fixtures/watir_master/cucumber_watir/features/step_definitions/login_steps.rb.snapshot
346
- - spec/fixtures/watir_master/cucumber_watir/page_objects/abstract/page.rb.snapshot
347
- - spec/fixtures/watir_master/cucumber_watir/page_objects/pages/login.rb.snapshot
348
- - spec/fixtures/watir_master/rspec_watir/Readme.md.snapshot
349
- - spec/fixtures/watir_master/rspec_watir/page_objects/abstract/page.rb.snapshot
350
- - spec/fixtures/watir_master/rspec_watir/page_objects/pages/login.rb.snapshot
351
- - spec/fixtures/watir_master/rspec_watir/spec/login_page_spec.rb.snapshot
409
+ - spec/commands/utility_commands_spec.rb
352
410
  - spec/generators/fixtures/templates/test.tt
353
411
  - spec/generators/fixtures/templates/test_partial.tt
354
412
  - spec/generators/fixtures/video_helper_stubs/selenium-webdriver.rb
413
+ - spec/generators/gesture_helper_spec.rb
414
+ - spec/generators/network_helper_spec.rb
415
+ - spec/generators/screenshot_helper_spec.rb
355
416
  - spec/generators/template_renderer_spec.rb
417
+ - spec/generators/trace_helper_spec.rb
356
418
  - spec/generators/video_helper_spec.rb
357
419
  - spec/integration/commands/browser_update_after_creation_spec.rb
358
420
  - spec/integration/commands/scaffolding_commands_spec.rb
@@ -362,7 +424,6 @@ files:
362
424
  - spec/integration/content/common_content_spec.rb
363
425
  - spec/integration/content/config_content_spec.rb
364
426
  - spec/integration/content/content_helper.rb
365
- - spec/integration/content/cucumber_reporter_content_spec.rb
366
427
  - spec/integration/content/gemfile_content_spec.rb
367
428
  - spec/integration/content/helper_content_spec.rb
368
429
  - spec/integration/content/page_content_spec.rb
@@ -379,28 +440,57 @@ files:
379
440
  - spec/integration/generators/azure_generator_spec.rb
380
441
  - spec/integration/generators/common_generator_spec.rb
381
442
  - spec/integration/generators/config_features_spec.rb
382
- - spec/integration/generators/cucumber_generator_spec.rb
383
443
  - spec/integration/generators/github_generator_spec.rb
384
444
  - spec/integration/generators/helpers_generator_spec.rb
385
445
  - spec/integration/generators/invoke_generators_spec.rb
386
446
  - spec/integration/generators/rspec_generator_spec.rb
387
447
  - spec/integration/helpers/session_state_spec.rb
388
- - spec/integration/helpers/wait_helper_mobile_spec.rb
389
- - spec/integration/helpers/wait_helper_spec.rb
390
- - spec/integration/helpers/wait_helper_support.rb
391
448
  - spec/integration/scaffolding_e2e_spec.rb
392
449
  - spec/integration/settings_helper.rb
393
450
  - spec/integration/spec_helper.rb
451
+ - spec/integration/trace_format_checker.rb
452
+ - spec/integration/trace_page_server.rb
394
453
  - spec/menus/menu_generator_spec.rb
454
+ - spec/runtime/actionability_spec.rb
455
+ - spec/runtime/actionable_spec.rb
456
+ - spec/runtime/browser/actionability_script_browser_spec.rb
457
+ - spec/runtime/browser/actionable_browser_spec.rb
458
+ - spec/runtime/browser/finders_browser_spec.rb
459
+ - spec/runtime/browser/matchers_browser_spec.rb
460
+ - spec/runtime/browser/retrying_block_browser_spec.rb
461
+ - spec/runtime/browser/role_engine_browser_spec.rb
462
+ - spec/runtime/browser/strict_browser_spec.rb
463
+ - spec/runtime/by_role_spec.rb
464
+ - spec/runtime/config_spec.rb
465
+ - spec/runtime/context_spec.rb
466
+ - spec/runtime/errors_spec.rb
467
+ - spec/runtime/finders_spec.rb
468
+ - spec/runtime/fixtures/actionability.html
469
+ - spec/runtime/fixtures/locators.html
470
+ - spec/runtime/fixtures/matchers.html
471
+ - spec/runtime/fixtures/roles.html
472
+ - spec/runtime/matchers/base_spec.rb
473
+ - spec/runtime/matchers/element_spec.rb
474
+ - spec/runtime/matchers/page_spec.rb
475
+ - spec/runtime/matchers/presence_spec.rb
476
+ - spec/runtime/matchers/retrying_block_spec.rb
477
+ - spec/runtime/observer_spec.rb
478
+ - spec/runtime/role_finder_spec.rb
479
+ - spec/runtime/role_query_spec.rb
480
+ - spec/runtime/selectors_spec.rb
481
+ - spec/runtime/strict_spec.rb
482
+ - spec/runtime/support/browser.rb
483
+ - spec/runtime/support/fake_bridge.rb
484
+ - spec/runtime/wait_spec.rb
395
485
  - spec/scaffolding/name_normalizer_spec.rb
396
486
  - spec/scaffolding/scaffold_project_detector_spec.rb
397
487
  - spec/scaffolding/scaffolding_features_spec.rb
398
488
  - spec/system/selenium_spec.rb
399
489
  - spec/system/support/system_test_helper.rb
400
- - spec/system/watir_spec.rb
401
490
  - spec/utilities/desktop_downloader_spec.rb
402
491
  - spec/utilities/ffmpeg_spec.rb
403
492
  - spec/utilities/headless_config_spec.rb
493
+ - spec/utilities/trace_command_spec.rb
404
494
  - spec/utilities/utilities_spec.rb
405
495
  - spec/utilities/video_command_spec.rb
406
496
  homepage: https://github.com/RubyRaider/ruby_raider
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../abstract/component'
4
-
5
- class Header < Component
6
- def customer_name
7
- component.text
8
- end
9
- end