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.
Files changed (225) 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 +16 -49
  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 +23 -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 +12 -19
  25. data/lib/generators/helper_generator.rb +21 -19
  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 +10 -1
  39. data/lib/generators/templates/common/rakefile.tt +0 -15
  40. data/lib/generators/templates/common/read_me.tt +357 -250
  41. data/lib/generators/templates/common/rubocop.tt +0 -2
  42. data/lib/generators/templates/helpers/driver_helper.tt +8 -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 +5 -2
  48. data/lib/generators/templates/helpers/screenshot_helper.tt +490 -0
  49. data/lib/generators/templates/helpers/spec_helper.tt +39 -29
  50. data/lib/generators/templates/helpers/trace_helper.tt +240 -95
  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 +10 -8
  81. data/lib/version +1 -1
  82. data/ruby_raider.gemspec +2 -1
  83. data/sig/commands/scaffolding_commands.rbs +0 -2
  84. data/sig/commands/utility_commands.rbs +6 -0
  85. data/sig/generators/generator.rbs +0 -4
  86. data/sig/generators/helper_generator.rbs +0 -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 +2 -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/gesture_helper_spec.rb +123 -0
  115. data/spec/generators/network_helper_spec.rb +634 -0
  116. data/spec/generators/screenshot_helper_spec.rb +776 -0
  117. data/spec/generators/template_renderer_spec.rb +0 -4
  118. data/spec/generators/trace_helper_spec.rb +489 -97
  119. data/spec/generators/video_helper_spec.rb +0 -9
  120. data/spec/integration/commands/browser_update_after_creation_spec.rb +0 -8
  121. data/spec/integration/commands/scaffolding_commands_spec.rb +12 -70
  122. data/spec/integration/commands/utility_commands_spec.rb +19 -41
  123. data/spec/integration/content/azure_content_spec.rb +2 -6
  124. data/spec/integration/content/ci_content_spec.rb +1 -55
  125. data/spec/integration/content/common_content_spec.rb +1 -118
  126. data/spec/integration/content/config_content_spec.rb +34 -31
  127. data/spec/integration/content/gemfile_content_spec.rb +7 -72
  128. data/spec/integration/content/helper_content_spec.rb +105 -99
  129. data/spec/integration/content/page_content_spec.rb +85 -87
  130. data/spec/integration/content/readme_content_spec.rb +134 -75
  131. data/spec/integration/content/rspec_reporter_content_spec.rb +2 -2
  132. data/spec/integration/content/rubocop_content_spec.rb +1 -1
  133. data/spec/integration/content/syntax_validation_spec.rb +2 -2
  134. data/spec/integration/content/test_content_spec.rb +23 -147
  135. data/spec/integration/end_to_end_features_spec.rb +1 -43
  136. data/spec/integration/end_to_end_spec.rb +319 -326
  137. data/spec/integration/generators/automation_generator_spec.rb +3 -37
  138. data/spec/integration/generators/axe_addon_spec.rb +2 -35
  139. data/spec/integration/generators/azure_generator_spec.rb +1 -1
  140. data/spec/integration/generators/common_generator_spec.rb +1 -40
  141. data/spec/integration/generators/config_features_spec.rb +1 -24
  142. data/spec/integration/generators/github_generator_spec.rb +0 -12
  143. data/spec/integration/generators/helpers_generator_spec.rb +74 -80
  144. data/spec/integration/generators/invoke_generators_spec.rb +54 -45
  145. data/spec/integration/generators/rspec_generator_spec.rb +0 -6
  146. data/spec/integration/scaffolding_e2e_spec.rb +17 -179
  147. data/spec/integration/spec_helper.rb +4 -6
  148. data/spec/integration/trace_format_checker.rb +11 -2
  149. data/spec/integration/trace_page_server.rb +72 -5
  150. data/spec/menus/menu_generator_spec.rb +14 -39
  151. data/spec/runtime/actionability_spec.rb +207 -0
  152. data/spec/runtime/actionable_spec.rb +125 -0
  153. data/spec/runtime/browser/actionability_script_browser_spec.rb +150 -0
  154. data/spec/runtime/browser/actionable_browser_spec.rb +98 -0
  155. data/spec/runtime/browser/finders_browser_spec.rb +148 -0
  156. data/spec/runtime/browser/matchers_browser_spec.rb +67 -0
  157. data/spec/runtime/browser/retrying_block_browser_spec.rb +37 -0
  158. data/spec/runtime/browser/role_engine_browser_spec.rb +184 -0
  159. data/spec/runtime/browser/strict_browser_spec.rb +38 -0
  160. data/spec/runtime/by_role_spec.rb +52 -0
  161. data/spec/runtime/config_spec.rb +79 -0
  162. data/spec/runtime/context_spec.rb +73 -0
  163. data/spec/runtime/errors_spec.rb +89 -0
  164. data/spec/runtime/finders_spec.rb +165 -0
  165. data/spec/runtime/fixtures/actionability.html +70 -0
  166. data/spec/runtime/fixtures/locators.html +46 -0
  167. data/spec/runtime/fixtures/matchers.html +33 -0
  168. data/spec/runtime/fixtures/roles.html +162 -0
  169. data/spec/runtime/matchers/base_spec.rb +165 -0
  170. data/spec/runtime/matchers/element_spec.rb +277 -0
  171. data/spec/runtime/matchers/page_spec.rb +102 -0
  172. data/spec/runtime/matchers/presence_spec.rb +59 -0
  173. data/spec/runtime/matchers/retrying_block_spec.rb +165 -0
  174. data/spec/runtime/observer_spec.rb +341 -0
  175. data/spec/runtime/role_finder_spec.rb +156 -0
  176. data/spec/runtime/role_query_spec.rb +75 -0
  177. data/spec/runtime/selectors_spec.rb +135 -0
  178. data/spec/runtime/strict_spec.rb +257 -0
  179. data/spec/runtime/support/browser.rb +48 -0
  180. data/spec/runtime/support/fake_bridge.rb +117 -0
  181. data/spec/runtime/wait_spec.rb +71 -0
  182. data/spec/scaffolding/name_normalizer_spec.rb +3 -2
  183. data/spec/scaffolding/scaffold_project_detector_spec.rb +4 -43
  184. data/spec/system/selenium_spec.rb +1 -5
  185. data/spec/system/support/system_test_helper.rb +2 -5
  186. data/spec/utilities/headless_config_spec.rb +0 -7
  187. data/spec/utilities/utilities_spec.rb +24 -0
  188. metadata +113 -48
  189. data/lib/generators/automation/templates/header.tt +0 -9
  190. data/lib/generators/cucumber/cucumber_generator.rb +0 -58
  191. data/lib/generators/cucumber/templates/accessibility_feature.tt +0 -5
  192. data/lib/generators/cucumber/templates/accessibility_steps.tt +0 -17
  193. data/lib/generators/cucumber/templates/cucumber.tt +0 -1
  194. data/lib/generators/cucumber/templates/env.tt +0 -7
  195. data/lib/generators/cucumber/templates/feature.tt +0 -21
  196. data/lib/generators/cucumber/templates/partials/appium_env.tt +0 -26
  197. data/lib/generators/cucumber/templates/partials/driver_world.tt +0 -18
  198. data/lib/generators/cucumber/templates/partials/mobile_steps.tt +0 -20
  199. data/lib/generators/cucumber/templates/partials/selenium_env.tt +0 -120
  200. data/lib/generators/cucumber/templates/partials/watir_env.tt +0 -48
  201. data/lib/generators/cucumber/templates/partials/watir_world.tt +0 -4
  202. data/lib/generators/cucumber/templates/partials/web_steps.tt +0 -28
  203. data/lib/generators/cucumber/templates/steps.tt +0 -5
  204. data/lib/generators/cucumber/templates/user_factory.tt +0 -15
  205. data/lib/generators/cucumber/templates/world.tt +0 -7
  206. data/lib/generators/templates/helpers/browser_helper.tt +0 -31
  207. data/lib/generators/templates/helpers/raider_element.tt +0 -159
  208. data/lib/generators/templates/helpers/wait_helper.tt +0 -611
  209. data/lib/scaffolding/templates/feature.tt +0 -6
  210. data/lib/scaffolding/templates/steps.tt +0 -19
  211. data/sig/generators/cucumber/cucumber_generator.rbs +0 -12
  212. data/spec/fixtures/watir_master/cucumber_watir/Readme.md.snapshot +0 -175
  213. data/spec/fixtures/watir_master/cucumber_watir/features/step_definitions/login_steps.rb.snapshot +0 -24
  214. data/spec/fixtures/watir_master/cucumber_watir/page_objects/abstract/page.rb.snapshot +0 -37
  215. data/spec/fixtures/watir_master/cucumber_watir/page_objects/pages/login.rb.snapshot +0 -33
  216. data/spec/fixtures/watir_master/rspec_watir/Readme.md.snapshot +0 -174
  217. data/spec/fixtures/watir_master/rspec_watir/page_objects/abstract/page.rb.snapshot +0 -37
  218. data/spec/fixtures/watir_master/rspec_watir/page_objects/pages/login.rb.snapshot +0 -33
  219. data/spec/fixtures/watir_master/rspec_watir/spec/login_page_spec.rb.snapshot +0 -49
  220. data/spec/integration/content/cucumber_reporter_content_spec.rb +0 -161
  221. data/spec/integration/generators/cucumber_generator_spec.rb +0 -100
  222. data/spec/integration/helpers/wait_helper_mobile_spec.rb +0 -281
  223. data/spec/integration/helpers/wait_helper_spec.rb +0 -679
  224. data/spec/integration/helpers/wait_helper_support.rb +0 -183
  225. data/spec/system/watir_spec.rb +0 -38
@@ -17,8 +17,8 @@ describe AutomationGenerator do
17
17
  expect(File).to exist("#{name}/page_objects/abstract/component.rb")
18
18
  end
19
19
 
20
- it 'creates a component file' do
21
- expect(File).to exist("#{name}/page_objects/components/header.rb")
20
+ it 'creates no header component' do
21
+ expect(File).not_to exist("#{name}/page_objects/components/header.rb")
22
22
  end
23
23
  end
24
24
 
@@ -40,18 +40,6 @@ describe AutomationGenerator do
40
40
  include_examples 'creates web automation framework', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
41
41
  end
42
42
 
43
- context 'with rspec and watir' do
44
- include_examples 'creates web automation framework', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
45
- end
46
-
47
- context 'with cucumber and selenium' do
48
- include_examples 'creates web automation framework', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
49
- end
50
-
51
- context 'with cucumber and watir' do
52
- include_examples 'creates web automation framework', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
53
- end
54
-
55
43
  context 'with rspec and appium android' do
56
44
  include_examples 'creates mobile automation framework', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
57
45
  end
@@ -60,20 +48,8 @@ describe AutomationGenerator do
60
48
  include_examples 'creates mobile automation framework', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
61
49
  end
62
50
 
63
- context 'with cucumber and appium android' do
64
- include_examples 'creates mobile automation framework', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
65
- end
66
-
67
- context 'with cucumber and appium ios' do
68
- include_examples 'creates mobile automation framework', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
69
- end
70
-
71
- context 'with cucumber and appium cross platform' do
72
- include_examples 'creates mobile automation framework', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
73
- end
74
-
75
51
  describe 'without example tests' do
76
- %w[rspec cucumber].product(%w[selenium ios cross_platform]).each do |framework, automation|
52
+ %w[rspec].product(%w[selenium ios cross_platform]).each do |framework, automation|
77
53
  context "with #{framework} and #{automation}" do
78
54
  let(:name) { ensure_project(framework:, automation:, examples: false) }
79
55
 
@@ -110,15 +86,5 @@ describe AutomationGenerator do
110
86
  expect(Dir.children("#{name}/page_objects/components")).to eq(['.keep'])
111
87
  end
112
88
  end
113
-
114
- context 'with watir' do
115
- it 'still creates the examples, because the Watir templates are frozen' do
116
- InvokeGenerators.generate_framework(framework: 'rspec', automation: 'watir', name: 'skeleton_watir',
117
- examples: false)
118
- expect(File).to exist('skeleton_watir/page_objects/pages/login.rb')
119
- ensure
120
- FileUtils.rm_rf('skeleton_watir')
121
- end
122
- end
123
89
  end
124
90
  end
@@ -11,8 +11,8 @@ describe 'Axe accessibility addon generation' do
11
11
  # rubocop:disable RSpec/BeforeAfterAll, RSpec/InstanceVariable
12
12
  before(:all) do
13
13
  @axe_projects = []
14
- %w[rspec cucumber].each do |framework|
15
- %w[selenium watir].each do |automation|
14
+ %w[rspec].each do |framework|
15
+ %w[selenium].each do |automation|
16
16
  name = "axe_#{framework}_#{automation}"
17
17
  @axe_projects << name
18
18
  InvokeGenerators.generate_framework(
@@ -45,39 +45,6 @@ describe 'Axe accessibility addon generation' do
45
45
  end
46
46
  end
47
47
 
48
- context 'with cucumber and selenium' do
49
- let(:name) { 'axe_cucumber_selenium' }
50
-
51
- it 'creates accessibility.feature' do
52
- expect(File).to exist("#{name}/features/accessibility.feature")
53
- end
54
-
55
- it 'creates accessibility_steps.rb' do
56
- expect(File).to exist("#{name}/features/step_definitions/accessibility_steps.rb")
57
- end
58
-
59
- it 'includes axe gems in Gemfile' do
60
- gemfile = File.read("#{name}/Gemfile")
61
- expect(gemfile).to include('axe')
62
- end
63
- end
64
-
65
- context 'with rspec and watir' do
66
- let(:name) { 'axe_rspec_watir' }
67
-
68
- it 'creates accessibility_spec.rb' do
69
- expect(File).to exist("#{name}/spec/accessibility_spec.rb")
70
- end
71
- end
72
-
73
- context 'with cucumber and watir' do
74
- let(:name) { 'axe_cucumber_watir' }
75
-
76
- it 'creates accessibility.feature' do
77
- expect(File).to exist("#{name}/features/accessibility.feature")
78
- end
79
- end
80
-
81
48
  context 'without accessibility flag' do
82
49
  let(:name) { 'no_axe_rspec_selenium' }
83
50
 
@@ -8,7 +8,7 @@ require_relative '../spec_helper'
8
8
 
9
9
  describe AzureGenerator do
10
10
  mobile_notice = "Azure Pipelines template for mobile projects is not available yet; see the README.\n"
11
- web = FRAMEWORKS.product(%w[selenium watir], [false, true])
11
+ web = FRAMEWORKS.product(%w[selenium], [false, true])
12
12
  mobile = FRAMEWORKS.product(%w[ios android cross_platform])
13
13
 
14
14
  after(:all) do # rubocop:disable RSpec/BeforeAfterAll
@@ -48,24 +48,6 @@ describe CommonGenerator do
48
48
  include_examples 'creates a gitignore file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
49
49
  end
50
50
 
51
- context 'with rspec and watir' do
52
- include_examples 'creates common files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
53
- include_examples 'creates a config file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
54
- include_examples 'creates a gitignore file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
55
- end
56
-
57
- context 'with cucumber and selenium' do
58
- include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
59
- include_examples 'creates a config file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
60
- include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
61
- end
62
-
63
- context 'with cucumber and watir' do
64
- include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
65
- include_examples 'creates a config file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
66
- include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
67
- end
68
-
69
51
  context 'with rspec and appium android' do
70
52
  include_examples 'creates common files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
71
53
  include_examples 'creates a capabilities file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
@@ -80,27 +62,6 @@ describe CommonGenerator do
80
62
  include_examples 'creates a gitignore file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
81
63
  end
82
64
 
83
- context 'with cucumber and appium android' do
84
- include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
85
- include_examples 'creates a capabilities file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
86
- include_examples "doesn't create a config file", "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
87
- include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
88
- end
89
-
90
- context 'with cucumber and appium ios' do
91
- include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
92
- include_examples 'creates a capabilities file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
93
- include_examples "doesn't create a config file", "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
94
- include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
95
- end
96
-
97
- context 'with cucumber and appium cross platform' do
98
- include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
99
- include_examples 'creates a capabilities file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
100
- include_examples 'creates a config file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
101
- include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
102
- end
103
-
104
65
  context 'with rspec and appium cross platform' do
105
66
  include_examples 'creates common files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
106
67
  include_examples 'creates a capabilities file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
@@ -109,7 +70,7 @@ describe CommonGenerator do
109
70
  end
110
71
 
111
72
  describe 'without example tests' do
112
- %w[rspec cucumber].product(%w[selenium ios cross_platform]).each do |framework, automation|
73
+ %w[rspec].product(%w[selenium ios cross_platform]).each do |framework, automation|
113
74
  context "with #{framework} and #{automation}" do
114
75
  let(:name) { ensure_project(framework:, automation:, examples: false) }
115
76
  let(:ci_file) { automation == 'selenium' ? 'test_pipeline.yml' : 'appium_pipeline.yml' }
@@ -8,7 +8,7 @@ describe 'Config features for generated projects' do
8
8
  include InvokeGenerators
9
9
 
10
10
  after(:all) do # rubocop:disable RSpec/BeforeAfterAll
11
- %w[config_selenium_test config_watir_test].each do |name|
11
+ %w[config_selenium_test].each do |name|
12
12
  FileUtils.rm_rf(name)
13
13
  end
14
14
  end
@@ -51,27 +51,4 @@ describe 'Config features for generated projects' do
51
51
  expect { RubyVM::InstructionSequence.compile(helper) }.not_to raise_error
52
52
  end
53
53
  end
54
-
55
- describe 'timeout in Watir helper' do
56
- before(:all) do # rubocop:disable RSpec/BeforeAfterAll
57
- InvokeGenerators.generate_framework(
58
- automation: 'watir', framework: 'rspec', name: 'config_watir_test'
59
- )
60
- end
61
-
62
- it 'sets Watir.default_timeout from config' do
63
- helper = File.read('config_watir_test/helpers/browser_helper.rb')
64
- expect(helper).to include("Watir.default_timeout = config.fetch('timeout', 10)")
65
- end
66
-
67
- it 'generates spec_helper with viewport-aware window setup' do
68
- helper = File.read('config_watir_test/helpers/spec_helper.rb')
69
- expect(helper).to include('viewport')
70
- end
71
-
72
- it 'generates spec_helper with valid Ruby syntax' do
73
- helper = File.read('config_watir_test/helpers/spec_helper.rb')
74
- expect { RubyVM::InstructionSequence.compile(helper) }.not_to raise_error
75
- end
76
- end
77
54
  end
@@ -13,16 +13,4 @@ describe GithubGenerator do
13
13
  context 'with rspec and selenium' do
14
14
  include_examples 'generates github actions', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
15
15
  end
16
-
17
- context 'with rspec and watir' do
18
- include_examples 'generates github actions', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
19
- end
20
-
21
- context 'with cucumber and selenium' do
22
- include_examples 'generates github actions', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
23
- end
24
-
25
- context 'with cucumber and watir' do
26
- include_examples 'generates github actions', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
27
- end
28
16
  end
@@ -28,21 +28,14 @@ describe HelpersGenerator do
28
28
  end
29
29
  end
30
30
 
31
- shared_examples 'creates watir helpers' do |name|
32
- it 'creates a browser helper file' do
33
- expect(File).to exist("#{name}/helpers/browser_helper.rb")
34
- end
35
-
36
- it 'does not create the wait helper or the element wrapper' do
31
+ shared_examples 'has no wait helper' do |name|
32
+ it 'creates neither the wait helper nor the element wrapper, and no Ruby file mentions them' do
37
33
  expect(File).not_to exist("#{name}/helpers/wait_helper.rb")
38
34
  expect(File).not_to exist("#{name}/helpers/raider_element.rb")
39
- end
40
- end
41
-
42
- shared_examples 'creates the wait helper' do |name|
43
- it 'creates the wait helper and the element wrapper' do
44
- expect(File).to exist("#{name}/helpers/wait_helper.rb")
45
- expect(File).to exist("#{name}/helpers/raider_element.rb")
35
+ files = Dir.glob("#{name}/{helpers,page_objects,spec,config}/**/*.rb")
36
+ expect(files).not_to be_empty
37
+ mentions = files.select { |file| File.read(file).match?(/WaitHelper|RaiderElement/) }
38
+ expect(mentions).to eq([])
46
39
  end
47
40
  end
48
41
 
@@ -58,15 +51,33 @@ describe HelpersGenerator do
58
51
  end
59
52
  end
60
53
 
61
- shared_examples 'creates rspec helpers' do |name|
62
- it 'creates a spec helper file' do
63
- expect(File).to exist("#{name}/helpers/spec_helper.rb")
54
+ shared_examples 'creates the network helper' do |name|
55
+ it 'creates the network helper' do
56
+ expect(File).to exist("#{name}/helpers/network_helper.rb")
57
+ end
58
+ end
59
+
60
+ shared_examples 'creates the screenshot helper' do |name|
61
+ it 'creates the screenshot helper' do
62
+ expect(File).to exist("#{name}/helpers/screenshot_helper.rb")
64
63
  end
65
64
  end
66
65
 
67
- shared_examples 'creates cucumber helpers' do |name|
68
- it 'does not create a spec helper' do
69
- expect(File).not_to exist("#{name}/helpers/spec_helper.rb")
66
+ shared_examples 'skips the screenshot helper' do |name|
67
+ it 'does not create the screenshot helper' do
68
+ expect(File).not_to exist("#{name}/helpers/screenshot_helper.rb")
69
+ end
70
+ end
71
+
72
+ shared_examples 'skips the network helper' do |name|
73
+ it 'does not create the network helper' do
74
+ expect(File).not_to exist("#{name}/helpers/network_helper.rb")
75
+ end
76
+ end
77
+
78
+ shared_examples 'creates rspec helpers' do |name|
79
+ it 'creates a spec helper file' do
80
+ expect(File).to exist("#{name}/helpers/spec_helper.rb")
70
81
  end
71
82
  end
72
83
 
@@ -76,109 +87,92 @@ describe HelpersGenerator do
76
87
  end
77
88
  end
78
89
 
90
+ shared_examples 'creates the gesture helper' do |name|
91
+ it 'creates a gesture helper with swipe, scroll and scroll_to only' do
92
+ content = File.read("#{name}/helpers/gesture_helper.rb")
93
+ expect(content).to include('def swipe(').and include('def scroll(').and include('def scroll_to(')
94
+ expect(content).to include('module GestureHelper')
95
+ expect(content).not_to match(/hover|drag_and_drop/)
96
+ end
97
+ end
98
+
99
+ shared_examples 'skips the gesture helper' do |name|
100
+ it 'does not create a gesture helper' do
101
+ expect(File).not_to exist("#{name}/helpers/gesture_helper.rb")
102
+ end
103
+ end
104
+
79
105
  context 'with rspec and selenium' do
106
+ include_examples 'skips the gesture helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
80
107
  include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
81
108
  include_examples 'creates the trace helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
109
+ include_examples 'creates the network helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
110
+ include_examples 'creates the screenshot helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
82
111
  include_examples 'creates a session state helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
83
112
  include_examples 'creates selenium helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
84
- include_examples 'creates the wait helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
113
+ include_examples 'has no wait helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
85
114
  include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
86
115
  end
87
116
 
88
- context 'with rspec and watir' do
89
- include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
90
- include_examples 'skips the trace helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
91
- include_examples 'creates a session state helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
92
- include_examples 'creates watir helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
93
- include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
94
- end
95
-
96
- context 'with cucumber and selenium' do
97
- include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
98
- include_examples 'creates the trace helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
99
- include_examples 'creates a session state helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
100
- include_examples 'creates selenium helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
101
- include_examples 'creates the wait helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
102
- include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
103
- end
104
-
105
- context 'with cucumber and watir' do
106
- include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
107
- include_examples 'skips the trace helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
108
- include_examples 'creates a session state helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
109
- include_examples 'creates watir helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
110
- include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
111
- end
112
-
113
117
  context 'with rspec and appium android' do
114
118
  include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
115
119
  include_examples 'skips the trace helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
120
+ include_examples 'skips the network helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
121
+ include_examples 'skips the screenshot helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
116
122
  include_examples 'skips the session state helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
117
123
  include_examples 'creates selenium helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
118
- include_examples 'creates the wait helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
124
+ include_examples 'has no wait helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
125
+ include_examples 'creates the gesture helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
119
126
  include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
120
127
  end
121
128
 
122
129
  context 'with rspec and appium ios' do
123
130
  include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
124
131
  include_examples 'skips the trace helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
132
+ include_examples 'skips the network helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
133
+ include_examples 'skips the screenshot helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
125
134
  include_examples 'skips the session state helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
126
135
  include_examples 'creates selenium helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
127
- include_examples 'creates the wait helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
136
+ include_examples 'has no wait helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
137
+ include_examples 'creates the gesture helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
128
138
  include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
129
139
  end
130
140
 
131
- context 'with cucumber and appium android' do
132
- include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
133
- include_examples 'skips the trace helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
134
- include_examples 'skips the session state helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
135
- include_examples 'creates selenium helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
136
- include_examples 'creates the wait helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
137
- include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
138
- end
139
-
140
- context 'with cucumber and appium ios' do
141
- include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
142
- include_examples 'skips the trace helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
143
- include_examples 'skips the session state helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
144
- include_examples 'creates selenium helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
145
- include_examples 'creates the wait helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
146
- include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
147
- end
148
-
149
141
  context 'with rspec and appium cross platform' do
150
142
  include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
151
143
  include_examples 'skips the trace helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
144
+ include_examples 'skips the network helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
145
+ include_examples 'skips the screenshot helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
152
146
  include_examples 'skips the session state helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
153
147
  include_examples 'creates selenium helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
154
- include_examples 'creates the wait helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
148
+ include_examples 'has no wait helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
149
+ include_examples 'creates the gesture helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
155
150
  include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
156
151
  include_examples 'creates cross platform helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
157
152
  end
158
153
 
159
- context 'with cucumber and appium cross platform' do
160
- include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
161
- include_examples 'skips the trace helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
162
- include_examples 'skips the session state helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
163
- include_examples 'creates selenium helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
164
- include_examples 'creates the wait helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
165
- include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
166
- include_examples 'creates cross platform helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
167
- end
168
-
169
154
  describe 'without example tests' do
170
- %w[rspec cucumber].product(%w[selenium ios cross_platform]).each do |framework, automation|
155
+ %w[rspec].product(%w[selenium ios cross_platform]).each do |framework, automation|
171
156
  context "with #{framework} and #{automation}" do
172
157
  let(:name) { ensure_project(framework:, automation:, examples: false) }
173
158
 
174
- it 'creates the wait helper and RaiderElement' do
175
- expect(File).to exist("#{name}/helpers/wait_helper.rb")
176
- expect(File).to exist("#{name}/helpers/raider_element.rb")
159
+ include_examples 'has no wait helper', "#{framework}_#{automation}"
160
+
161
+ it "#{automation == 'selenium' ? 'skips' : 'creates'} the gesture helper" do
162
+ expect(File.exist?("#{name}/helpers/gesture_helper.rb")).to eq(automation != 'selenium')
177
163
  end
178
164
 
179
165
  it "#{automation == 'selenium' ? 'creates' : 'skips'} the trace helper" do
180
166
  expect(File.exist?("#{name}/helpers/trace_helper.rb")).to eq(automation == 'selenium')
181
167
  end
168
+
169
+ it "#{automation == 'selenium' ? 'creates' : 'skips'} the network helper" do
170
+ expect(File.exist?("#{name}/helpers/network_helper.rb")).to eq(automation == 'selenium')
171
+ end
172
+
173
+ it "#{automation == 'selenium' ? 'creates' : 'skips'} the screenshot helper" do
174
+ expect(File.exist?("#{name}/helpers/screenshot_helper.rb")).to eq(automation == 'selenium')
175
+ end
182
176
  end
183
177
  end
184
178
 
@@ -9,13 +9,13 @@ describe InvokeGenerators do
9
9
  after { FileUtils.rm_rf(Dir.glob('case_*')) }
10
10
 
11
11
  context 'with option values in a different case' do
12
- it 'accepts framework:Cucumber and automation:Selenium' do
13
- described_class.generate_framework(framework: 'Cucumber', automation: 'Selenium', name: 'case_mixed')
14
- expect(File).to exist('case_mixed/cucumber.yml')
12
+ it 'accepts framework:Rspec and automation:Selenium' do
13
+ described_class.generate_framework(framework: 'Rspec', automation: 'Selenium', name: 'case_mixed')
14
+ expect(File).to exist('case_mixed/.rspec')
15
15
  end
16
16
 
17
17
  it 'accepts upper-case values' do
18
- described_class.generate_framework(framework: 'RSPEC', automation: 'WATIR', name: 'case_upper')
18
+ described_class.generate_framework(framework: 'RSPEC', automation: 'SELENIUM', name: 'case_upper')
19
19
  expect(File).to exist('case_upper/.rspec')
20
20
  end
21
21
 
@@ -28,10 +28,10 @@ describe InvokeGenerators do
28
28
  context 'with raider new and capitalised options' do
29
29
  it 'generates the project and exits zero' do
30
30
  root = File.expand_path('../../..', __dir__)
31
- _out, status = Open3.capture2e('ruby', "#{root}/bin/raider", 'new', 'case_cli', '-p', 'framework:Cucumber',
31
+ _out, status = Open3.capture2e('ruby', "#{root}/bin/raider", 'new', 'case_cli', '-p', 'framework:Rspec',
32
32
  'automation:Selenium')
33
33
  expect(status.exitstatus).to eq(0)
34
- expect(File).to exist('case_cli/cucumber.yml')
34
+ expect(File).to exist('case_cli/.rspec')
35
35
  end
36
36
  end
37
37
 
@@ -59,41 +59,58 @@ describe InvokeGenerators do
59
59
  it 'keeps the examples by default' do
60
60
  expect(described_class.collect_flags(automation: 'selenium')).not_to include('no_examples')
61
61
  end
62
+ end
63
+
64
+ context 'with an unsupported automation' do
65
+ it 'lists the supported automations only' do
66
+ expect(described_class::AUTOMATIONS).to eq(%w[selenium ios android cross_platform])
67
+ end
62
68
 
63
- it 'keeps the examples for watir, whose templates are frozen' do
64
- expect(described_class.collect_flags(automation: 'watir', examples: false)).not_to include('no_examples')
69
+ it 'raises the Invalid automation error and writes nothing' do
70
+ expect { described_class.generate_framework(framework: 'rspec', automation: 'watir', name: 'case_watir') }
71
+ .to raise_error(Thor::Error, 'Invalid automation "watir". Allowed values: selenium, ios, android, cross_platform')
72
+ expect(File).not_to exist('case_watir')
65
73
  end
66
74
  end
67
75
 
68
- context 'with the Watir deprecation notice' do
69
- let(:notice) do
70
- 'Watir is deprecated and will be removed in the next major version of ruby_raider; new projects should use Selenium.'
76
+ context 'with the RSpec-only framework choice' do
77
+ it 'lists rspec as the only framework' do
78
+ expect(described_class::FRAMEWORKS).to eq(%w[rspec])
71
79
  end
72
80
 
73
- it 'prints it for watir' do
74
- expect { described_class.generate_framework(framework: 'rspec', automation: 'watir', name: 'case_dep') }
75
- .to output(/#{Regexp.escape(notice)}/).to_stdout
81
+ it 'rejects framework minitest with the allowed values' do
82
+ expect { described_class.generate_framework(framework: 'minitest', automation: 'selenium', name: 'case_min') }
83
+ .to raise_error(Thor::Error, 'Invalid framework "minitest". Allowed values: rspec')
76
84
  end
77
85
 
78
- it 'does not print it for selenium' do
79
- expect { described_class.generate_framework(framework: 'rspec', automation: 'selenium', name: 'case_nodep') }
80
- .not_to output(/Watir is deprecated/).to_stdout
86
+ it 'rejects framework cucumber like any unknown framework' do
87
+ expect { described_class.generate_framework(framework: 'Cucumber', automation: 'selenium', name: 'case_cuke') }
88
+ .to raise_error(Thor::Error, 'Invalid framework "cucumber". Allowed values: rspec')
89
+ expect(File).not_to exist('case_cuke')
81
90
  end
82
91
 
83
- it 'still prints it for raider new with automation:watir' do
84
- root = File.expand_path('../../..', __dir__)
85
- out, status = Open3.capture2e('ruby', "#{root}/bin/raider", 'new', 'case_cli_watir', '-p',
86
- 'framework:rspec', 'automation:watir')
87
- expect(status.success?).to be(true)
88
- expect(out).to include(notice)
89
- expect(File).to exist('case_cli_watir/.rspec')
92
+ %w[framework:cucumber framework:Cucumber].each do |arg|
93
+ it "exits 1 for raider new with #{arg} and leaves no directory" do
94
+ root = File.expand_path('../../..', __dir__)
95
+ Dir.mktmpdir do |dir|
96
+ _out, err, status = Open3.capture3('ruby', "#{root}/bin/raider", 'new', 'x', '-p', arg,
97
+ 'automation:selenium', chdir: dir)
98
+ expect(status.exitstatus).to eq(1)
99
+ expect(err).to include('Invalid framework "cucumber". Allowed values: rspec')
100
+ expect(File).not_to exist(File.join(dir, 'x'))
101
+ end
102
+ end
90
103
  end
91
- end
92
104
 
93
- context 'with examples false for watir' do
94
- it 'says the examples are kept' do
95
- expect { described_class.generate_framework(framework: 'rspec', automation: 'watir', name: 'case_watir', examples: false) }
96
- .to output(/Watir projects always include the example tests/).to_stdout
105
+ it 'defaults to rspec when no framework is given' do
106
+ root = File.expand_path('../../..', __dir__)
107
+ Dir.mktmpdir do |dir|
108
+ _out, _err, status = Open3.capture3('ruby', "#{root}/bin/raider", 'new', 'x', '-p',
109
+ 'automation:selenium', chdir: dir)
110
+ expect(status.exitstatus).to eq(0)
111
+ expect(File).to exist(File.join(dir, 'x/spec'))
112
+ expect(File).not_to exist(File.join(dir, 'x/features'))
113
+ end
97
114
  end
98
115
  end
99
116
  end
@@ -107,30 +124,22 @@ describe 'Projects named like a generator option' do
107
124
  expect(File).to exist('no_examples/page_objects/pages/login.rb')
108
125
  end
109
126
 
110
- it 'gives a Selenium project named watir the wait helper it wires in' do
111
- InvokeGenerators.generate_framework(automation: 'selenium', framework: 'cucumber', name: 'watir')
112
- expect(File).to exist('watir/helpers/wait_helper.rb')
113
- expect(File.read('watir/features/support/env.rb')).not_to include('Watir')
114
- expect(File.read('watir/page_objects/abstract/page.rb')).to include('include WaitHelper')
115
- end
116
-
117
- it 'keeps a Watir project named selenium on Watir' do
118
- InvokeGenerators.generate_framework(automation: 'watir', framework: 'rspec', name: 'selenium')
119
- expect(File).not_to exist('selenium/helpers/wait_helper.rb')
120
- expect(File.read('selenium/page_objects/abstract/page.rb')).to include('browser.element')
121
- expect(File.read('selenium/page_objects/abstract/page.rb')).not_to include('find_element')
127
+ it 'gives a Selenium project named watir the runtime helpers and no wait helper' do
128
+ InvokeGenerators.generate_framework(automation: 'selenium', framework: 'rspec', name: 'watir')
129
+ expect(File).not_to exist('watir/helpers/wait_helper.rb')
130
+ expect(File.read('watir/helpers/spec_helper.rb')).not_to include('Watir')
131
+ expect(File.read('watir/page_objects/abstract/page.rb')).to include('include Raider::Helpers')
122
132
  end
123
133
  end
124
134
 
125
135
  describe 'Option-named projects generate what a neutral name generates' do
126
- option_names = %w[ios android cucumber rspec cross_platform axe_addon selenium watir no_examples azure]
136
+ option_names = %w[ios android rspec cross_platform axe_addon selenium watir no_examples azure]
127
137
  option_sets = [
128
138
  { automation: 'selenium', framework: 'rspec' },
129
- { automation: 'selenium', framework: 'cucumber', accessibility: true },
139
+ { automation: 'selenium', framework: 'rspec', accessibility: true },
130
140
  { automation: 'selenium', framework: 'rspec', examples: false, ci: 'azure' },
131
- { automation: 'watir', framework: 'cucumber' },
132
141
  { automation: 'ios', framework: 'rspec' },
133
- { automation: 'android', framework: 'cucumber' },
142
+ { automation: 'android', framework: 'rspec' },
134
143
  { automation: 'cross_platform', framework: 'rspec' }
135
144
  ].freeze
136
145
 
@@ -26,12 +26,6 @@ describe RspecGenerator do
26
26
  "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}", 'login'
27
27
  end
28
28
 
29
- context 'with rspec and watir' do
30
- include_examples 'creates factory files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
31
- include_examples 'creates rspec files examples',
32
- "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}", 'login'
33
- end
34
-
35
29
  context 'with rspec and appium android' do
36
30
  include_examples 'creates rspec files examples',
37
31
  "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}", 'pdp'