ruby_raider 3.0.0 → 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 +22 -188
- data/lib/commands/utility_commands.rb +10 -44
- 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/browser_helper.tt +1 -1
- 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/partials/selenium_driver.tt +1 -1
- data/lib/generators/templates/helpers/spec_helper.tt +2 -39
- data/lib/ruby_raider.rb +2 -50
- data/lib/scaffolding/project_detector.rb +30 -13
- 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 +26 -24
- 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/commands/scaffolding_commands_spec.rb +22 -0
- 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 +9 -9
- 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 +540 -0
- 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 +42 -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 +82 -0
- data/spec/utilities/utilities_spec.rb +105 -0
- metadata +7 -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
|
@@ -4,9 +4,7 @@ require_relative '../helpers/spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe 'Accessibility' do
|
|
6
6
|
before do
|
|
7
|
-
<% if
|
|
8
|
-
visit '/'
|
|
9
|
-
<% elsif watir? -%>
|
|
7
|
+
<% if watir? -%>
|
|
10
8
|
browser.goto 'https://raider-test-site.onrender.com/'
|
|
11
9
|
<% else -%>
|
|
12
10
|
driver.get 'https://raider-test-site.onrender.com/'
|
|
@@ -14,9 +12,7 @@ driver.get 'https://raider-test-site.onrender.com/'
|
|
|
14
12
|
end
|
|
15
13
|
|
|
16
14
|
it 'has no accessibility violations on the page' do
|
|
17
|
-
<% if
|
|
18
|
-
expect(page).to be_axe_clean
|
|
19
|
-
<% elsif watir? -%>
|
|
15
|
+
<% if watir? -%>
|
|
20
16
|
expect(browser.driver).to be_axe_clean
|
|
21
17
|
<% else -%>
|
|
22
18
|
expect(driver).to be_axe_clean
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%- if selenium_based? || watir?
|
|
1
|
+
<%- if selenium_based? || watir? -%>
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative '../helpers/spec_helper'
|
|
@@ -10,16 +10,15 @@ require_relative '../page_objects/pages/login'
|
|
|
10
10
|
# require 'debug' # Ruby's built-in debugger (binding.break)
|
|
11
11
|
# require 'pry' # Pry debugger (binding.pry)
|
|
12
12
|
|
|
13
|
-
<%- if selenium_based? || watir? || capybara? -%>
|
|
14
13
|
describe 'Login' do
|
|
15
14
|
subject(:header) { account_page.header.customer_name }
|
|
16
15
|
|
|
17
16
|
let(:user) { ModelFactory.for('users')['registered user'] }
|
|
18
|
-
let(:login_page) { <% if
|
|
19
|
-
let(:account_page) { <% if
|
|
17
|
+
let(:login_page) { <% if watir? -%>Login.new(browser)<% else -%>Login.new(driver)<% end -%> }
|
|
18
|
+
let(:account_page) { <% if watir? -%>Account.new(browser)<% else -%>Account.new(driver)<% end -%> }
|
|
20
19
|
|
|
21
20
|
before do
|
|
22
|
-
login_page
|
|
21
|
+
login_page.visit
|
|
23
22
|
login_page.login(user['username'], password)
|
|
24
23
|
end
|
|
25
24
|
|
|
@@ -28,7 +27,7 @@ describe 'Login' do
|
|
|
28
27
|
|
|
29
28
|
it 'can successfully log in' do
|
|
30
29
|
# binding.break # Uncomment to pause here and inspect state
|
|
31
|
-
account_page
|
|
30
|
+
account_page.visit
|
|
32
31
|
expect(header).to eq "Welcome back #{user['name']}"
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -37,12 +36,11 @@ describe 'Login' do
|
|
|
37
36
|
let(:password) { 'wrongPassword' }
|
|
38
37
|
|
|
39
38
|
it 'cannot log in' do
|
|
40
|
-
login_page
|
|
39
|
+
login_page.visit
|
|
41
40
|
expect(header).to eq 'Login or register'
|
|
42
41
|
end
|
|
43
42
|
end
|
|
44
43
|
end
|
|
45
|
-
<%- end -%>
|
|
46
44
|
<%- else -%>
|
|
47
45
|
<% if cross_platform? -%>
|
|
48
46
|
require_relative '../helpers/appium_helper'
|
|
@@ -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
|
|
@@ -20,7 +20,7 @@ module BrowserHelper
|
|
|
20
20
|
Watir.default_timeout = config.fetch('timeout', 10)
|
|
21
21
|
browser_name = config['browser'].to_s
|
|
22
22
|
args = args.empty? ? config['browser_arguments'][browser_name] : args
|
|
23
|
-
args += ['--headless'] if ENV['HEADLESS'] && !args.include?('--headless')
|
|
23
|
+
args += ['--headless'] if (ENV['HEADLESS'] || config['headless']) && !args.include?('--headless')
|
|
24
24
|
capitalized = browser_name == 'ie' ? browser_name.upcase : browser_name.capitalize
|
|
25
25
|
browser_options = "Selenium::WebDriver::#{capitalized}::Options".constantize.new(args:)
|
|
26
26
|
debug_cfg = config['debug'] || {}
|
|
@@ -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")
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
def browser_arguments(*opts)
|
|
10
10
|
args = opts.empty? ? @config['browser_arguments'][@config['browser']] : opts
|
|
11
|
-
args += ['--headless'] if ENV['HEADLESS'] && !args.include?('--headless')
|
|
11
|
+
args += ['--headless'] if (ENV['HEADLESS'] || @config['headless']) && !args.include?('--headless')
|
|
12
12
|
args
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -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
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'yaml'
|
|
4
|
+
|
|
3
5
|
module ScaffoldProjectDetector
|
|
4
6
|
AUTOMATION_GEMS = {
|
|
5
|
-
'capybara' => 'capybara',
|
|
6
7
|
'watir' => 'watir',
|
|
7
8
|
'selenium-webdriver' => 'selenium',
|
|
8
9
|
'appium_lib' => 'appium',
|
|
@@ -13,10 +14,13 @@ module ScaffoldProjectDetector
|
|
|
13
14
|
|
|
14
15
|
FRAMEWORK_GEMS = {
|
|
15
16
|
'rspec' => 'rspec',
|
|
16
|
-
'cucumber' => 'cucumber'
|
|
17
|
-
'minitest' => 'minitest'
|
|
17
|
+
'cucumber' => 'cucumber'
|
|
18
18
|
}.freeze
|
|
19
19
|
|
|
20
|
+
CONFIG_PATH = 'config/config.yml'
|
|
21
|
+
|
|
22
|
+
class Error < StandardError; end
|
|
23
|
+
|
|
20
24
|
module_function
|
|
21
25
|
|
|
22
26
|
def detect
|
|
@@ -25,8 +29,7 @@ module ScaffoldProjectDetector
|
|
|
25
29
|
automation: detect_automation(gemfile),
|
|
26
30
|
framework: detect_framework(gemfile),
|
|
27
31
|
has_spec: Dir.exist?('spec'),
|
|
28
|
-
has_features: Dir.exist?('features')
|
|
29
|
-
has_test: Dir.exist?('test')
|
|
32
|
+
has_features: Dir.exist?('features')
|
|
30
33
|
}
|
|
31
34
|
end
|
|
32
35
|
|
|
@@ -54,19 +57,33 @@ module ScaffoldProjectDetector
|
|
|
54
57
|
detect_automation == 'selenium'
|
|
55
58
|
end
|
|
56
59
|
|
|
57
|
-
def capybara?
|
|
58
|
-
detect_automation == 'capybara'
|
|
59
|
-
end
|
|
60
|
-
|
|
61
60
|
def watir?
|
|
62
61
|
detect_automation == 'watir'
|
|
63
62
|
end
|
|
64
63
|
|
|
64
|
+
# Validates that the current directory looks like a Ruby Raider project.
|
|
65
|
+
# Returns an array of warning messages (empty = valid project).
|
|
66
|
+
def validate_project
|
|
67
|
+
warnings = []
|
|
68
|
+
warnings << 'Gemfile not found. Are you in a Ruby Raider project directory?' unless File.exist?('Gemfile')
|
|
69
|
+
unless File.exist?(CONFIG_PATH)
|
|
70
|
+
warnings << "#{CONFIG_PATH} not found. Scaffolded pages won't include URL navigation methods."
|
|
71
|
+
end
|
|
72
|
+
warnings
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Loads and parses config/config.yml. Returns a hash.
|
|
76
|
+
# Raises ScaffoldProjectDetector::Error on malformed YAML.
|
|
65
77
|
def config
|
|
66
|
-
return {} unless File.exist?(
|
|
78
|
+
return {} unless File.exist?(CONFIG_PATH)
|
|
79
|
+
|
|
80
|
+
YAML.safe_load(File.read(CONFIG_PATH), permitted_classes: [Symbol]) || {}
|
|
81
|
+
rescue Psych::SyntaxError => e
|
|
82
|
+
raise Error, "#{CONFIG_PATH} has invalid YAML syntax: #{e.message}"
|
|
83
|
+
end
|
|
67
84
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{}
|
|
85
|
+
# Returns the custom path for a scaffold type from config, or nil.
|
|
86
|
+
def config_path(type)
|
|
87
|
+
config["#{type}_path"]
|
|
71
88
|
end
|
|
72
89
|
end
|