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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce03b1ba3081d2259a481dc00f40b5bf95e7012784a593b187f3031fd9d0b33b
|
|
4
|
+
data.tar.gz: d42284c333748033d19c05231fb2da690896793745e93495382cafe1c6ccc4d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 525f632e44410a8adff2addb4e7d60b2e9e9c8a48294672e2b6689898a0c7d88047ce5c0a908db4197595d2f85dabc2c589b93b75497b3e8df9d4001a7d179d5
|
|
7
|
+
data.tar.gz: 34862b92a99c1e1a743dbc3c6b4a48a3d0d8ebca5253b7c666078cb5acf957f5c4e7935167aa4556a4a119c03b928264014edda5dd58e357f4665b73f098c056
|
|
@@ -20,23 +20,6 @@ jobs:
|
|
|
20
20
|
- name: Run content validation tests
|
|
21
21
|
run: bundle exec rspec spec/integration/content/ --format documentation
|
|
22
22
|
|
|
23
|
-
e2e-adopt:
|
|
24
|
-
name: Adopt E2E tests
|
|
25
|
-
runs-on: ubuntu-latest
|
|
26
|
-
|
|
27
|
-
steps:
|
|
28
|
-
- name: Checkout repository
|
|
29
|
-
uses: actions/checkout@v4
|
|
30
|
-
|
|
31
|
-
- name: Set up Ruby
|
|
32
|
-
uses: ruby/setup-ruby@v1
|
|
33
|
-
with:
|
|
34
|
-
ruby-version: '3.3'
|
|
35
|
-
bundler-cache: true
|
|
36
|
-
|
|
37
|
-
- name: Run adopt system tests
|
|
38
|
-
run: bundle exec rspec spec/system/adopt_spec.rb --format documentation
|
|
39
|
-
|
|
40
23
|
command-and-menu-tests:
|
|
41
24
|
name: Command routing and menu tests
|
|
42
25
|
runs-on: ubuntu-latest
|
|
@@ -59,25 +59,3 @@ jobs:
|
|
|
59
59
|
|
|
60
60
|
- name: Run Watir system tests
|
|
61
61
|
run: bundle exec rspec spec/system/watir_spec.rb --format documentation
|
|
62
|
-
|
|
63
|
-
capybara:
|
|
64
|
-
name: Capybara frameworks
|
|
65
|
-
needs: setup
|
|
66
|
-
runs-on: ubuntu-latest
|
|
67
|
-
steps:
|
|
68
|
-
- name: Checkout repository
|
|
69
|
-
uses: actions/checkout@v4
|
|
70
|
-
|
|
71
|
-
- name: Set up Ruby
|
|
72
|
-
uses: ruby/setup-ruby@v1
|
|
73
|
-
with:
|
|
74
|
-
ruby-version: '3.4'
|
|
75
|
-
bundler-cache: true
|
|
76
|
-
|
|
77
|
-
- name: Set up Chrome
|
|
78
|
-
uses: browser-actions/setup-chrome@v1
|
|
79
|
-
with:
|
|
80
|
-
chrome-version: stable
|
|
81
|
-
|
|
82
|
-
- name: Run Capybara system tests
|
|
83
|
-
run: bundle exec rspec spec/system/capybara_spec.rb --format documentation
|
data/README.md
CHANGED
|
@@ -33,11 +33,10 @@ Ruby Raider is a CLI gem and API backend for scaffolding and generating UI test
|
|
|
33
33
|
|
|
34
34
|
### Web Testing
|
|
35
35
|
|
|
36
|
-
| Test Framework | Selenium | Watir |
|
|
37
|
-
|
|
38
|
-
| RSpec | ✅ | ✅ |
|
|
39
|
-
| Cucumber | ✅ | ✅ |
|
|
40
|
-
| Minitest | ✅ | ✅ | ✅ |
|
|
36
|
+
| Test Framework | Selenium | Watir |
|
|
37
|
+
|----------------|----------|-------|
|
|
38
|
+
| RSpec | ✅ | ✅ |
|
|
39
|
+
| Cucumber | ✅ | ✅ |
|
|
41
40
|
|
|
42
41
|
### Mobile Testing (Appium)
|
|
43
42
|
|
|
@@ -45,23 +44,14 @@ Ruby Raider is a CLI gem and API backend for scaffolding and generating UI test
|
|
|
45
44
|
|----------------|-----|---------|----------------|
|
|
46
45
|
| RSpec | ✅ | ✅ | ✅ |
|
|
47
46
|
| Cucumber | ✅ | ✅ | ✅ |
|
|
48
|
-
| Minitest | ✅ | ✅ | ✅ |
|
|
49
47
|
|
|
50
|
-
### Optional Add-
|
|
48
|
+
### Optional Add-on (Web Only)
|
|
51
49
|
|
|
52
50
|
| Add-on | Flag | Description |
|
|
53
51
|
|--------|------|-------------|
|
|
54
52
|
| Accessibility | `--accessibility` | Adds axe gem + example accessibility tests |
|
|
55
|
-
| Visual Regression | `--visual` | Adds chunky_png + visual comparison helpers |
|
|
56
|
-
| Performance | `--performance` | Adds Lighthouse auditing (requires `npm install -g lighthouse`) |
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Projects can be generated with built-in CI/CD pipelines for **GitHub Actions** or **GitLab CI/CD**.
|
|
61
|
-
|
|
62
|
-
### Test Reporters
|
|
63
|
-
|
|
64
|
-
Choose a reporter with `--reporter`: `allure`, `junit`, `json`, `both`, `all`, or `none`.
|
|
54
|
+
All generated projects include a **GitHub Actions** CI pipeline out of the box.
|
|
65
55
|
|
|
66
56
|
***The web tests run against the [Raider Test Store](https://raider-test-site.onrender.com/).***
|
|
67
57
|
|
|
@@ -96,13 +86,7 @@ raider new [project_name] -p framework:rspec automation:selenium
|
|
|
96
86
|
Add optional features:
|
|
97
87
|
|
|
98
88
|
```bash
|
|
99
|
-
raider new my_project -p framework:rspec automation:selenium --accessibility
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Skip flags for leaner projects:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
raider new my_project -p framework:cucumber automation:watir --skip_ci --skip_video --reporter none
|
|
89
|
+
raider new my_project -p framework:rspec automation:selenium --accessibility
|
|
106
90
|
```
|
|
107
91
|
|
|
108
92
|
## Commands
|
|
@@ -113,15 +97,13 @@ raider new my_project -p framework:cucumber automation:watir --skip_ci --skip_vi
|
|
|
113
97
|
|
|
114
98
|
```
|
|
115
99
|
raider new [PROJECT_NAME] # Create a new framework project
|
|
116
|
-
raider adopt # Import an existing test project
|
|
117
100
|
raider generate # Access scaffolding commands
|
|
118
101
|
raider utility # Access utility commands
|
|
119
|
-
raider plugin_manager # Manage plugins
|
|
120
102
|
raider version # Show current version
|
|
121
103
|
raider help [COMMAND] # Describe available commands
|
|
122
104
|
```
|
|
123
105
|
|
|
124
|
-
Shortcuts: `n` (new), `
|
|
106
|
+
Shortcuts: `n` (new), `g` (generate), `u` (utility), `v` (version)
|
|
125
107
|
|
|
126
108
|
### Scaffolding Commands
|
|
127
109
|
|
|
@@ -133,18 +115,12 @@ raider g steps [NAME] # Create step definitions
|
|
|
133
115
|
raider g helper [NAME] # Create a helper class
|
|
134
116
|
raider g component [NAME] # Create a component class
|
|
135
117
|
raider g scaffold [NAME(S)] # Create page + test + steps
|
|
136
|
-
raider g destroy [NAME(S)] # Delete scaffolded files
|
|
137
|
-
raider g from_url [URL] # Generate page & spec from a live URL
|
|
138
118
|
```
|
|
139
119
|
|
|
140
120
|
Options:
|
|
141
121
|
|
|
142
|
-
* `--from [FILE]` — Generate spec from an existing page object
|
|
143
|
-
* `--ai` — Use LLM for intelligent test scenario generation
|
|
144
|
-
* `--dry_run` — Preview files without creating them
|
|
145
122
|
* `--uses [PAGES]` — Specify page dependencies
|
|
146
123
|
* `--path [PATH]` — Custom output path
|
|
147
|
-
* `--crud` — Generate full CRUD scaffold (list, create, detail, edit + tests)
|
|
148
124
|
|
|
149
125
|
### Utility Commands
|
|
150
126
|
|
|
@@ -160,38 +136,8 @@ raider u platform [PLATFORM] # Set platform for cross-platform tests
|
|
|
160
136
|
raider u debug [on/off] # Toggle debug mode
|
|
161
137
|
raider u start_appium # Start Appium server
|
|
162
138
|
raider u desktop # Download Raider Desktop
|
|
163
|
-
raider u llm [PROVIDER] # Configure LLM provider (openai, anthropic, ollama)
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Plugin Commands
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
raider pm add [NAME] # Add a plugin to your project
|
|
170
|
-
raider pm delete [NAME] # Remove a plugin
|
|
171
|
-
raider pm list # List available plugins
|
|
172
|
-
raider pm local # List installed plugins
|
|
173
139
|
```
|
|
174
140
|
|
|
175
|
-
### Adopt Command
|
|
176
|
-
|
|
177
|
-
Import an existing test project into Ruby Raider conventions:
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
raider adopt project [SOURCE_PATH]
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
## LLM Integration
|
|
184
|
-
|
|
185
|
-
Ruby Raider supports optional LLM-powered features for intelligent test generation. Configure a provider:
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
raider u llm openai # Configure OpenAI
|
|
189
|
-
raider u llm anthropic # Configure Anthropic
|
|
190
|
-
raider u llm ollama # Configure Ollama (local, no API key needed)
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Then use the `--ai` flag with scaffolding commands for smarter code generation.
|
|
194
|
-
|
|
195
141
|
## Development
|
|
196
142
|
|
|
197
143
|
```bash
|
|
@@ -6,162 +6,68 @@ require 'pathname'
|
|
|
6
6
|
require_relative '../generators/menu_generator'
|
|
7
7
|
require_relative '../scaffolding/scaffolding'
|
|
8
8
|
require_relative '../scaffolding/name_normalizer'
|
|
9
|
-
require_relative '../scaffolding/dry_run_presenter'
|
|
10
9
|
require_relative '../scaffolding/project_detector'
|
|
11
10
|
require_relative '../commands/utility_commands'
|
|
12
11
|
|
|
13
12
|
class ScaffoldingCommands < Thor
|
|
14
|
-
class_option :dry_run, type: :boolean, default: false,
|
|
15
|
-
desc: 'Preview files without creating them', banner: ''
|
|
16
|
-
|
|
17
13
|
desc 'page [PAGE_NAME]', 'Creates a new page object'
|
|
18
14
|
option :path, type: :string, required: false,
|
|
19
15
|
desc: 'The path where your page will be created', aliases: '-p'
|
|
20
|
-
option :delete, type: :boolean, required: false,
|
|
21
|
-
desc: 'This will delete the selected page', aliases: '-d'
|
|
22
16
|
option :uses, type: :array, required: false,
|
|
23
17
|
desc: 'Dependent pages to require', aliases: '-u'
|
|
24
18
|
|
|
25
19
|
def page(name)
|
|
26
|
-
return delete_scaffolding(name, 'page') if options[:delete]
|
|
27
|
-
return dry_run_preview(name, 'page') if options[:dry_run]
|
|
28
|
-
|
|
29
20
|
generate_scaffolding(name, 'page', options[:path], uses: options[:uses])
|
|
30
21
|
end
|
|
31
22
|
|
|
32
23
|
desc 'feature [NAME]', 'Creates a new feature'
|
|
33
24
|
option :path, type: :string, required: false,
|
|
34
25
|
desc: 'The path where your feature will be created', aliases: '-p'
|
|
35
|
-
option :delete, type: :boolean, required: false,
|
|
36
|
-
desc: 'This will delete the selected feature', aliases: '-d'
|
|
37
26
|
|
|
38
27
|
def feature(name)
|
|
39
|
-
return delete_scaffolding(name, 'feature') if options[:delete]
|
|
40
|
-
return dry_run_preview(name, 'feature') if options[:dry_run]
|
|
41
|
-
|
|
42
28
|
generate_scaffolding(name, 'feature', options[:path])
|
|
43
29
|
end
|
|
44
30
|
|
|
45
31
|
desc 'spec [SPEC_NAME]', 'Creates a new spec'
|
|
46
32
|
option :path, type: :string, required: false,
|
|
47
33
|
desc: 'The path where your spec will be created', aliases: '-p'
|
|
48
|
-
option :delete, type: :boolean, required: false,
|
|
49
|
-
desc: 'This will delete the selected spec', aliases: '-d'
|
|
50
|
-
option :from, type: :string, required: false,
|
|
51
|
-
desc: 'Generate spec stubs from an existing page object file', aliases: '-f'
|
|
52
34
|
option :uses, type: :array, required: false,
|
|
53
35
|
desc: 'Dependent pages to require', aliases: '-u'
|
|
54
|
-
option :ai, type: :boolean, default: false,
|
|
55
|
-
desc: 'Use LLM to generate meaningful test scenarios'
|
|
56
36
|
|
|
57
37
|
def spec(name)
|
|
58
|
-
return delete_scaffolding(name, 'spec') if options[:delete]
|
|
59
|
-
return dry_run_preview(name, 'spec') if options[:dry_run]
|
|
60
|
-
return generate_spec_from_page(name, options[:from], ai: options[:ai]) if options[:from]
|
|
61
|
-
|
|
62
38
|
generate_scaffolding(name, 'spec', options[:path], uses: options[:uses])
|
|
63
39
|
end
|
|
64
40
|
|
|
65
41
|
desc 'helper [HELPER_NAME]', 'Creates a new helper'
|
|
66
42
|
option :path, type: :string, required: false,
|
|
67
43
|
desc: 'The path where your helper will be created', aliases: '-p'
|
|
68
|
-
option :delete, type: :boolean, required: false,
|
|
69
|
-
desc: 'This will delete the selected helper', aliases: '-d'
|
|
70
44
|
|
|
71
45
|
def helper(name)
|
|
72
|
-
return delete_scaffolding(name, 'helper') if options[:delete]
|
|
73
|
-
return dry_run_preview(name, 'helper') if options[:dry_run]
|
|
74
|
-
|
|
75
46
|
generate_scaffolding(name, 'helper', options[:path])
|
|
76
47
|
end
|
|
77
48
|
|
|
78
49
|
desc 'steps [STEPS_NAME]', 'Creates a new steps definition'
|
|
79
50
|
option :path, type: :string, required: false,
|
|
80
51
|
desc: 'The path where your steps will be created', aliases: '-p'
|
|
81
|
-
option :delete, type: :boolean, required: false,
|
|
82
|
-
desc: 'This will delete the selected steps', aliases: '-d'
|
|
83
52
|
|
|
84
53
|
def steps(name)
|
|
85
|
-
return delete_scaffolding(name, 'steps') if options[:delete]
|
|
86
|
-
return dry_run_preview(name, 'steps') if options[:dry_run]
|
|
87
|
-
|
|
88
54
|
generate_scaffolding(name, 'steps', options[:path])
|
|
89
55
|
end
|
|
90
56
|
|
|
91
57
|
desc 'component [NAME]', 'Creates a component inheriting from Component'
|
|
92
58
|
option :path, type: :string, required: false,
|
|
93
59
|
desc: 'The path where your component will be created', aliases: '-p'
|
|
94
|
-
option :delete, type: :boolean, required: false,
|
|
95
|
-
desc: 'This will delete the selected component', aliases: '-d'
|
|
96
60
|
|
|
97
61
|
def component(name)
|
|
98
|
-
return delete_scaffolding(name, 'component') if options[:delete]
|
|
99
|
-
return dry_run_preview(name, 'component') if options[:dry_run]
|
|
100
|
-
|
|
101
62
|
generate_scaffolding(name, 'component', options[:path])
|
|
102
63
|
end
|
|
103
64
|
|
|
104
65
|
desc 'scaffold [NAMES...]', 'Generates pages, specs/features, and helpers for one or more names'
|
|
105
|
-
option :with, type: :array, required: false,
|
|
106
|
-
desc: 'Components to generate (page,spec,feature,steps,helper,component,model)', aliases: '-w'
|
|
107
|
-
option :crud, type: :boolean, required: false,
|
|
108
|
-
desc: 'Generate CRUD pages (list, create, detail, edit) + tests + model'
|
|
109
66
|
option :uses, type: :array, required: false,
|
|
110
67
|
desc: 'Dependent pages to require', aliases: '-u'
|
|
111
68
|
|
|
112
69
|
def scaffold(*names)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
names.each do |name|
|
|
116
|
-
if options[:crud]
|
|
117
|
-
generate_crud(name)
|
|
118
|
-
elsif options[:with]
|
|
119
|
-
generate_selected_components(name, options[:with])
|
|
120
|
-
else
|
|
121
|
-
generate_default_scaffold(name)
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
desc 'destroy [NAMES...]', 'Removes all scaffolded files for the given names (page, spec/feature, steps)'
|
|
127
|
-
option :with, type: :array, required: false,
|
|
128
|
-
desc: 'Components to destroy (page,spec,feature,steps,helper,component)', aliases: '-w'
|
|
129
|
-
|
|
130
|
-
def destroy(*names)
|
|
131
|
-
if names.empty?
|
|
132
|
-
say 'Please provide at least one name to destroy', :red
|
|
133
|
-
return
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
names.each { |name| destroy_scaffold(name, options[:with]) }
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
map 'd' => 'destroy'
|
|
140
|
-
|
|
141
|
-
desc 'from_url [URL]', 'Generates page object and spec from a live URL'
|
|
142
|
-
option :name, type: :string, required: false,
|
|
143
|
-
desc: 'Override the page object name', aliases: '-n'
|
|
144
|
-
option :ai, type: :boolean, default: false,
|
|
145
|
-
desc: 'Use LLM for intelligent page analysis'
|
|
146
|
-
|
|
147
|
-
def from_url(url)
|
|
148
|
-
require_relative '../scaffolding/url_analyzer'
|
|
149
|
-
analyzer = UrlAnalyzer.new(url, name_override: options[:name], ai: options[:ai])
|
|
150
|
-
analysis = analyzer.analyze.to_h
|
|
151
|
-
|
|
152
|
-
page_name = analysis[:page_name]
|
|
153
|
-
|
|
154
|
-
if options[:dry_run]
|
|
155
|
-
DryRunPresenter.preview([
|
|
156
|
-
"page_objects/pages/#{page_name}.rb",
|
|
157
|
-
"spec/#{page_name}_spec.rb"
|
|
158
|
-
])
|
|
159
|
-
return
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
Scaffolding.new([page_name]).generate_page_from_url(analysis)
|
|
163
|
-
Scaffolding.new([page_name]).generate_spec_from_url(analysis)
|
|
164
|
-
say "Generated page object and spec for #{url}"
|
|
70
|
+
names.each { |name| generate_default_scaffold(name) }
|
|
165
71
|
end
|
|
166
72
|
|
|
167
73
|
no_commands do
|
|
@@ -189,10 +95,6 @@ class ScaffoldingCommands < Thor
|
|
|
189
95
|
end
|
|
190
96
|
end
|
|
191
97
|
|
|
192
|
-
def delete_scaffolding(name, type)
|
|
193
|
-
Scaffolding.new([name]).send("delete_#{type}")
|
|
194
|
-
end
|
|
195
|
-
|
|
196
98
|
def generate_scaffolding(name, type, path, uses: nil)
|
|
197
99
|
path ||= load_config_path(type)
|
|
198
100
|
scaffolding = Scaffolding.new([name, path])
|
|
@@ -200,12 +102,6 @@ class ScaffoldingCommands < Thor
|
|
|
200
102
|
scaffolding.send("generate_#{type}")
|
|
201
103
|
end
|
|
202
104
|
|
|
203
|
-
def dry_run_preview(name, type)
|
|
204
|
-
path = options[:path] || load_config_path(type)
|
|
205
|
-
file = Scaffolding.planned_path(name, type, path)
|
|
206
|
-
DryRunPresenter.preview([file])
|
|
207
|
-
end
|
|
208
|
-
|
|
209
105
|
def generate_default_scaffold(name)
|
|
210
106
|
validate_project!
|
|
211
107
|
uses = options[:uses]
|
|
@@ -217,92 +113,5 @@ class ScaffoldingCommands < Thor
|
|
|
217
113
|
end
|
|
218
114
|
generate_scaffolding(name, 'page', load_config_path('page'), uses:)
|
|
219
115
|
end
|
|
220
|
-
|
|
221
|
-
def generate_selected_components(name, components)
|
|
222
|
-
validate_project!
|
|
223
|
-
uses = options[:uses]
|
|
224
|
-
components.each do |comp|
|
|
225
|
-
comp = comp.downcase.strip
|
|
226
|
-
case comp
|
|
227
|
-
when 'model'
|
|
228
|
-
generate_model_data(name)
|
|
229
|
-
else
|
|
230
|
-
generate_scaffolding(name, comp, load_config_path(comp), uses:)
|
|
231
|
-
end
|
|
232
|
-
end
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
def generate_crud(name)
|
|
236
|
-
require_relative '../scaffolding/crud_generator'
|
|
237
|
-
validate_project!
|
|
238
|
-
if options[:dry_run]
|
|
239
|
-
crud = CrudGenerator.new(name, Scaffolding, method(:load_config_path))
|
|
240
|
-
DryRunPresenter.preview(crud.planned_files)
|
|
241
|
-
return
|
|
242
|
-
end
|
|
243
|
-
crud = CrudGenerator.new(name, Scaffolding, method(:load_config_path))
|
|
244
|
-
generated = crud.generate
|
|
245
|
-
say "Generated CRUD scaffold for: #{generated.join(', ')}"
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
def generate_spec_from_page(name, source_file, ai: false) # rubocop:disable Naming/MethodParameterName
|
|
249
|
-
Scaffolding.new([name]).generate_spec_from_page(source_file, ai:)
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
def generate_model_data(name)
|
|
253
|
-
normalized = NameNormalizer.normalize(name)
|
|
254
|
-
path = "models/data/#{normalized}.yml"
|
|
255
|
-
return if File.exist?(path)
|
|
256
|
-
|
|
257
|
-
FileUtils.mkdir_p(File.dirname(path))
|
|
258
|
-
File.write(path, model_template(normalized))
|
|
259
|
-
end
|
|
260
|
-
|
|
261
|
-
def model_template(name)
|
|
262
|
-
<<~YAML
|
|
263
|
-
# Data model for #{name}
|
|
264
|
-
default:
|
|
265
|
-
name: 'Test #{name.capitalize}'
|
|
266
|
-
email: 'test@example.com'
|
|
267
|
-
|
|
268
|
-
valid:
|
|
269
|
-
name: 'Valid #{name.capitalize}'
|
|
270
|
-
email: 'valid@example.com'
|
|
271
|
-
|
|
272
|
-
invalid:
|
|
273
|
-
name: ''
|
|
274
|
-
email: 'invalid'
|
|
275
|
-
YAML
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
def destroy_scaffold(name, components = nil)
|
|
279
|
-
types = components ? components.map { |c| c.downcase.strip } : detect_scaffold_types
|
|
280
|
-
types.each { |type| delete_scaffolding(name, type) }
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
def detect_scaffold_types
|
|
284
|
-
if Pathname.new('spec').exist? && !Pathname.new('features').exist?
|
|
285
|
-
%w[page spec]
|
|
286
|
-
else
|
|
287
|
-
%w[page feature steps]
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
def interactive_scaffold
|
|
292
|
-
require_relative '../scaffolding/scaffold_menu'
|
|
293
|
-
validate_project!
|
|
294
|
-
result = ScaffoldMenu.new.run
|
|
295
|
-
return unless result
|
|
296
|
-
|
|
297
|
-
result[:names].each do |name|
|
|
298
|
-
result[:components].each do |comp|
|
|
299
|
-
if comp == :model
|
|
300
|
-
generate_model_data(name)
|
|
301
|
-
else
|
|
302
|
-
generate_scaffolding(name, comp.to_s, load_config_path(comp.to_s), uses: result[:uses])
|
|
303
|
-
end
|
|
304
|
-
end
|
|
305
|
-
end
|
|
306
|
-
end
|
|
307
116
|
end
|
|
308
117
|
end
|
|
@@ -123,47 +123,4 @@ class UtilityCommands < Thor
|
|
|
123
123
|
say 'Raider Desktop downloaded successfully!', :green
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
desc 'llm [PROVIDER]', 'Configures the LLM provider (openai, anthropic, ollama)'
|
|
127
|
-
option :key, type: :string, required: false, desc: 'API key for the provider', aliases: '-k'
|
|
128
|
-
option :model, type: :string, required: false, desc: 'Model name to use', aliases: '-m'
|
|
129
|
-
option :url, type: :string, required: false, desc: 'API URL (for ollama)', aliases: '-u'
|
|
130
|
-
option :status, type: :boolean, required: false, desc: 'Show current LLM configuration', aliases: '-s'
|
|
131
|
-
|
|
132
|
-
def llm(provider = nil)
|
|
133
|
-
if options[:status] || provider.nil?
|
|
134
|
-
show_llm_status
|
|
135
|
-
return
|
|
136
|
-
end
|
|
137
|
-
configure_llm(provider)
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
no_commands do
|
|
141
|
-
def configure_llm(provider)
|
|
142
|
-
unless %w[openai anthropic ollama].include?(provider)
|
|
143
|
-
say "Unknown provider '#{provider}'. Choose: openai, anthropic, ollama", :red
|
|
144
|
-
return
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
Utilities.llm_provider = provider
|
|
148
|
-
Utilities.llm_api_key = options[:key] if options[:key]
|
|
149
|
-
Utilities.llm_model = options[:model] if options[:model]
|
|
150
|
-
Utilities.llm_url = options[:url] if options[:url]
|
|
151
|
-
say "LLM configured: #{provider}", :green
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
def show_llm_status
|
|
155
|
-
require_relative '../llm/client'
|
|
156
|
-
status = Llm::Client.status
|
|
157
|
-
if status[:configured]
|
|
158
|
-
say "Provider: #{status[:provider]}"
|
|
159
|
-
say "Model: #{status[:model] || 'default'}"
|
|
160
|
-
say "Available: #{status[:available] ? 'yes' : 'no'}"
|
|
161
|
-
else
|
|
162
|
-
say 'No LLM configured. Use: raider u llm <provider>', :yellow
|
|
163
|
-
say ' Providers: openai, anthropic, ollama'
|
|
164
|
-
say ' Example: raider u llm ollama'
|
|
165
|
-
say ' Example: raider u llm openai -k sk-...'
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
126
|
end
|
|
@@ -9,13 +9,7 @@ class Login < Page
|
|
|
9
9
|
|
|
10
10
|
# Actions
|
|
11
11
|
|
|
12
|
-
<%- if
|
|
13
|
-
def login(username, password)
|
|
14
|
-
fill_in 'loginFrm_loginname', with: username
|
|
15
|
-
fill_in 'loginFrm_password', with: password
|
|
16
|
-
click_button 'Login'
|
|
17
|
-
end
|
|
18
|
-
<%- elsif selenium_based? -%>
|
|
12
|
+
<%- if selenium_based? -%>
|
|
19
13
|
def login(username, password)
|
|
20
14
|
username_field.send_keys username
|
|
21
15
|
password_field.send_keys password
|
|
@@ -29,7 +23,6 @@ class Login < Page
|
|
|
29
23
|
login_button.click
|
|
30
24
|
end
|
|
31
25
|
<%- end -%>
|
|
32
|
-
<%- unless capybara? -%>
|
|
33
26
|
|
|
34
27
|
private
|
|
35
28
|
|
|
@@ -58,5 +51,4 @@ class Login < Page
|
|
|
58
51
|
browser.button(xpath: "//button[@title='Login']")
|
|
59
52
|
<%- end -%>
|
|
60
53
|
end
|
|
61
|
-
<%- end -%>
|
|
62
54
|
end
|
|
@@ -14,13 +14,7 @@ class Page
|
|
|
14
14
|
self.class.to_s.sub('Page', ' Page')
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
<%- if
|
|
18
|
-
# Components
|
|
19
|
-
|
|
20
|
-
def header
|
|
21
|
-
Header.new(find('.welcome-msg'))
|
|
22
|
-
end
|
|
23
|
-
<%- elsif selenium_based? -%>
|
|
17
|
+
<%- if selenium_based? -%>
|
|
24
18
|
# Components
|
|
25
19
|
|
|
26
20
|
def header
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<% if web? %>
|
|
2
|
-
<% if
|
|
3
|
-
def visit_page(*page)
|
|
4
|
-
Capybara.visit full_url(page.first)
|
|
5
|
-
end
|
|
6
|
-
<% elsif selenium_based? %>
|
|
2
|
+
<% if selenium_based? %>
|
|
7
3
|
def visit(*page)
|
|
8
4
|
@driver.navigate.to full_url(page.first)
|
|
9
5
|
end
|
|
@@ -12,4 +8,4 @@
|
|
|
12
8
|
@browser.goto full_url(page.first)
|
|
13
9
|
end
|
|
14
10
|
<% end %>
|
|
15
|
-
<% end %>
|
|
11
|
+
<% end %>
|
|
@@ -17,10 +17,6 @@ class CommonGenerator < Generator
|
|
|
17
17
|
template('common/rakefile.tt', "#{name}/Rakefile")
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def generate_ruby_version_file
|
|
21
|
-
template('common/ruby_version.tt', "#{name}/.ruby-version")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
20
|
def generate_gemfile
|
|
25
21
|
template('common/gemfile.tt', "#{name}/Gemfile")
|
|
26
22
|
end
|
|
@@ -44,8 +40,6 @@ class CommonGenerator < Generator
|
|
|
44
40
|
end
|
|
45
41
|
|
|
46
42
|
def create_allure_folder
|
|
47
|
-
return unless allure_reporter?
|
|
48
|
-
|
|
49
43
|
empty_directory "#{name}/allure-results"
|
|
50
44
|
end
|
|
51
45
|
end
|
|
@@ -27,18 +27,6 @@ class CucumberGenerator < Generator
|
|
|
27
27
|
template('cucumber.tt', "#{name}/cucumber.yml")
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def generate_visual_feature
|
|
31
|
-
return unless visual_addon? && web?
|
|
32
|
-
|
|
33
|
-
template('visual_feature.tt', "#{name}/features/visual.feature")
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def generate_visual_steps
|
|
37
|
-
return unless visual_addon? && web?
|
|
38
|
-
|
|
39
|
-
template('visual_steps.tt', "#{name}/features/step_definitions/visual_steps.rb")
|
|
40
|
-
end
|
|
41
|
-
|
|
42
30
|
def generate_accessibility_feature
|
|
43
31
|
return unless axe_addon? && web?
|
|
44
32
|
|
|
@@ -51,18 +39,6 @@ class CucumberGenerator < Generator
|
|
|
51
39
|
template('accessibility_steps.tt', "#{name}/features/step_definitions/accessibility_steps.rb")
|
|
52
40
|
end
|
|
53
41
|
|
|
54
|
-
def generate_performance_feature
|
|
55
|
-
return unless lighthouse_addon? && web?
|
|
56
|
-
|
|
57
|
-
template('performance_feature.tt', "#{name}/features/performance.feature")
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def generate_performance_steps
|
|
61
|
-
return unless lighthouse_addon? && web?
|
|
62
|
-
|
|
63
|
-
template('performance_steps.tt', "#{name}/features/step_definitions/performance_steps.rb")
|
|
64
|
-
end
|
|
65
|
-
|
|
66
42
|
def template_name
|
|
67
43
|
@template_name ||= (@_initializer.first & %w[android ios cross_platform]).empty? ? 'login' : 'home'
|
|
68
44
|
end
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
Given('I am on the home page') do
|
|
4
|
-
<% if
|
|
5
|
-
visit '/'
|
|
6
|
-
<% elsif watir? -%>
|
|
4
|
+
<% if watir? -%>
|
|
7
5
|
browser.goto 'https://raider-test-site.onrender.com/'
|
|
8
6
|
<% else -%>
|
|
9
7
|
driver.get 'https://raider-test-site.onrender.com/'
|
|
@@ -11,9 +9,7 @@ driver.get 'https://raider-test-site.onrender.com/'
|
|
|
11
9
|
end
|
|
12
10
|
|
|
13
11
|
Then('the page should be accessible') do
|
|
14
|
-
<% if
|
|
15
|
-
expect(page).to be_axe_clean
|
|
16
|
-
<% elsif watir? -%>
|
|
12
|
+
<% if watir? -%>
|
|
17
13
|
expect(browser.driver).to be_axe_clean
|
|
18
14
|
<% else -%>
|
|
19
15
|
expect(driver).to be_axe_clean
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
<%- if allure_reporter? -%>
|
|
2
1
|
default: --format AllureCucumber::CucumberFormatter --out allure-results --publish-quiet --retry 0
|
|
3
|
-
<%- else -%>
|
|
4
|
-
default: --publish-quiet --retry 0
|
|
5
|
-
<%- end -%>
|
|
6
|
-
<%- if json_reporter? -%>
|
|
7
|
-
json: --format json --out results/results.json --publish-quiet
|
|
8
|
-
<%- end -%>
|