ruby_raider 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/e2e_tests.yml +0 -17
- data/.github/workflows/system_tests.yml +0 -22
- data/README.md +8 -62
- data/lib/commands/scaffolding_commands.rb +1 -192
- data/lib/commands/utility_commands.rb +0 -43
- data/lib/generators/automation/templates/login.tt +1 -9
- data/lib/generators/automation/templates/page.tt +1 -7
- data/lib/generators/automation/templates/partials/initialize_selector.tt +1 -3
- data/lib/generators/automation/templates/partials/visit_method.tt +2 -6
- data/lib/generators/common_generator.rb +0 -6
- data/lib/generators/cucumber/cucumber_generator.rb +0 -24
- data/lib/generators/cucumber/templates/accessibility_steps.tt +2 -6
- data/lib/generators/cucumber/templates/cucumber.tt +0 -7
- data/lib/generators/cucumber/templates/env.tt +1 -3
- data/lib/generators/cucumber/templates/partials/appium_env.tt +1 -6
- data/lib/generators/cucumber/templates/partials/selenium_env.tt +0 -5
- data/lib/generators/cucumber/templates/partials/watir_env.tt +0 -5
- data/lib/generators/cucumber/templates/partials/web_steps.tt +4 -4
- data/lib/generators/cucumber/templates/world.tt +1 -3
- data/lib/generators/generator.rb +2 -46
- data/lib/generators/helper_generator.rb +4 -42
- data/lib/generators/infrastructure/templates/github.tt +2 -2
- data/lib/generators/infrastructure/templates/github_appium.tt +2 -6
- data/lib/generators/invoke_generators.rb +4 -25
- data/lib/generators/menu_generator.rb +10 -100
- data/lib/generators/rspec/rspec_generator.rb +0 -11
- data/lib/generators/rspec/templates/accessibility_spec.tt +2 -6
- data/lib/generators/rspec/templates/spec.tt +6 -8
- data/lib/generators/templates/common/gemfile.tt +0 -26
- data/lib/generators/templates/common/git_ignore.tt +0 -2
- data/lib/generators/templates/common/partials/mobile_config.tt +0 -4
- data/lib/generators/templates/common/partials/web_config.tt +0 -4
- data/lib/generators/templates/common/rakefile.tt +0 -9
- data/lib/generators/templates/common/read_me.tt +4 -10
- data/lib/generators/templates/helpers/allure_helper.tt +0 -10
- data/lib/generators/templates/helpers/partials/debug_diagnostics.tt +1 -3
- data/lib/generators/templates/helpers/partials/debug_start.tt +1 -3
- data/lib/generators/templates/helpers/partials/quit_driver.tt +1 -3
- data/lib/generators/templates/helpers/partials/screenshot.tt +1 -3
- data/lib/generators/templates/helpers/spec_helper.tt +2 -39
- data/lib/ruby_raider.rb +2 -50
- data/lib/scaffolding/project_detector.rb +2 -9
- data/lib/scaffolding/scaffolding.rb +0 -109
- data/lib/scaffolding/templates/component.tt +1 -4
- data/lib/scaffolding/templates/page_object.tt +0 -10
- data/lib/scaffolding/templates/spec.tt +2 -6
- data/lib/scaffolding/templates/steps.tt +0 -2
- data/lib/utilities/utilities.rb +23 -29
- data/lib/version +1 -1
- data/sig/commands/scaffolding_commands.rbs +0 -12
- data/sig/commands/utility_commands.rbs +0 -6
- data/sig/generators/cucumber/cucumber_generator.rbs +0 -4
- data/sig/generators/generator.rbs +0 -11
- data/sig/generators/helper_generator.rbs +1 -5
- data/sig/generators/invoke_generators.rbs +1 -2
- data/sig/generators/menu_generator.rbs +2 -6
- data/sig/generators/rspec/rspec_generator.rbs +0 -2
- data/sig/ruby_raider.rbs +1 -3
- data/sig/scaffolding/project_detector.rbs +0 -1
- data/sig/scaffolding/scaffolding.rbs +0 -23
- data/sig/utilities/utilities.rbs +0 -4
- data/spec/commands/raider_commands_spec.rb +0 -61
- data/spec/integration/commands/browser_update_after_creation_spec.rb +123 -0
- data/spec/integration/commands/scaffolding_commands_spec.rb +0 -20
- data/spec/integration/commands/utility_commands_spec.rb +5 -5
- data/spec/integration/content/ci_content_spec.rb +6 -61
- data/spec/integration/content/common_content_spec.rb +0 -64
- data/spec/integration/content/config_content_spec.rb +1 -51
- data/spec/integration/content/content_helper.rb +2 -2
- data/spec/integration/content/gemfile_content_spec.rb +0 -71
- data/spec/integration/content/helper_content_spec.rb +4 -240
- data/spec/integration/content/page_content_spec.rb +0 -89
- data/spec/integration/content/syntax_validation_spec.rb +2 -2
- data/spec/integration/content/test_content_spec.rb +0 -119
- data/spec/integration/end_to_end_features_spec.rb +13 -411
- data/spec/integration/end_to_end_spec.rb +0 -96
- data/spec/integration/generators/axe_addon_spec.rb +2 -52
- data/spec/integration/generators/common_generator_spec.rb +1 -13
- data/spec/integration/generators/config_features_spec.rb +3 -81
- data/spec/integration/generators/debug_helper_spec.rb +0 -20
- data/spec/integration/generators/github_generator_spec.rb +5 -15
- data/spec/integration/generators/helpers_generator_spec.rb +0 -37
- data/spec/integration/scaffolding_e2e_spec.rb +2 -237
- data/spec/integration/settings_helper.rb +1 -3
- data/spec/integration/spec_helper.rb +6 -11
- data/spec/menus/menu_generator_spec.rb +4 -107
- data/spec/scaffolding/scaffold_project_detector_spec.rb +4 -26
- data/spec/scaffolding/scaffolding_features_spec.rb +0 -183
- data/spec/system/selenium_spec.rb +1 -4
- data/spec/system/support/system_test_helper.rb +0 -1
- data/spec/system/watir_spec.rb +1 -4
- data/spec/utilities/headless_config_spec.rb +0 -7
- metadata +3 -97
- data/lib/adopter/adopt_menu.rb +0 -146
- data/lib/adopter/converters/base_converter.rb +0 -84
- data/lib/adopter/converters/identity_converter.rb +0 -53
- data/lib/adopter/migration_plan.rb +0 -74
- data/lib/adopter/migrator.rb +0 -96
- data/lib/adopter/plan_builder.rb +0 -275
- data/lib/adopter/project_analyzer.rb +0 -252
- data/lib/adopter/project_detector.rb +0 -157
- data/lib/generators/cucumber/templates/partials/capybara_env.tt +0 -38
- data/lib/generators/cucumber/templates/partials/capybara_world.tt +0 -6
- data/lib/generators/cucumber/templates/performance_feature.tt +0 -5
- data/lib/generators/cucumber/templates/performance_steps.tt +0 -17
- data/lib/generators/cucumber/templates/visual_feature.tt +0 -5
- data/lib/generators/cucumber/templates/visual_steps.tt +0 -19
- data/lib/generators/infrastructure/gitlab_generator.rb +0 -11
- data/lib/generators/infrastructure/templates/gitlab.tt +0 -46
- data/lib/generators/minitest/minitest_generator.rb +0 -35
- data/lib/generators/minitest/templates/accessibility_test.tt +0 -26
- data/lib/generators/minitest/templates/performance_test.tt +0 -18
- data/lib/generators/minitest/templates/test.tt +0 -64
- data/lib/generators/minitest/templates/visual_test.tt +0 -23
- data/lib/generators/rspec/templates/performance_spec.tt +0 -18
- data/lib/generators/rspec/templates/visual_spec.tt +0 -20
- data/lib/generators/templates/helpers/capybara_helper.tt +0 -32
- data/lib/generators/templates/helpers/performance_helper.tt +0 -57
- data/lib/generators/templates/helpers/visual_helper.tt +0 -58
- data/lib/llm/client.rb +0 -79
- data/lib/llm/config.rb +0 -57
- data/lib/llm/prompts.rb +0 -84
- data/lib/llm/provider.rb +0 -27
- data/lib/llm/providers/anthropic_provider.rb +0 -43
- data/lib/llm/providers/ollama_provider.rb +0 -56
- data/lib/llm/providers/openai_provider.rb +0 -42
- data/lib/llm/response_parser.rb +0 -67
- data/lib/plugin/plugin.rb +0 -111
- data/lib/plugin/plugin_exposer.rb +0 -55
- data/lib/scaffolding/crud_generator.rb +0 -94
- data/lib/scaffolding/dry_run_presenter.rb +0 -16
- data/lib/scaffolding/page_introspector.rb +0 -45
- data/lib/scaffolding/scaffold_menu.rb +0 -103
- data/lib/scaffolding/templates/page_from_url.tt +0 -75
- data/lib/scaffolding/templates/spec_from_page.tt +0 -31
- data/lib/scaffolding/templates/spec_from_url.tt +0 -46
- data/lib/scaffolding/url_analyzer.rb +0 -179
- data/sig/adopter/adopt_menu.rbs +0 -25
- data/sig/adopter/converters/base_converter.rbs +0 -23
- data/sig/adopter/converters/identity_converter.rbs +0 -16
- data/sig/adopter/migration_plan.rbs +0 -34
- data/sig/adopter/migrator.rbs +0 -21
- data/sig/adopter/plan_builder.rbs +0 -38
- data/sig/adopter/project_analyzer.rbs +0 -39
- data/sig/adopter/project_detector.rbs +0 -26
- data/sig/generators/infrastructure/gitlab_generator.rbs +0 -4
- data/sig/generators/minitest/minitest_generator.rbs +0 -8
- data/sig/llm/client.rbs +0 -15
- data/sig/llm/config.rbs +0 -20
- data/sig/llm/prompts.rbs +0 -8
- data/sig/llm/provider.rbs +0 -12
- data/sig/llm/providers/anthropic_provider.rbs +0 -16
- data/sig/llm/providers/ollama_provider.rbs +0 -18
- data/sig/llm/providers/openai_provider.rbs +0 -16
- data/sig/llm/response_parser.rbs +0 -13
- data/sig/plugin/plugin.rbs +0 -24
- data/sig/plugin/plugin_exposer.rbs +0 -20
- data/sig/scaffolding/crud_generator.rbs +0 -16
- data/sig/scaffolding/dry_run_presenter.rbs +0 -4
- data/sig/scaffolding/page_introspector.rbs +0 -14
- data/sig/scaffolding/scaffold_menu.rbs +0 -18
- data/sig/scaffolding/url_analyzer.rbs +0 -28
- data/spec/adopter/adopt_menu_spec.rb +0 -176
- data/spec/adopter/converters/identity_converter_spec.rb +0 -145
- data/spec/adopter/migration_plan_spec.rb +0 -113
- data/spec/adopter/migrator_spec.rb +0 -277
- data/spec/adopter/plan_builder_spec.rb +0 -298
- data/spec/adopter/project_analyzer_spec.rb +0 -337
- data/spec/adopter/project_detector_spec.rb +0 -295
- data/spec/generators/generator_spec.rb +0 -23
- data/spec/integration/content/reporter_content_spec.rb +0 -236
- data/spec/integration/content/skip_flags_content_spec.rb +0 -206
- data/spec/integration/generators/gitlab_generator_spec.rb +0 -38
- data/spec/integration/generators/lighthouse_addon_spec.rb +0 -132
- data/spec/integration/generators/minitest_generator_spec.rb +0 -64
- data/spec/integration/generators/reporter_spec.rb +0 -159
- data/spec/integration/generators/skip_flags_spec.rb +0 -134
- data/spec/integration/generators/visual_addon_spec.rb +0 -148
- data/spec/llm/client_spec.rb +0 -79
- data/spec/llm/config_spec.rb +0 -92
- data/spec/llm/prompts_spec.rb +0 -49
- data/spec/llm/response_parser_spec.rb +0 -92
- data/spec/menus/adopter_adopt_menu_spec.rb +0 -97
- data/spec/scaffolding/page_introspector_spec.rb +0 -82
- data/spec/scaffolding/url_analyzer_spec.rb +0 -110
- data/spec/system/adopt_matrix_spec.rb +0 -537
- data/spec/system/adopt_spec.rb +0 -225
- data/spec/system/capybara_spec.rb +0 -42
|
@@ -1,37 +1,20 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
-
ruby '~> <%= ruby_version %>.0'
|
|
4
|
-
|
|
5
3
|
gem 'activesupport'
|
|
6
4
|
<% if mobile? %>
|
|
7
5
|
gem 'appium_lib'
|
|
8
6
|
gem 'appium_console'
|
|
9
7
|
<% end %>
|
|
10
|
-
<%- if allure_reporter? -%>
|
|
11
8
|
<%- if cucumber? -%>
|
|
12
9
|
gem 'allure-cucumber', '2.28.0'
|
|
13
|
-
<%- elsif minitest? -%>
|
|
14
|
-
gem 'allure-ruby-commons', '2.28.0'
|
|
15
10
|
<%- else -%>
|
|
16
11
|
gem 'allure-rspec', '2.28.0'
|
|
17
12
|
gem 'allure-ruby-commons', '2.28.0'
|
|
18
13
|
<%- end -%>
|
|
19
|
-
<%- end -%>
|
|
20
|
-
<%- if capybara? -%>
|
|
21
|
-
gem 'capybara'
|
|
22
|
-
gem 'selenium-webdriver'
|
|
23
|
-
<%- end -%>
|
|
24
14
|
<%- if axe_addon? -%>
|
|
25
|
-
<%- if minitest? -%>
|
|
26
|
-
gem 'axe-core-minitest'
|
|
27
|
-
<%- else -%>
|
|
28
15
|
gem 'axe-core-rspec'
|
|
29
|
-
<%- end -%>
|
|
30
16
|
gem 'axe-core-selenium'
|
|
31
17
|
<%- end -%>
|
|
32
|
-
<%- if visual_addon? -%>
|
|
33
|
-
gem 'chunky_png'
|
|
34
|
-
<%- end -%>
|
|
35
18
|
gem 'parallel_split_test'
|
|
36
19
|
gem 'parallel_tests'
|
|
37
20
|
gem 'rake'
|
|
@@ -39,23 +22,14 @@ gem 'reek'
|
|
|
39
22
|
<%- if rspec? -%>
|
|
40
23
|
gem 'rspec-retry'
|
|
41
24
|
<%- end -%>
|
|
42
|
-
<%- if junit_reporter? && rspec? -%>
|
|
43
|
-
gem 'rspec_junit_formatter'
|
|
44
|
-
<%- end -%>
|
|
45
25
|
gem '<%= framework %>'
|
|
46
26
|
<%- if cucumber? -%>
|
|
47
27
|
gem 'rspec'
|
|
48
28
|
<%- end -%>
|
|
49
|
-
<%- if minitest? -%>
|
|
50
|
-
gem 'minitest-reporters'
|
|
51
|
-
<%- end -%>
|
|
52
29
|
gem 'rubocop'
|
|
53
30
|
<%- if rspec? -%>
|
|
54
31
|
gem 'rubocop-rspec'
|
|
55
32
|
<%- end -%>
|
|
56
|
-
<%- if minitest? -%>
|
|
57
|
-
gem 'rubocop-minitest'
|
|
58
|
-
<%- end -%>
|
|
59
33
|
gem 'ruby_raider', '~> 1.1.0'
|
|
60
34
|
<%- if selenium_based? %>
|
|
61
35
|
gem 'selenium-webdriver'
|
|
@@ -15,10 +15,6 @@ browser_arguments:
|
|
|
15
15
|
- acceptInsecureCerts
|
|
16
16
|
- no-sandbox
|
|
17
17
|
|
|
18
|
-
video:
|
|
19
|
-
enabled: false
|
|
20
|
-
strategy: auto # auto, cdp, or screen
|
|
21
|
-
|
|
22
18
|
debug:
|
|
23
19
|
enabled: false # also toggled by DEBUG=true env var
|
|
24
20
|
console_logs: true # capture browser console logs on failure
|
|
@@ -28,13 +28,4 @@ Cucumber::Rake::Task.new(:regression) do |t|
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
task default: :features
|
|
31
|
-
<%- elsif minitest? -%>
|
|
32
|
-
|
|
33
|
-
require 'rake/testtask'
|
|
34
|
-
|
|
35
|
-
Rake::TestTask.new(:test) do |t|
|
|
36
|
-
t.test_files = FileList['test/**/test_*.rb']
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
task default: :test
|
|
40
31
|
<%- end -%>
|
|
@@ -31,16 +31,11 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
|
|
31
31
|
| RSpec and Selenium | RSpec and Appium for iOS |
|
|
32
32
|
| Cucumber and Watir | Cucumber and Appium for Android |
|
|
33
33
|
| RSpec and Watir | RSpec and Appium for Android |
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
| Minitest and Selenium | Minitest and Appium for iOS |
|
|
37
|
-
| Minitest and Watir | Minitest and Appium for Android |
|
|
38
|
-
| Minitest and Capybara | Minitest and Appium Cross-platform |
|
|
34
|
+
| | Cucumber and Appium Cross-platform |
|
|
35
|
+
| | RSpec and Appium Cross-platform |
|
|
39
36
|
|
|
40
|
-
**Optional add-
|
|
37
|
+
**Optional add-on for web projects:**
|
|
41
38
|
- **Accessibility testing (axe)**: `--accessibility` flag
|
|
42
|
-
- **Visual regression testing (chunky_png)**: `--visual` flag
|
|
43
|
-
- **Performance auditing (Lighthouse)**: `--performance` flag
|
|
44
39
|
|
|
45
40
|
***The web tests run against the [Raider Test Store](https://raider-test-site.onrender.com/).***
|
|
46
41
|
|
|
@@ -70,13 +65,12 @@ raider new [name_of_project] -p framework:[framework] automation:[automation_typ
|
|
|
70
65
|
```
|
|
71
66
|
raider generate # Scaffolding commands
|
|
72
67
|
raider utility # Utility commands
|
|
73
|
-
raider plugin_manager # Plugin management
|
|
74
68
|
raider new [NAME] # Create new project
|
|
75
69
|
raider version # Show version
|
|
76
70
|
raider help [COMMAND] # Describe commands
|
|
77
71
|
```
|
|
78
72
|
|
|
79
|
-
Shortcuts: `g` (generate), `n` (new), `u` (utility), `v` (version)
|
|
73
|
+
Shortcuts: `g` (generate), `n` (new), `u` (utility), `v` (version)
|
|
80
74
|
|
|
81
75
|
### Scaffolding
|
|
82
76
|
|
|
@@ -22,16 +22,6 @@ module AllureHelper
|
|
|
22
22
|
)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def add_video(name, file)
|
|
26
|
-
return unless file && File.exist?(file)
|
|
27
|
-
|
|
28
|
-
Allure.add_attachment(
|
|
29
|
-
name: "Recording: #{name}",
|
|
30
|
-
source: File.new(file),
|
|
31
|
-
type: 'video/mp4',
|
|
32
|
-
test_case: true
|
|
33
|
-
)
|
|
34
|
-
end
|
|
35
25
|
<%- if rspec? -%>
|
|
36
26
|
|
|
37
27
|
def formatter
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
<% if
|
|
2
|
-
DebugHelper.capture_failure_diagnostics(Capybara.current_session.driver, example_name, exception: @_exception)
|
|
3
|
-
<% elsif selenium_based? %>
|
|
1
|
+
<% if selenium_based? %>
|
|
4
2
|
DebugHelper.capture_failure_diagnostics(driver, example_name, exception: @_exception)
|
|
5
3
|
<% elsif watir? %>
|
|
6
4
|
DebugHelper.capture_failure_diagnostics(browser, example_name, exception: @_exception)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
<% if
|
|
2
|
-
screenshot = Capybara.page.save_screenshot("#{temp_folder}/#{example_name}.png")
|
|
3
|
-
<% elsif selenium_based? %>
|
|
1
|
+
<% if selenium_based? %>
|
|
4
2
|
screenshot = driver.save_screenshot("#{temp_folder}/#{example_name}.png")
|
|
5
3
|
<% elsif watir? %>
|
|
6
4
|
screenshot = browser.screenshot.save("#{temp_folder}/#{example_name}.png")
|
|
@@ -6,16 +6,9 @@ require 'axe-rspec'
|
|
|
6
6
|
require 'rspec'
|
|
7
7
|
require 'rspec/retry'
|
|
8
8
|
require 'tmpdir'
|
|
9
|
-
<%- if allure_reporter? -%>
|
|
10
9
|
require_relative 'allure_helper'
|
|
11
|
-
<%- end -%>
|
|
12
|
-
<%- unless skip_video? -%>
|
|
13
|
-
require_relative 'video_helper'
|
|
14
|
-
<%- end -%>
|
|
15
10
|
require_relative 'debug_helper'
|
|
16
|
-
<%- if
|
|
17
|
-
require_relative 'capybara_helper'
|
|
18
|
-
<%- elsif watir? -%>
|
|
11
|
+
<%- if watir? -%>
|
|
19
12
|
require_relative 'browser_helper'
|
|
20
13
|
<%- else -%>
|
|
21
14
|
require_relative 'driver_helper'
|
|
@@ -23,27 +16,14 @@ require_relative 'driver_helper'
|
|
|
23
16
|
|
|
24
17
|
module SpecHelper
|
|
25
18
|
|
|
26
|
-
<%- if allure_reporter? -%>
|
|
27
19
|
AllureHelper.configure
|
|
28
|
-
<%- end -%>
|
|
29
20
|
RSpec.configure do |config|
|
|
30
21
|
config.example_status_persistence_file_path = 'spec/examples.txt'
|
|
31
22
|
config.verbose_retry = true
|
|
32
23
|
config.display_try_failure_messages = true
|
|
33
24
|
config.default_retry_count = ENV.fetch('RETRY_COUNT', 0).to_i
|
|
34
|
-
<%- if allure_reporter? -%>
|
|
35
25
|
config.formatter = AllureHelper.formatter
|
|
36
|
-
<%-
|
|
37
|
-
<%- if junit_reporter? -%>
|
|
38
|
-
config.add_formatter('RspecJunitFormatter', 'results/junit.xml')
|
|
39
|
-
<%- end -%>
|
|
40
|
-
<%- if json_reporter? -%>
|
|
41
|
-
config.add_formatter('json', 'results/results.json')
|
|
42
|
-
<%- end -%>
|
|
43
|
-
<%- if capybara? -%>
|
|
44
|
-
config.include(Capybara::DSL)
|
|
45
|
-
CapybaraHelper.configure
|
|
46
|
-
<%- elsif watir? -%>
|
|
26
|
+
<%- if watir? -%>
|
|
47
27
|
config.include(BrowserHelper)
|
|
48
28
|
<%- else -%>
|
|
49
29
|
config.include(DriverHelper)
|
|
@@ -51,14 +31,6 @@ module SpecHelper
|
|
|
51
31
|
<%- if mobile? -%>
|
|
52
32
|
config.before(:each) do
|
|
53
33
|
driver.start_driver
|
|
54
|
-
<%- elsif capybara? -%>
|
|
55
|
-
config.before(:each) do
|
|
56
|
-
viewport = YAML.load_file('config/config.yml')['viewport']
|
|
57
|
-
if viewport
|
|
58
|
-
Capybara.current_session.driver.browser.manage.window.resize_to(viewport['width'], viewport['height'])
|
|
59
|
-
else
|
|
60
|
-
Capybara.current_session.driver.browser.manage.window.maximize
|
|
61
|
-
end
|
|
62
34
|
<%- elsif selenium_based? -%>
|
|
63
35
|
config.before(:each) do
|
|
64
36
|
viewport = YAML.load_file('config/config.yml')['viewport']
|
|
@@ -76,10 +48,6 @@ module SpecHelper
|
|
|
76
48
|
browser.window.maximize
|
|
77
49
|
end
|
|
78
50
|
<%- end -%>
|
|
79
|
-
<%- unless skip_video? -%>
|
|
80
|
-
<%= partial('video_start', strip: true) %>
|
|
81
|
-
@video_recorder&.start(self.class.description)
|
|
82
|
-
<%- end -%>
|
|
83
51
|
<%= partial('debug_start', strip: true) %>
|
|
84
52
|
@debug_action_logger = DebugHelper.action_logger_for(self.class.description)
|
|
85
53
|
end
|
|
@@ -91,14 +59,9 @@ module SpecHelper
|
|
|
91
59
|
<%= partial('debug_diagnostics', strip: true) %>
|
|
92
60
|
end
|
|
93
61
|
@debug_action_logger&.close
|
|
94
|
-
<%- unless skip_video? -%>
|
|
95
|
-
<%= partial('video_stop', strip: true) %>
|
|
96
|
-
<%- end -%>
|
|
97
62
|
Dir.mktmpdir do |temp_folder|
|
|
98
63
|
<%= partial('screenshot', strip: true) %>
|
|
99
|
-
<%- if allure_reporter? -%>
|
|
100
64
|
AllureHelper.add_screenshot(example_name, screenshot)
|
|
101
|
-
<%- end -%>
|
|
102
65
|
end
|
|
103
66
|
<%= partial('quit_driver', strip: true) %>
|
|
104
67
|
end
|
data/lib/ruby_raider.rb
CHANGED
|
@@ -3,47 +3,20 @@
|
|
|
3
3
|
require 'thor'
|
|
4
4
|
|
|
5
5
|
# Lazy-load top-level command classes to reduce CLI startup time.
|
|
6
|
-
autoload :AdoptCommands, File.expand_path('commands/adopt_commands', __dir__)
|
|
7
6
|
autoload :ScaffoldingCommands, File.expand_path('commands/scaffolding_commands', __dir__)
|
|
8
7
|
autoload :UtilityCommands, File.expand_path('commands/utility_commands', __dir__)
|
|
9
8
|
|
|
10
9
|
module RubyRaider
|
|
11
|
-
# Lazy-load namespaced classes within the correct module scope.
|
|
12
|
-
autoload :Plugin, File.expand_path('plugin/plugin', __dir__)
|
|
13
|
-
autoload :PluginCommands, File.expand_path('commands/plugin_commands', __dir__)
|
|
14
|
-
autoload :LoadedCommands, File.expand_path('commands/loaded_commands', __dir__)
|
|
15
|
-
|
|
16
10
|
class Raider < Thor
|
|
17
11
|
no_tasks do
|
|
18
|
-
def self.plugin_commands?
|
|
19
|
-
@plugin_commands ||= File.read(
|
|
20
|
-
File.expand_path('commands/loaded_commands.rb', __dir__)
|
|
21
|
-
).include?('subcommand')
|
|
22
|
-
end
|
|
23
|
-
|
|
24
12
|
def current_version = File.read(File.expand_path('version', __dir__)).strip
|
|
25
13
|
end
|
|
26
14
|
|
|
27
15
|
desc 'new [PROJECT_NAME]', 'Creates a new framework based on settings picked'
|
|
28
16
|
option :parameters,
|
|
29
17
|
type: :hash, required: false, desc: 'Parameters to avoid using the menu', aliases: 'p'
|
|
30
|
-
option :skip_ci,
|
|
31
|
-
type: :boolean, required: false, desc: 'Skip CI/CD configuration generation'
|
|
32
|
-
option :skip_allure,
|
|
33
|
-
type: :boolean, required: false, desc: 'Skip Allure reporting setup'
|
|
34
|
-
option :skip_video,
|
|
35
|
-
type: :boolean, required: false, desc: 'Skip video recording setup'
|
|
36
|
-
option :reporter,
|
|
37
|
-
type: :string, required: false, desc: 'Reporter: allure, junit, json, both, all, none', aliases: '-r'
|
|
38
18
|
option :accessibility,
|
|
39
19
|
type: :boolean, required: false, desc: 'Add axe accessibility testing'
|
|
40
|
-
option :visual,
|
|
41
|
-
type: :boolean, required: false, desc: 'Add visual regression testing'
|
|
42
|
-
option :performance,
|
|
43
|
-
type: :boolean, required: false, desc: 'Add Lighthouse performance auditing'
|
|
44
|
-
option :ruby_version,
|
|
45
|
-
type: :string, required: false, desc: 'Ruby version for generated project (e.g. 3.4, 3.3)'
|
|
46
|
-
|
|
47
20
|
def new(project_name)
|
|
48
21
|
require_relative 'utilities/logo'
|
|
49
22
|
RubyRaider::Logo.display
|
|
@@ -51,7 +24,7 @@ module RubyRaider
|
|
|
51
24
|
if params
|
|
52
25
|
params[:name] = project_name
|
|
53
26
|
parsed_hash = params.transform_keys(&:to_sym)
|
|
54
|
-
|
|
27
|
+
merge_flags(parsed_hash)
|
|
55
28
|
return InvokeGenerators.generate_framework(parsed_hash)
|
|
56
29
|
end
|
|
57
30
|
|
|
@@ -68,10 +41,6 @@ module RubyRaider
|
|
|
68
41
|
|
|
69
42
|
map 'v' => 'version'
|
|
70
43
|
|
|
71
|
-
desc 'adopt', 'Adopts an existing test project into Ruby Raider conventions'
|
|
72
|
-
subcommand 'adopt', AdoptCommands
|
|
73
|
-
map 'a' => 'adopt'
|
|
74
|
-
|
|
75
44
|
desc 'generate', 'Provides access to all the scaffolding commands'
|
|
76
45
|
subcommand 'generate', ScaffoldingCommands
|
|
77
46
|
map 'g' => 'generate'
|
|
@@ -80,26 +49,9 @@ module RubyRaider
|
|
|
80
49
|
subcommand 'utility', UtilityCommands
|
|
81
50
|
map 'u' => 'utility'
|
|
82
51
|
|
|
83
|
-
desc 'plugin_manager', 'Provides access to all the commands to manager your plugins'
|
|
84
|
-
subcommand 'plugin_manager', PluginCommands
|
|
85
|
-
map 'pm' => 'plugin_manager'
|
|
86
|
-
|
|
87
|
-
if plugin_commands?
|
|
88
|
-
desc 'plugins', 'loaded plugin commands'
|
|
89
|
-
subcommand 'plugins', LoadedCommands
|
|
90
|
-
map 'ps' => 'plugins'
|
|
91
|
-
end
|
|
92
|
-
|
|
93
52
|
no_tasks do
|
|
94
|
-
def
|
|
95
|
-
%i[skip_ci skip_allure skip_video].each do |flag|
|
|
96
|
-
params[flag] = true if options[flag]
|
|
97
|
-
end
|
|
98
|
-
params[:reporter] = options[:reporter] if options[:reporter]
|
|
53
|
+
def merge_flags(params)
|
|
99
54
|
params[:accessibility] = true if options[:accessibility]
|
|
100
|
-
params[:visual] = true if options[:visual]
|
|
101
|
-
params[:performance] = true if options[:performance]
|
|
102
|
-
params[:ruby_version] = options[:ruby_version] if options[:ruby_version]
|
|
103
55
|
end
|
|
104
56
|
end
|
|
105
57
|
end
|
|
@@ -4,7 +4,6 @@ require 'yaml'
|
|
|
4
4
|
|
|
5
5
|
module ScaffoldProjectDetector
|
|
6
6
|
AUTOMATION_GEMS = {
|
|
7
|
-
'capybara' => 'capybara',
|
|
8
7
|
'watir' => 'watir',
|
|
9
8
|
'selenium-webdriver' => 'selenium',
|
|
10
9
|
'appium_lib' => 'appium',
|
|
@@ -15,8 +14,7 @@ module ScaffoldProjectDetector
|
|
|
15
14
|
|
|
16
15
|
FRAMEWORK_GEMS = {
|
|
17
16
|
'rspec' => 'rspec',
|
|
18
|
-
'cucumber' => 'cucumber'
|
|
19
|
-
'minitest' => 'minitest'
|
|
17
|
+
'cucumber' => 'cucumber'
|
|
20
18
|
}.freeze
|
|
21
19
|
|
|
22
20
|
CONFIG_PATH = 'config/config.yml'
|
|
@@ -31,8 +29,7 @@ module ScaffoldProjectDetector
|
|
|
31
29
|
automation: detect_automation(gemfile),
|
|
32
30
|
framework: detect_framework(gemfile),
|
|
33
31
|
has_spec: Dir.exist?('spec'),
|
|
34
|
-
has_features: Dir.exist?('features')
|
|
35
|
-
has_test: Dir.exist?('test')
|
|
32
|
+
has_features: Dir.exist?('features')
|
|
36
33
|
}
|
|
37
34
|
end
|
|
38
35
|
|
|
@@ -60,10 +57,6 @@ module ScaffoldProjectDetector
|
|
|
60
57
|
detect_automation == 'selenium'
|
|
61
58
|
end
|
|
62
59
|
|
|
63
|
-
def capybara?
|
|
64
|
-
detect_automation == 'capybara'
|
|
65
|
-
end
|
|
66
|
-
|
|
67
60
|
def watir?
|
|
68
61
|
detect_automation == 'watir'
|
|
69
62
|
end
|
|
@@ -13,22 +13,10 @@ class Scaffolding < Thor::Group
|
|
|
13
13
|
|
|
14
14
|
attr_writer :uses
|
|
15
15
|
|
|
16
|
-
OVERRIDE_DIR = '.ruby_raider/templates'
|
|
17
|
-
|
|
18
16
|
def self.source_root
|
|
19
17
|
"#{File.dirname(__FILE__)}/templates"
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
# Check for user template override before using default
|
|
23
|
-
def template(source, *args, &block)
|
|
24
|
-
override = File.join(OVERRIDE_DIR, File.basename(source))
|
|
25
|
-
if File.exist?(override)
|
|
26
|
-
super(File.expand_path(override), *args, &block)
|
|
27
|
-
else
|
|
28
|
-
super
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
20
|
# --- Generation methods ---
|
|
33
21
|
|
|
34
22
|
def generate_page
|
|
@@ -60,68 +48,6 @@ class Scaffolding < Thor::Group
|
|
|
60
48
|
default_path('config/config.yml', '.yml'))
|
|
61
49
|
end
|
|
62
50
|
|
|
63
|
-
def generate_spec_from_page(source_file, ai: false) # rubocop:disable Naming/MethodParameterName
|
|
64
|
-
require_relative 'page_introspector'
|
|
65
|
-
@introspected = PageIntrospector.new(source_file)
|
|
66
|
-
enrich_with_ai_scenarios if ai
|
|
67
|
-
template('spec_from_page.tt', "spec/#{normalized_name}_spec.rb")
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def generate_page_from_url(analysis)
|
|
71
|
-
@url_data = analysis
|
|
72
|
-
template('page_from_url.tt', "page_objects/pages/#{normalized_name}.rb")
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def generate_spec_from_url(analysis)
|
|
76
|
-
@url_data = analysis
|
|
77
|
-
template('spec_from_url.tt', "spec/#{normalized_name}_spec.rb")
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# --- Deletion methods ---
|
|
81
|
-
|
|
82
|
-
def delete_page
|
|
83
|
-
remove_file(default_path("page_objects/pages/#{normalized_name}.rb", '_page.rb'))
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def delete_feature
|
|
87
|
-
remove_file(default_path("features/#{normalized_name}.feature", '.feature'))
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def delete_spec
|
|
91
|
-
remove_file(default_path("spec/#{normalized_name}_page_spec.rb", '_spec.rb'))
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def delete_helper
|
|
95
|
-
remove_file(default_path("helpers/#{normalized_name}_helper.rb", '_helper.rb'))
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def delete_steps
|
|
99
|
-
remove_file(default_path("features/step_definitions/#{normalized_name}_steps.rb", '_steps.rb'))
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def delete_component
|
|
103
|
-
remove_file(default_path("page_objects/components/#{normalized_name}.rb", '.rb'))
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def delete_config
|
|
107
|
-
remove_file(default_path('config/config.yml', '.yml'))
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
# --- Path planning (for dry-run) ---
|
|
111
|
-
|
|
112
|
-
def self.planned_path(name, type, custom_path = nil)
|
|
113
|
-
n = NameNormalizer.normalize(name)
|
|
114
|
-
case type.to_s
|
|
115
|
-
when 'page' then custom_path ? "#{custom_path}/#{n}_page.rb" : "page_objects/pages/#{n}.rb"
|
|
116
|
-
when 'spec' then custom_path ? "#{custom_path}/#{n}_spec.rb" : "spec/#{n}_page_spec.rb"
|
|
117
|
-
when 'feature' then custom_path ? "#{custom_path}/#{n}.feature" : "features/#{n}.feature"
|
|
118
|
-
when 'steps' then custom_path ? "#{custom_path}/#{n}_steps.rb" : "features/step_definitions/#{n}_steps.rb"
|
|
119
|
-
when 'helper' then custom_path ? "#{custom_path}/#{n}_helper.rb" : "helpers/#{n}_helper.rb"
|
|
120
|
-
when 'component' then custom_path ? "#{custom_path}/#{n}.rb" : "page_objects/components/#{n}.rb"
|
|
121
|
-
when 'model' then "models/data/#{n}.yml"
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
51
|
# --- Template helpers (available in .tt files) ---
|
|
126
52
|
|
|
127
53
|
def class_name
|
|
@@ -164,10 +90,6 @@ class Scaffolding < Thor::Group
|
|
|
164
90
|
automation_type == 'selenium'
|
|
165
91
|
end
|
|
166
92
|
|
|
167
|
-
def capybara?
|
|
168
|
-
automation_type == 'capybara'
|
|
169
|
-
end
|
|
170
|
-
|
|
171
93
|
def watir?
|
|
172
94
|
automation_type == 'watir'
|
|
173
95
|
end
|
|
@@ -176,39 +98,8 @@ class Scaffolding < Thor::Group
|
|
|
176
98
|
Array(@uses).reject(&:empty?)
|
|
177
99
|
end
|
|
178
100
|
|
|
179
|
-
attr_reader :introspected, :url_data
|
|
180
|
-
|
|
181
|
-
def ai_scenarios
|
|
182
|
-
@ai_scenarios || {}
|
|
183
|
-
end
|
|
184
|
-
|
|
185
101
|
def default_path(standard_path, file_type)
|
|
186
102
|
path ? "#{path}/#{normalized_name}#{file_type}" : standard_path
|
|
187
103
|
end
|
|
188
104
|
|
|
189
|
-
private
|
|
190
|
-
|
|
191
|
-
def enrich_with_ai_scenarios
|
|
192
|
-
require_relative '../llm/client'
|
|
193
|
-
require_relative '../llm/prompts'
|
|
194
|
-
require_relative '../llm/response_parser'
|
|
195
|
-
|
|
196
|
-
return unless Llm::Client.available?
|
|
197
|
-
|
|
198
|
-
response = Llm::Client.complete(
|
|
199
|
-
Llm::Prompts.generate_test_scenarios(
|
|
200
|
-
@introspected.class_name,
|
|
201
|
-
@introspected.methods,
|
|
202
|
-
automation_type,
|
|
203
|
-
framework_type
|
|
204
|
-
),
|
|
205
|
-
system_prompt: Llm::Prompts.system_prompt
|
|
206
|
-
)
|
|
207
|
-
scenarios = Llm::ResponseParser.extract_scenarios(response)
|
|
208
|
-
return unless scenarios
|
|
209
|
-
|
|
210
|
-
@ai_scenarios = scenarios.each_with_object({}) do |s, hash|
|
|
211
|
-
hash[s[:method]] = s
|
|
212
|
-
end
|
|
213
|
-
end
|
|
214
105
|
end
|
|
@@ -16,10 +16,6 @@ require_relative '<%= dep %>'
|
|
|
16
16
|
<%- end -%>
|
|
17
17
|
|
|
18
18
|
<%= ' ' * module_parts.size %> # Actions
|
|
19
|
-
<%- if capybara? -%>
|
|
20
|
-
|
|
21
|
-
<%= ' ' * module_parts.size %> # Example: fill_in 'field_id', with: value
|
|
22
|
-
<%- else -%>
|
|
23
19
|
|
|
24
20
|
<%= ' ' * module_parts.size %> private
|
|
25
21
|
|
|
@@ -29,7 +25,6 @@ require_relative '<%= dep %>'
|
|
|
29
25
|
<%- elsif watir? -%>
|
|
30
26
|
<%= ' ' * module_parts.size %> # Example: browser.text_field(id: 'element_id')
|
|
31
27
|
<%- end -%>
|
|
32
|
-
<%- end -%>
|
|
33
28
|
<%= ' ' * module_parts.size %>end
|
|
34
29
|
<% module_parts.each_with_index do |_mod, i| -%>
|
|
35
30
|
<%= ' ' * (module_parts.size - i - 1) %>end
|
|
@@ -43,10 +38,6 @@ class <%= page_class_name %> < Page
|
|
|
43
38
|
<%- end -%>
|
|
44
39
|
|
|
45
40
|
# Actions
|
|
46
|
-
<%- if capybara? -%>
|
|
47
|
-
|
|
48
|
-
# Example: fill_in 'field_id', with: value
|
|
49
|
-
<%- else -%>
|
|
50
41
|
|
|
51
42
|
private
|
|
52
43
|
|
|
@@ -56,6 +47,5 @@ class <%= page_class_name %> < Page
|
|
|
56
47
|
<%- elsif watir? -%>
|
|
57
48
|
# Example: browser.text_field(id: 'element_id')
|
|
58
49
|
<%- end -%>
|
|
59
|
-
<%- end -%>
|
|
60
50
|
end
|
|
61
51
|
<% end -%>
|
|
@@ -10,18 +10,14 @@ describe '<%= page_class_name %>' do
|
|
|
10
10
|
let(:page) { <%= page_class_name %>.new(driver) }
|
|
11
11
|
<%- elsif watir? -%>
|
|
12
12
|
let(:page) { <%= page_class_name %>.new(browser) }
|
|
13
|
-
<%- elsif capybara? -%>
|
|
14
|
-
let(:page) { <%= page_class_name %>.new }
|
|
15
13
|
<%- end -%>
|
|
16
14
|
<%- uses_list.each do |dep| -%>
|
|
17
|
-
let(:<%= dep %>) { <%= NameNormalizer.to_page_class(dep) %>.new<%= selenium? ? '(driver)' :
|
|
15
|
+
let(:<%= dep %>) { <%= NameNormalizer.to_page_class(dep) %>.new<%= selenium? ? '(driver)' : '(browser)' %> }
|
|
18
16
|
<%- end -%>
|
|
19
17
|
<%- if project_config['url'] -%>
|
|
20
18
|
|
|
21
19
|
before do
|
|
22
|
-
<%- if
|
|
23
|
-
visit '<%= normalized_name %>'
|
|
24
|
-
<%- elsif selenium? -%>
|
|
20
|
+
<%- if selenium? -%>
|
|
25
21
|
driver.navigate.to "\#{project_config['url']}/<%= normalized_name %>"
|
|
26
22
|
<%- elsif watir? -%>
|
|
27
23
|
browser.goto "\#{project_config['url']}/<%= normalized_name %>"
|
|
@@ -10,8 +10,6 @@ Given('I am on the <%= normalized_name.tr("_", " ") %> page') do
|
|
|
10
10
|
@page = <%= page_class_name %>.new(driver)
|
|
11
11
|
<%- elsif watir? -%>
|
|
12
12
|
@page = <%= page_class_name %>.new(browser)
|
|
13
|
-
<%- elsif capybara? -%>
|
|
14
|
-
visit '<%= normalized_name %>'
|
|
15
13
|
<%- end -%>
|
|
16
14
|
end
|
|
17
15
|
|