ruby_raider 1.1.4 → 3.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 (278) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/e2e_tests.yml +58 -0
  3. data/.github/workflows/integration.yml +4 -6
  4. data/.github/workflows/reek.yml +6 -5
  5. data/.github/workflows/release.yml +175 -0
  6. data/.github/workflows/rubocop.yml +7 -6
  7. data/.github/workflows/steep.yml +21 -0
  8. data/.github/workflows/system_tests.yml +83 -0
  9. data/.gitignore +1 -1
  10. data/.reek.yml +46 -4
  11. data/.rubocop.yml +24 -0
  12. data/.ruby-version +1 -1
  13. data/README.md +140 -77
  14. data/RELEASE.md +412 -0
  15. data/RELEASE_QUICK_GUIDE.md +77 -0
  16. data/Steepfile +22 -0
  17. data/assets/ruby_raider_logo.svg +51 -0
  18. data/bin/release +186 -0
  19. data/lib/adopter/adopt_menu.rb +146 -0
  20. data/lib/adopter/converters/base_converter.rb +84 -0
  21. data/lib/adopter/converters/identity_converter.rb +53 -0
  22. data/lib/adopter/migration_plan.rb +74 -0
  23. data/lib/adopter/migrator.rb +96 -0
  24. data/lib/adopter/plan_builder.rb +275 -0
  25. data/lib/adopter/project_analyzer.rb +252 -0
  26. data/lib/adopter/project_detector.rb +157 -0
  27. data/lib/commands/adopt_commands.rb +42 -0
  28. data/lib/commands/plugin_commands.rb +0 -2
  29. data/lib/commands/scaffolding_commands.rb +220 -37
  30. data/lib/commands/utility_commands.rb +82 -2
  31. data/lib/generators/automation/automation_generator.rb +0 -7
  32. data/lib/generators/automation/templates/account.tt +9 -5
  33. data/lib/generators/automation/templates/appium_caps.tt +60 -6
  34. data/lib/generators/automation/templates/home.tt +4 -4
  35. data/lib/generators/automation/templates/login.tt +61 -4
  36. data/lib/generators/automation/templates/page.tt +13 -7
  37. data/lib/generators/automation/templates/partials/element.tt +1 -1
  38. data/lib/generators/automation/templates/partials/home_page_selector.tt +4 -4
  39. data/lib/generators/automation/templates/partials/initialize_selector.tt +3 -8
  40. data/lib/generators/automation/templates/partials/pdp_page_selector.tt +4 -4
  41. data/lib/generators/automation/templates/partials/url_methods.tt +0 -1
  42. data/lib/generators/automation/templates/partials/visit_method.tt +11 -1
  43. data/lib/generators/automation/templates/pdp.tt +1 -1
  44. data/lib/generators/common_generator.rb +12 -0
  45. data/lib/generators/cucumber/cucumber_generator.rb +36 -0
  46. data/lib/generators/cucumber/templates/accessibility_feature.tt +5 -0
  47. data/lib/generators/cucumber/templates/accessibility_steps.tt +21 -0
  48. data/lib/generators/cucumber/templates/cucumber.tt +8 -1
  49. data/lib/generators/cucumber/templates/env.tt +6 -4
  50. data/lib/generators/cucumber/templates/feature.tt +0 -4
  51. data/lib/generators/cucumber/templates/partials/appium_env.tt +5 -0
  52. data/lib/generators/cucumber/templates/partials/capybara_env.tt +38 -0
  53. data/lib/generators/cucumber/templates/partials/capybara_world.tt +6 -0
  54. data/lib/generators/cucumber/templates/partials/driver_world.tt +1 -4
  55. data/lib/generators/cucumber/templates/partials/mobile_steps.tt +2 -2
  56. data/lib/generators/cucumber/templates/partials/selenium_env.tt +22 -35
  57. data/lib/generators/cucumber/templates/partials/watir_env.tt +20 -1
  58. data/lib/generators/cucumber/templates/partials/web_steps.tt +10 -15
  59. data/lib/generators/cucumber/templates/performance_feature.tt +5 -0
  60. data/lib/generators/cucumber/templates/performance_steps.tt +17 -0
  61. data/lib/generators/cucumber/templates/steps.tt +2 -2
  62. data/lib/generators/cucumber/templates/visual_feature.tt +5 -0
  63. data/lib/generators/cucumber/templates/visual_steps.tt +19 -0
  64. data/lib/generators/cucumber/templates/world.tt +5 -3
  65. data/lib/generators/generator.rb +50 -7
  66. data/lib/generators/helper_generator.rb +39 -9
  67. data/lib/generators/infrastructure/github_generator.rb +6 -0
  68. data/lib/generators/infrastructure/templates/github.tt +12 -8
  69. data/lib/generators/infrastructure/templates/github_appium.tt +108 -0
  70. data/lib/generators/infrastructure/templates/gitlab.tt +6 -3
  71. data/lib/generators/invoke_generators.rb +43 -9
  72. data/lib/generators/menu_generator.rb +122 -11
  73. data/lib/generators/minitest/minitest_generator.rb +35 -0
  74. data/lib/generators/minitest/templates/accessibility_test.tt +26 -0
  75. data/lib/generators/minitest/templates/performance_test.tt +18 -0
  76. data/lib/generators/minitest/templates/test.tt +64 -0
  77. data/lib/generators/minitest/templates/visual_test.tt +23 -0
  78. data/lib/generators/rspec/rspec_generator.rb +16 -4
  79. data/lib/generators/rspec/templates/accessibility_spec.tt +25 -0
  80. data/lib/generators/rspec/templates/performance_spec.tt +18 -0
  81. data/lib/generators/rspec/templates/spec.tt +13 -41
  82. data/lib/generators/rspec/templates/visual_spec.tt +20 -0
  83. data/lib/generators/template_renderer/partial_cache.rb +126 -0
  84. data/lib/generators/template_renderer/partial_resolver.rb +110 -0
  85. data/lib/generators/template_renderer/template_error.rb +50 -0
  86. data/lib/generators/template_renderer.rb +106 -0
  87. data/lib/generators/templates/common/config.tt +2 -2
  88. data/lib/generators/templates/common/gemfile.tt +36 -9
  89. data/lib/generators/templates/common/git_ignore.tt +6 -1
  90. data/lib/generators/templates/common/partials/mobile_config.tt +5 -1
  91. data/lib/generators/templates/common/partials/web_config.tt +17 -8
  92. data/lib/generators/templates/common/rakefile.tt +36 -0
  93. data/lib/generators/templates/common/read_me.tt +43 -91
  94. data/lib/generators/templates/common/rspec.tt +3 -0
  95. data/lib/generators/templates/common/ruby_version.tt +1 -0
  96. data/lib/generators/templates/helpers/allure_helper.tt +13 -2
  97. data/lib/generators/templates/helpers/browser_helper.tt +13 -2
  98. data/lib/generators/templates/helpers/capybara_helper.tt +32 -0
  99. data/lib/generators/templates/helpers/debug_helper.tt +190 -0
  100. data/lib/generators/templates/helpers/driver_helper.tt +3 -11
  101. data/lib/generators/templates/helpers/partials/allure_imports.tt +3 -1
  102. data/lib/generators/templates/helpers/partials/allure_requirements.tt +3 -1
  103. data/lib/generators/templates/helpers/partials/appium_driver.tt +44 -0
  104. data/lib/generators/templates/helpers/partials/browserstack_config.tt +13 -0
  105. data/lib/generators/templates/helpers/partials/debug_diagnostics.tt +7 -0
  106. data/lib/generators/templates/helpers/partials/debug_start.tt +7 -0
  107. data/lib/generators/templates/helpers/partials/driver_and_options.tt +5 -115
  108. data/lib/generators/templates/helpers/partials/quit_driver.tt +3 -1
  109. data/lib/generators/templates/helpers/partials/screenshot.tt +3 -1
  110. data/lib/generators/templates/helpers/partials/selenium_driver.tt +26 -0
  111. data/lib/generators/templates/helpers/partials/video_start.tt +9 -0
  112. data/lib/generators/templates/helpers/partials/video_stop.tt +4 -0
  113. data/lib/generators/templates/helpers/performance_helper.tt +57 -0
  114. data/lib/generators/templates/helpers/spec_helper.tt +72 -10
  115. data/lib/generators/templates/helpers/test_helper.tt +94 -0
  116. data/lib/generators/templates/helpers/video_helper.tt +270 -0
  117. data/lib/generators/templates/helpers/visual_helper.tt +39 -46
  118. data/lib/llm/client.rb +79 -0
  119. data/lib/llm/config.rb +57 -0
  120. data/lib/llm/prompts.rb +84 -0
  121. data/lib/llm/provider.rb +27 -0
  122. data/lib/llm/providers/anthropic_provider.rb +43 -0
  123. data/lib/llm/providers/ollama_provider.rb +56 -0
  124. data/lib/llm/providers/openai_provider.rb +42 -0
  125. data/lib/llm/response_parser.rb +67 -0
  126. data/lib/plugin/plugin.rb +22 -20
  127. data/lib/plugin/plugin_exposer.rb +16 -38
  128. data/lib/ruby_raider.rb +51 -11
  129. data/lib/scaffolding/crud_generator.rb +94 -0
  130. data/lib/scaffolding/dry_run_presenter.rb +16 -0
  131. data/lib/scaffolding/name_normalizer.rb +63 -0
  132. data/lib/scaffolding/page_introspector.rb +45 -0
  133. data/lib/scaffolding/project_detector.rb +72 -0
  134. data/lib/scaffolding/scaffold_menu.rb +103 -0
  135. data/lib/scaffolding/scaffolding.rb +158 -11
  136. data/lib/scaffolding/templates/component.tt +30 -0
  137. data/lib/scaffolding/templates/feature.tt +4 -4
  138. data/lib/scaffolding/templates/helper.tt +15 -1
  139. data/lib/scaffolding/templates/page_from_url.tt +75 -0
  140. data/lib/scaffolding/templates/page_object.tt +50 -1
  141. data/lib/scaffolding/templates/spec.tt +33 -2
  142. data/lib/scaffolding/templates/spec_from_page.tt +31 -0
  143. data/lib/scaffolding/templates/spec_from_url.tt +46 -0
  144. data/lib/scaffolding/templates/steps.tt +17 -5
  145. data/lib/scaffolding/url_analyzer.rb +179 -0
  146. data/lib/utilities/desktop_downloader.rb +177 -0
  147. data/lib/utilities/logo.rb +83 -0
  148. data/lib/utilities/utilities.rb +53 -20
  149. data/lib/version +1 -1
  150. data/ruby_raider.gemspec +1 -0
  151. data/sig/adopter/adopt_menu.rbs +25 -0
  152. data/sig/adopter/converters/base_converter.rbs +23 -0
  153. data/sig/adopter/converters/identity_converter.rbs +16 -0
  154. data/sig/adopter/migration_plan.rbs +34 -0
  155. data/sig/adopter/migrator.rbs +21 -0
  156. data/sig/adopter/plan_builder.rbs +38 -0
  157. data/sig/adopter/project_analyzer.rbs +39 -0
  158. data/sig/adopter/project_detector.rbs +26 -0
  159. data/sig/commands/adopt_commands.rbs +8 -0
  160. data/sig/commands/loaded_commands.rbs +5 -0
  161. data/sig/commands/plugin_commands.rbs +9 -0
  162. data/sig/commands/scaffolding_commands.rbs +28 -0
  163. data/sig/commands/utility_commands.rbs +21 -0
  164. data/sig/generators/automation/automation_generator.rbs +20 -0
  165. data/sig/generators/common_generator.rbs +12 -0
  166. data/sig/generators/cucumber/cucumber_generator.rbs +16 -0
  167. data/sig/generators/generator.rbs +40 -0
  168. data/sig/generators/helper_generator.rbs +18 -0
  169. data/sig/generators/infrastructure/github_generator.rbs +5 -0
  170. data/sig/generators/infrastructure/gitlab_generator.rbs +4 -0
  171. data/sig/generators/invoke_generators.rbs +10 -0
  172. data/sig/generators/menu_generator.rbs +29 -0
  173. data/sig/generators/minitest/minitest_generator.rbs +8 -0
  174. data/sig/generators/rspec/rspec_generator.rbs +8 -0
  175. data/sig/generators/template_renderer/partial_cache.rbs +20 -0
  176. data/sig/generators/template_renderer/partial_resolver.rbs +20 -0
  177. data/sig/generators/template_renderer/template_error.rbs +19 -0
  178. data/sig/generators/template_renderer.rbs +10 -0
  179. data/sig/llm/client.rbs +15 -0
  180. data/sig/llm/config.rbs +20 -0
  181. data/sig/llm/prompts.rbs +8 -0
  182. data/sig/llm/provider.rbs +12 -0
  183. data/sig/llm/providers/anthropic_provider.rbs +16 -0
  184. data/sig/llm/providers/ollama_provider.rbs +18 -0
  185. data/sig/llm/providers/openai_provider.rbs +16 -0
  186. data/sig/llm/response_parser.rbs +13 -0
  187. data/sig/plugin/plugin.rbs +24 -0
  188. data/sig/plugin/plugin_exposer.rbs +20 -0
  189. data/sig/ruby_raider.rbs +15 -0
  190. data/sig/scaffolding/crud_generator.rbs +16 -0
  191. data/sig/scaffolding/dry_run_presenter.rbs +4 -0
  192. data/sig/scaffolding/name_normalizer.rbs +17 -0
  193. data/sig/scaffolding/page_introspector.rbs +14 -0
  194. data/sig/scaffolding/project_detector.rbs +14 -0
  195. data/sig/scaffolding/scaffold_menu.rbs +18 -0
  196. data/sig/scaffolding/scaffolding.rbs +55 -0
  197. data/sig/scaffolding/url_analyzer.rbs +28 -0
  198. data/sig/utilities/desktop_downloader.rbs +23 -0
  199. data/sig/utilities/logger.rbs +13 -0
  200. data/sig/utilities/logo.rbs +16 -0
  201. data/sig/utilities/utilities.rbs +30 -0
  202. data/sig/vendor/thor.rbs +34 -0
  203. data/sig/vendor/tty_prompt.rbs +15 -0
  204. data/spec/adopter/adopt_menu_spec.rb +176 -0
  205. data/spec/adopter/converters/identity_converter_spec.rb +145 -0
  206. data/spec/adopter/migration_plan_spec.rb +113 -0
  207. data/spec/adopter/migrator_spec.rb +277 -0
  208. data/spec/adopter/plan_builder_spec.rb +298 -0
  209. data/spec/adopter/project_analyzer_spec.rb +337 -0
  210. data/spec/adopter/project_detector_spec.rb +295 -0
  211. data/spec/commands/raider_commands_spec.rb +129 -0
  212. data/spec/generators/fixtures/templates/test.tt +1 -0
  213. data/spec/generators/fixtures/templates/test_partial.tt +1 -0
  214. data/spec/generators/generator_spec.rb +23 -0
  215. data/spec/generators/template_renderer_spec.rb +298 -0
  216. data/spec/integration/commands/scaffolding_commands_spec.rb +2 -2
  217. data/spec/integration/commands/utility_commands_spec.rb +24 -4
  218. data/spec/integration/content/ci_content_spec.rb +119 -0
  219. data/spec/integration/content/common_content_spec.rb +288 -0
  220. data/spec/integration/content/config_content_spec.rb +175 -0
  221. data/spec/integration/content/content_helper.rb +32 -0
  222. data/spec/integration/content/gemfile_content_spec.rb +209 -0
  223. data/spec/integration/content/helper_content_spec.rb +485 -0
  224. data/spec/integration/content/page_content_spec.rb +259 -0
  225. data/spec/integration/content/reporter_content_spec.rb +236 -0
  226. data/spec/integration/content/skip_flags_content_spec.rb +206 -0
  227. data/spec/integration/content/syntax_validation_spec.rb +30 -0
  228. data/spec/integration/content/test_content_spec.rb +266 -0
  229. data/spec/integration/end_to_end_features_spec.rb +690 -0
  230. data/spec/integration/end_to_end_spec.rb +361 -0
  231. data/spec/integration/generators/automation_generator_spec.rb +9 -21
  232. data/spec/integration/generators/axe_addon_spec.rb +150 -0
  233. data/spec/integration/generators/common_generator_spec.rb +48 -49
  234. data/spec/integration/generators/config_features_spec.rb +155 -0
  235. data/spec/integration/generators/cucumber_generator_spec.rb +7 -7
  236. data/spec/integration/generators/debug_helper_spec.rb +68 -0
  237. data/spec/integration/generators/github_generator_spec.rb +8 -8
  238. data/spec/integration/generators/gitlab_generator_spec.rb +8 -8
  239. data/spec/integration/generators/helpers_generator_spec.rb +70 -44
  240. data/spec/integration/generators/lighthouse_addon_spec.rb +132 -0
  241. data/spec/integration/generators/minitest_generator_spec.rb +64 -0
  242. data/spec/integration/generators/reporter_spec.rb +159 -0
  243. data/spec/integration/generators/rspec_generator_spec.rb +7 -7
  244. data/spec/integration/generators/skip_flags_spec.rb +134 -0
  245. data/spec/integration/generators/visual_addon_spec.rb +148 -0
  246. data/spec/integration/settings_helper.rb +1 -4
  247. data/spec/integration/spec_helper.rb +46 -11
  248. data/spec/llm/client_spec.rb +79 -0
  249. data/spec/llm/config_spec.rb +92 -0
  250. data/spec/llm/prompts_spec.rb +49 -0
  251. data/spec/llm/response_parser_spec.rb +92 -0
  252. data/spec/menus/adopter_adopt_menu_spec.rb +97 -0
  253. data/spec/menus/menu_generator_spec.rb +263 -0
  254. data/spec/scaffolding/name_normalizer_spec.rb +113 -0
  255. data/spec/scaffolding/page_introspector_spec.rb +82 -0
  256. data/spec/scaffolding/scaffold_project_detector_spec.rb +104 -0
  257. data/spec/scaffolding/scaffolding_features_spec.rb +311 -0
  258. data/spec/scaffolding/url_analyzer_spec.rb +110 -0
  259. data/spec/system/adopt_matrix_spec.rb +537 -0
  260. data/spec/system/adopt_spec.rb +225 -0
  261. data/spec/system/capybara_spec.rb +42 -0
  262. data/spec/system/selenium_spec.rb +19 -17
  263. data/spec/system/support/system_test_helper.rb +33 -0
  264. data/spec/system/watir_spec.rb +19 -17
  265. data/spec/utilities/desktop_downloader_spec.rb +92 -0
  266. metadata +193 -18
  267. data/.github/workflows/push_gem.yml +0 -37
  268. data/.github/workflows/selenium.yml +0 -22
  269. data/.github/workflows/watir.yml +0 -22
  270. data/lib/generators/automation/templates/partials/android_caps.tt +0 -17
  271. data/lib/generators/automation/templates/partials/cross_platform_caps.tt +0 -25
  272. data/lib/generators/automation/templates/partials/ios_caps.tt +0 -18
  273. data/lib/generators/automation/templates/partials/selenium_account.tt +0 -9
  274. data/lib/generators/automation/templates/partials/selenium_login.tt +0 -34
  275. data/lib/generators/automation/templates/partials/watir_account.tt +0 -7
  276. data/lib/generators/automation/templates/partials/watir_login.tt +0 -32
  277. data/lib/generators/automation/templates/visual_options.tt +0 -16
  278. data/lib/generators/templates/helpers/visual_spec_helper.tt +0 -35
@@ -18,6 +18,16 @@ describe CommonGenerator do
18
18
  end
19
19
  end
20
20
 
21
+ shared_examples 'creates a ruby-version file' do |name|
22
+ it 'creates a .ruby-version file' do
23
+ expect(File).to exist("#{name}/.ruby-version")
24
+ end
25
+
26
+ it 'contains the default ruby version' do
27
+ expect(File.read("#{name}/.ruby-version").strip).to eq('3.4')
28
+ end
29
+ end
30
+
21
31
  shared_examples 'creates a config file' do |name|
22
32
  it 'creates a config file' do
23
33
  expect(File).to exist("#{name}/config/config.yml")
@@ -30,12 +40,6 @@ describe CommonGenerator do
30
40
  end
31
41
  end
32
42
 
33
- shared_examples 'creates an options file' do |name|
34
- it 'creates an options file' do
35
- expect(File).to exist("#{name}/config/options.yml")
36
- end
37
- end
38
-
39
43
  shared_examples 'creates a capabilities file' do |name|
40
44
  it 'creates a capabilities file' do
41
45
  expect(File).to exist("#{name}/config/capabilities.yml")
@@ -49,75 +53,70 @@ describe CommonGenerator do
49
53
  end
50
54
 
51
55
  context 'with rspec and selenium' do
52
- include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
53
- include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
54
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
56
+ include_examples 'creates common files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
57
+ include_examples 'creates a config file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
58
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
59
+ include_examples 'creates a ruby-version file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
55
60
  end
56
61
 
57
62
  context 'with rspec and watir' do
58
- include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
59
- include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
60
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
61
- end
62
-
63
- context 'with rspec, selenium and applitools' do
64
- include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
65
- include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
66
- include_examples 'creates an options file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
67
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
63
+ include_examples 'creates common files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
64
+ include_examples 'creates a config file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
65
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
68
66
  end
69
67
 
70
68
  context 'with cucumber and selenium' do
71
- include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
72
- include_examples 'creates a config file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
73
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
69
+ include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
70
+ include_examples 'creates a config file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
71
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
72
+ include_examples 'creates a ruby-version file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
74
73
  end
75
74
 
76
75
  context 'with cucumber and watir' do
77
- include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
78
- include_examples 'creates a config file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
79
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
76
+ include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
77
+ include_examples 'creates a config file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
78
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
80
79
  end
81
80
 
82
81
  context 'with rspec and appium android' do
83
- include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
84
- include_examples 'creates a capabilities file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
85
- include_examples "doesn't create a config file", "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
86
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
82
+ include_examples 'creates common files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
83
+ include_examples 'creates a capabilities file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
84
+ include_examples "doesn't create a config file", "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
85
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
87
86
  end
88
87
 
89
88
  context 'with rspec and appium ios' do
90
- include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
91
- include_examples 'creates a capabilities file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
92
- include_examples "doesn't create a config file", "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
93
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
89
+ include_examples 'creates common files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
90
+ include_examples 'creates a capabilities file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
91
+ include_examples "doesn't create a config file", "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
92
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
94
93
  end
95
94
 
96
95
  context 'with cucumber and appium android' do
97
- include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
98
- include_examples 'creates a capabilities file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
99
- include_examples "doesn't create a config file", "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
100
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
96
+ include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
97
+ include_examples 'creates a capabilities file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
98
+ include_examples "doesn't create a config file", "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
99
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
101
100
  end
102
101
 
103
102
  context 'with cucumber and appium ios' do
104
- include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
105
- include_examples 'creates a capabilities file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
106
- include_examples "doesn't create a config file", "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
107
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
103
+ include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
104
+ include_examples 'creates a capabilities file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
105
+ include_examples "doesn't create a config file", "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
106
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
108
107
  end
109
108
 
110
109
  context 'with cucumber and appium cross platform' do
111
- include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
112
- include_examples 'creates a capabilities file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
113
- include_examples 'creates a config file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
114
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
110
+ include_examples 'creates common files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
111
+ include_examples 'creates a capabilities file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
112
+ include_examples 'creates a config file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
113
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
115
114
  end
116
115
 
117
116
  context 'with rspec and appium cross platform' do
118
- include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
119
- include_examples 'creates a capabilities file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
120
- include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
121
- include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
117
+ include_examples 'creates common files', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
118
+ include_examples 'creates a capabilities file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
119
+ include_examples 'creates a config file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
120
+ include_examples 'creates a gitignore file', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
122
121
  end
123
122
  end
@@ -0,0 +1,155 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'yaml'
5
+ require_relative '../../../lib/generators/invoke_generators'
6
+
7
+ describe 'Config features for generated projects' do
8
+ include InvokeGenerators
9
+
10
+ after(:all) do # rubocop:disable RSpec/BeforeAfterAll
11
+ %w[config_selenium_test config_capybara_test config_watir_test
12
+ reporter_json_rspec_test reporter_json_cucumber_test reporter_json_minitest_test].each do |name|
13
+ FileUtils.rm_rf(name)
14
+ end
15
+ end
16
+
17
+ describe 'timeout and viewport in config.yml' do
18
+ before(:all) do # rubocop:disable RSpec/BeforeAfterAll
19
+ InvokeGenerators.generate_framework(
20
+ automation: 'selenium', framework: 'rspec', name: 'config_selenium_test', reporter: 'none'
21
+ )
22
+ end
23
+
24
+ it 'includes timeout key with default value of 10' do
25
+ config = YAML.load_file('config_selenium_test/config/config.yml')
26
+ expect(config['timeout']).to eq 10
27
+ end
28
+
29
+ it 'includes viewport with width and height' do
30
+ config = YAML.load_file('config_selenium_test/config/config.yml')
31
+ expect(config['viewport']).to eq({ 'width' => 1920, 'height' => 1080 })
32
+ end
33
+
34
+ it 'does not include hardcoded driver_options timeouts' do
35
+ config = YAML.load_file('config_selenium_test/config/config.yml')
36
+ expect(config['driver_options']).to be_nil
37
+ end
38
+
39
+ it 'generates driver_helper with timeout from config' do
40
+ helper = File.read('config_selenium_test/helpers/driver_helper.rb')
41
+ expect(helper).to include("config.fetch('timeout', 10)")
42
+ end
43
+
44
+ it 'generates spec_helper with viewport-aware window setup' do
45
+ helper = File.read('config_selenium_test/helpers/spec_helper.rb')
46
+ expect(helper).to include('viewport')
47
+ expect(helper).to include('resize_to')
48
+ end
49
+
50
+ it 'generates spec_helper with valid Ruby syntax' do
51
+ helper = File.read('config_selenium_test/helpers/spec_helper.rb')
52
+ expect { RubyVM::InstructionSequence.compile(helper) }.not_to raise_error
53
+ end
54
+ end
55
+
56
+ describe 'timeout in Capybara helper' do
57
+ before(:all) do # rubocop:disable RSpec/BeforeAfterAll
58
+ InvokeGenerators.generate_framework(
59
+ automation: 'capybara', framework: 'rspec', name: 'config_capybara_test', reporter: 'none'
60
+ )
61
+ end
62
+
63
+ it 'reads timeout from config in capybara_helper' do
64
+ helper = File.read('config_capybara_test/helpers/capybara_helper.rb')
65
+ expect(helper).to include("config.fetch('timeout', 10)")
66
+ end
67
+
68
+ it 'generates spec_helper with viewport-aware window setup' do
69
+ helper = File.read('config_capybara_test/helpers/spec_helper.rb')
70
+ expect(helper).to include('viewport')
71
+ end
72
+
73
+ it 'generates spec_helper with valid Ruby syntax' do
74
+ helper = File.read('config_capybara_test/helpers/spec_helper.rb')
75
+ expect { RubyVM::InstructionSequence.compile(helper) }.not_to raise_error
76
+ end
77
+ end
78
+
79
+ describe 'timeout in Watir helper' do
80
+ before(:all) do # rubocop:disable RSpec/BeforeAfterAll
81
+ InvokeGenerators.generate_framework(
82
+ automation: 'watir', framework: 'rspec', name: 'config_watir_test', reporter: 'none'
83
+ )
84
+ end
85
+
86
+ it 'sets Watir.default_timeout from config' do
87
+ helper = File.read('config_watir_test/helpers/browser_helper.rb')
88
+ expect(helper).to include("Watir.default_timeout = config.fetch('timeout', 10)")
89
+ end
90
+
91
+ it 'generates spec_helper with viewport-aware window setup' do
92
+ helper = File.read('config_watir_test/helpers/spec_helper.rb')
93
+ expect(helper).to include('viewport')
94
+ end
95
+
96
+ it 'generates spec_helper with valid Ruby syntax' do
97
+ helper = File.read('config_watir_test/helpers/spec_helper.rb')
98
+ expect { RubyVM::InstructionSequence.compile(helper) }.not_to raise_error
99
+ end
100
+ end
101
+
102
+ describe 'reporter: json with RSpec' do
103
+ before(:all) do # rubocop:disable RSpec/BeforeAfterAll
104
+ InvokeGenerators.generate_framework(
105
+ automation: 'selenium', framework: 'rspec', name: 'reporter_json_rspec_test', reporter: 'json'
106
+ )
107
+ end
108
+
109
+ it 'includes json formatter in spec_helper' do
110
+ helper = File.read('reporter_json_rspec_test/helpers/spec_helper.rb')
111
+ expect(helper).to include("config.add_formatter('json', 'results/results.json')")
112
+ end
113
+
114
+ it 'does not include allure in spec_helper' do
115
+ helper = File.read('reporter_json_rspec_test/helpers/spec_helper.rb')
116
+ expect(helper).not_to include('AllureHelper')
117
+ end
118
+
119
+ it 'generates spec_helper with valid Ruby syntax' do
120
+ helper = File.read('reporter_json_rspec_test/helpers/spec_helper.rb')
121
+ expect { RubyVM::InstructionSequence.compile(helper) }.not_to raise_error
122
+ end
123
+ end
124
+
125
+ describe 'reporter: json with Cucumber' do
126
+ before(:all) do # rubocop:disable RSpec/BeforeAfterAll
127
+ InvokeGenerators.generate_framework(
128
+ automation: 'selenium', framework: 'cucumber', name: 'reporter_json_cucumber_test', reporter: 'json'
129
+ )
130
+ end
131
+
132
+ it 'includes json profile in cucumber.yml' do
133
+ cucumber_yml = File.read('reporter_json_cucumber_test/cucumber.yml')
134
+ expect(cucumber_yml).to include('--format json --out results/results.json')
135
+ end
136
+ end
137
+
138
+ describe 'reporter: json with Minitest' do
139
+ before(:all) do # rubocop:disable RSpec/BeforeAfterAll
140
+ InvokeGenerators.generate_framework(
141
+ automation: 'selenium', framework: 'minitest', name: 'reporter_json_minitest_test', reporter: 'json'
142
+ )
143
+ end
144
+
145
+ it 'includes JsonReporter in test_helper' do
146
+ helper = File.read('reporter_json_minitest_test/helpers/test_helper.rb')
147
+ expect(helper).to include('Minitest::Reporters::JsonReporter')
148
+ end
149
+
150
+ it 'generates test_helper with valid Ruby syntax' do
151
+ helper = File.read('reporter_json_minitest_test/helpers/test_helper.rb')
152
+ expect { RubyVM::InstructionSequence.compile(helper) }.not_to raise_error
153
+ end
154
+ end
155
+ end
@@ -41,24 +41,24 @@ describe CucumberGenerator do
41
41
  end
42
42
 
43
43
  context 'with cucumber and appium android' do
44
- include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}", 'home'
44
+ include_examples 'creates cucumber files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}", 'home'
45
45
  end
46
46
 
47
47
  context 'with cucumber and appium ios' do
48
- include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}", 'home'
48
+ include_examples 'creates cucumber files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}", 'home'
49
49
  end
50
50
 
51
51
  context 'with cucumber and appium cross platform' do
52
- include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}", 'home'
52
+ include_examples 'creates cucumber files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}", 'home'
53
53
  end
54
54
 
55
55
  context 'with cucumber and selenium' do
56
- include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}", 'login'
57
- include_examples 'creates factories for web projects', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}", 'login'
56
+ include_examples 'creates cucumber files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}", 'login'
57
+ include_examples 'creates factories for web projects', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}", 'login'
58
58
  end
59
59
 
60
60
  context 'with cucumber and watir' do
61
- include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}", 'login'
62
- include_examples 'creates factories for web projects', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}", 'login'
61
+ include_examples 'creates cucumber files', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}", 'login'
62
+ include_examples 'creates factories for web projects', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}", 'login'
63
63
  end
64
64
  end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../lib/generators/helper_generator'
4
+ require_relative '../spec_helper'
5
+
6
+ describe 'Debug helper generation' do
7
+ shared_examples 'creates debug helper' do |name|
8
+ it 'creates a debug_helper.rb file' do
9
+ expect(File).to exist("#{name}/helpers/debug_helper.rb")
10
+ end
11
+ end
12
+
13
+ shared_examples 'does not create debug helper' do |name|
14
+ it 'does not create a debug_helper.rb file' do
15
+ expect(File).not_to exist("#{name}/helpers/debug_helper.rb")
16
+ end
17
+ end
18
+
19
+ # Web frameworks should get debug_helper
20
+ context 'with rspec and selenium' do
21
+ include_examples 'creates debug helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
22
+ end
23
+
24
+ context 'with rspec and watir' do
25
+ include_examples 'creates debug helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
26
+ end
27
+
28
+ context 'with rspec and capybara' do
29
+ include_examples 'creates debug helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CAPYBARA}"
30
+ end
31
+
32
+ context 'with cucumber and selenium' do
33
+ include_examples 'creates debug helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
34
+ end
35
+
36
+ context 'with cucumber and watir' do
37
+ include_examples 'creates debug helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
38
+ end
39
+
40
+ context 'with cucumber and capybara' do
41
+ include_examples 'creates debug helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CAPYBARA}"
42
+ end
43
+
44
+ context 'with minitest and selenium' do
45
+ include_examples 'creates debug helper', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::SELENIUM}"
46
+ end
47
+
48
+ context 'with minitest and watir' do
49
+ include_examples 'creates debug helper', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::WATIR}"
50
+ end
51
+
52
+ context 'with minitest and capybara' do
53
+ include_examples 'creates debug helper', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::CAPYBARA}"
54
+ end
55
+
56
+ # Mobile frameworks should NOT get debug_helper
57
+ context 'with rspec and appium android' do
58
+ include_examples 'does not create debug helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
59
+ end
60
+
61
+ context 'with rspec and appium ios' do
62
+ include_examples 'does not create debug helper', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
63
+ end
64
+
65
+ context 'with cucumber and appium cross platform' do
66
+ include_examples 'does not create debug helper', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
67
+ end
68
+ end
@@ -17,22 +17,22 @@ describe GithubGenerator do
17
17
  end
18
18
 
19
19
  context 'with rspec and selenium' do
20
- include_examples 'selects github as an infrastructure option', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_#{CI_PLATFORMS[1]}"
21
- include_examples 'does not select any infrastructure option', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
20
+ include_examples 'selects github as an infrastructure option', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}_#{CI_PLATFORMS[1]}"
21
+ include_examples 'does not select any infrastructure option', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
22
22
  end
23
23
 
24
24
  context 'with rspec and watir' do
25
- include_examples 'selects github as an infrastructure option', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_#{CI_PLATFORMS[1]}"
26
- include_examples 'does not select any infrastructure option', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
25
+ include_examples 'selects github as an infrastructure option', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}_#{CI_PLATFORMS[1]}"
26
+ include_examples 'does not select any infrastructure option', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
27
27
  end
28
28
 
29
29
  context 'with cucumber and selenium' do
30
- include_examples 'selects github as an infrastructure option', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}_#{CI_PLATFORMS[1]}"
31
- include_examples 'does not select any infrastructure option', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
30
+ include_examples 'selects github as an infrastructure option', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}_#{CI_PLATFORMS[1]}"
31
+ include_examples 'does not select any infrastructure option', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
32
32
  end
33
33
 
34
34
  context 'with cucumber and watir' do
35
- include_examples 'selects github as an infrastructure option', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}_#{CI_PLATFORMS[1]}"
36
- include_examples 'does not select any infrastructure option', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
35
+ include_examples 'selects github as an infrastructure option', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}_#{CI_PLATFORMS[1]}"
36
+ include_examples 'does not select any infrastructure option', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
37
37
  end
38
38
  end
@@ -17,22 +17,22 @@ describe GitlabGenerator do
17
17
  end
18
18
 
19
19
  context 'with rspec and selenium' do
20
- include_examples 'selects gitlab as an infrastructure option', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}_#{CI_PLATFORMS[2]}"
21
- include_examples 'does not select any infrastructure option', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
20
+ include_examples 'selects gitlab as an infrastructure option', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}_#{CI_PLATFORMS[2]}"
21
+ include_examples 'does not select any infrastructure option', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
22
22
  end
23
23
 
24
24
  context 'with rspec and watir' do
25
- include_examples 'selects gitlab as an infrastructure option', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_#{CI_PLATFORMS[2]}"
26
- include_examples 'does not select any infrastructure option', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
25
+ include_examples 'selects gitlab as an infrastructure option', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}_#{CI_PLATFORMS[2]}"
26
+ include_examples 'does not select any infrastructure option', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
27
27
  end
28
28
 
29
29
  context 'with cucumber and selenium' do
30
- include_examples 'selects gitlab as an infrastructure option', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}_#{CI_PLATFORMS[2]}"
31
- include_examples 'does not select any infrastructure option', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
30
+ include_examples 'selects gitlab as an infrastructure option', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}_#{CI_PLATFORMS[2]}"
31
+ include_examples 'does not select any infrastructure option', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
32
32
  end
33
33
 
34
34
  context 'with cucumber and watir' do
35
- include_examples 'selects gitlab as an infrastructure option', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}_#{CI_PLATFORMS[2]}"
36
- include_examples 'does not select any infrastructure option', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
35
+ include_examples 'selects gitlab as an infrastructure option', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}_#{CI_PLATFORMS[2]}"
36
+ include_examples 'does not select any infrastructure option', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
37
37
  end
38
38
  end
@@ -40,77 +40,103 @@ describe HelpersGenerator do
40
40
  end
41
41
  end
42
42
 
43
- shared_examples 'creates common visual helpers' do |name|
44
- it 'creates a visual helper file' do
45
- expect(File).to exist("#{name}/helpers/visual_helper.rb")
46
- end
47
- end
48
-
49
43
  context 'with rspec and selenium' do
50
- include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
51
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
52
- include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
44
+ include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
45
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
46
+ include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::SELENIUM}"
53
47
  end
54
48
 
55
49
  context 'with rspec and watir' do
56
- include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
57
- include_examples 'creates watir helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
58
- include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
59
- end
60
-
61
- context 'with rspec, selenium and applitools' do
62
- include_examples 'creates common visual helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
63
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
64
- include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
50
+ include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
51
+ include_examples 'creates watir helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
52
+ include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::WATIR}"
65
53
  end
66
54
 
67
55
  context 'with cucumber and selenium' do
68
- include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
69
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
70
- include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
56
+ include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
57
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
58
+ include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::SELENIUM}"
71
59
  end
72
60
 
73
61
  context 'with cucumber and watir' do
74
- include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
75
- include_examples 'creates watir helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
76
- include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
62
+ include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
63
+ include_examples 'creates watir helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
64
+ include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::WATIR}"
77
65
  end
78
66
 
79
67
  context 'with rspec and appium android' do
80
- include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
81
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
82
- include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.first}"
68
+ include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
69
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
70
+ include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::ANDROID}"
83
71
  end
84
72
 
85
73
  context 'with rspec and appium ios' do
86
- include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
87
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
88
- include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[1]}"
74
+ include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
75
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
76
+ include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
89
77
  end
90
78
 
91
79
  context 'with cucumber and appium android' do
92
- include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
93
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
94
- include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.first}"
80
+ include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
81
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
82
+ include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
95
83
  end
96
84
 
97
85
  context 'with cucumber and appium ios' do
98
- include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
99
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
100
- include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[1]}"
86
+ include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
87
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
88
+ include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::IOS}"
101
89
  end
102
90
 
103
91
  context 'with rspec and appium cross platform' do
104
- include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
105
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
106
- include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
107
- include_examples 'creates cross platform helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
92
+ include_examples 'creates common helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
93
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
94
+ include_examples 'creates rspec helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
95
+ include_examples 'creates cross platform helpers', "#{FrameworkIndex::RSPEC}_#{AutomationIndex::CROSS_PLATFORM}"
108
96
  end
109
97
 
110
98
  context 'with cucumber and appium cross platform' do
111
- include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
112
- include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
113
- include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
114
- include_examples 'creates cross platform helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
99
+ include_examples 'creates common helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
100
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
101
+ include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
102
+ include_examples 'creates cross platform helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
103
+ end
104
+
105
+ shared_examples 'creates minitest helpers' do |name|
106
+ it 'creates a test helper file' do
107
+ expect(File).to exist("#{name}/helpers/test_helper.rb")
108
+ end
109
+
110
+ it 'does not create a spec helper' do
111
+ expect(File).not_to exist("#{name}/helpers/spec_helper.rb")
112
+ end
113
+ end
114
+
115
+ shared_examples 'creates capybara helpers' do |name|
116
+ it 'creates a capybara helper file' do
117
+ expect(File).to exist("#{name}/helpers/capybara_helper.rb")
118
+ end
119
+
120
+ it 'does not create a driver helper' do
121
+ expect(File).not_to exist("#{name}/helpers/driver_helper.rb")
122
+ end
123
+ end
124
+
125
+ context 'with minitest and selenium' do
126
+ include_examples 'creates common helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::SELENIUM}"
127
+ include_examples 'creates selenium helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::SELENIUM}"
128
+ include_examples 'creates minitest helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::SELENIUM}"
129
+ end
130
+
131
+ context 'with minitest and watir' do
132
+ include_examples 'creates common helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::WATIR}"
133
+ include_examples 'creates watir helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::WATIR}"
134
+ include_examples 'creates minitest helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::WATIR}"
135
+ end
136
+
137
+ context 'with minitest and capybara' do
138
+ include_examples 'creates common helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::CAPYBARA}"
139
+ include_examples 'creates capybara helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::CAPYBARA}"
140
+ include_examples 'creates minitest helpers', "#{FrameworkIndex::MINITEST}_#{AutomationIndex::CAPYBARA}"
115
141
  end
116
142
  end