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
data/lib/utilities/utilities.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Utilities
|
|
|
7
7
|
|
|
8
8
|
class << self
|
|
9
9
|
def browser=(browser)
|
|
10
|
-
set('browser', browser)
|
|
10
|
+
set('browser', browser.to_s.delete_prefix(':'))
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def page_path=(path)
|
|
@@ -44,15 +44,17 @@ module Utilities
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def browser_options=(opts)
|
|
47
|
-
|
|
48
|
-
config['
|
|
49
|
-
config['browser_arguments']
|
|
47
|
+
reload_config
|
|
48
|
+
browser_name = @config['browser'] || 'chrome'
|
|
49
|
+
@config['browser_arguments'] ||= {}
|
|
50
|
+
@config['browser_arguments'][browser_name] = Array(opts).flatten
|
|
50
51
|
overwrite_yaml
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def delete_browser_options
|
|
54
|
-
|
|
55
|
-
config['
|
|
55
|
+
reload_config
|
|
56
|
+
browser_name = @config['browser'] || 'chrome'
|
|
57
|
+
@config['browser_arguments']&.delete(browser_name)
|
|
56
58
|
overwrite_yaml
|
|
57
59
|
end
|
|
58
60
|
|
|
@@ -60,32 +62,18 @@ module Utilities
|
|
|
60
62
|
set('headless', enabled)
|
|
61
63
|
end
|
|
62
64
|
|
|
63
|
-
def llm_provider=(provider)
|
|
64
|
-
set('llm_provider', provider)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def llm_api_key=(key)
|
|
68
|
-
set('llm_api_key', key)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def llm_model=(model)
|
|
72
|
-
set('llm_model', model)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def llm_url=(url)
|
|
76
|
-
set('llm_url', url)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
65
|
def debug=(enabled)
|
|
80
|
-
|
|
81
|
-
config['debug']
|
|
66
|
+
reload_config
|
|
67
|
+
@config['debug'] ||= {}
|
|
68
|
+
@config['debug']['enabled'] = enabled
|
|
82
69
|
overwrite_yaml
|
|
83
70
|
end
|
|
84
71
|
|
|
85
72
|
# Set multiple config keys in a single YAML write.
|
|
86
73
|
# Usage: Utilities.batch_update(browser: 'chrome', timeout: 30)
|
|
87
74
|
def batch_update(**settings)
|
|
88
|
-
|
|
75
|
+
reload_config
|
|
76
|
+
settings.each { |key, value| @config[key.to_s] = value }
|
|
89
77
|
overwrite_yaml
|
|
90
78
|
end
|
|
91
79
|
|
|
@@ -101,18 +89,24 @@ module Utilities
|
|
|
101
89
|
|
|
102
90
|
private
|
|
103
91
|
|
|
104
|
-
# Single-key setter:
|
|
92
|
+
# Single-key setter: reloads from disk, updates, and writes back
|
|
105
93
|
def set(key, value)
|
|
106
|
-
|
|
94
|
+
reload_config
|
|
95
|
+
@config[key] = value
|
|
107
96
|
overwrite_yaml
|
|
108
97
|
end
|
|
109
98
|
|
|
110
99
|
def overwrite_yaml
|
|
111
|
-
File.open(@path, 'w') { |file| YAML.dump(config, file) }
|
|
100
|
+
File.open(@path, 'w') { |file| YAML.dump(@config, file) }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Always reload from disk so external changes (e.g. desktop app) are picked up
|
|
104
|
+
def reload_config
|
|
105
|
+
@config = File.exist?(@path) ? YAML.load_file(@path) : {}
|
|
112
106
|
end
|
|
113
107
|
|
|
114
108
|
def config
|
|
115
|
-
@config
|
|
109
|
+
@config || reload_config
|
|
116
110
|
end
|
|
117
111
|
end
|
|
118
112
|
end
|
data/lib/version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.0
|
|
1
|
+
3.1.0
|
|
@@ -7,22 +7,10 @@ class ScaffoldingCommands < Thor
|
|
|
7
7
|
def steps: (String name) -> void
|
|
8
8
|
def component: (String name) -> void
|
|
9
9
|
def scaffold: (*String names) -> void
|
|
10
|
-
def destroy: (*String names) -> void
|
|
11
|
-
def from_url: (String url) -> void
|
|
12
10
|
|
|
13
11
|
private
|
|
14
12
|
|
|
15
13
|
def load_config_path: (String type) -> String?
|
|
16
|
-
def delete_scaffolding: (String name, String type) -> void
|
|
17
14
|
def generate_scaffolding: (String name, String type, String? path, ?uses: Array[String]?) -> void
|
|
18
|
-
def dry_run_preview: (String name, String type) -> void
|
|
19
15
|
def generate_default_scaffold: (String name) -> void
|
|
20
|
-
def generate_selected_components: (String name, Array[String] components) -> void
|
|
21
|
-
def generate_crud: (String name) -> void
|
|
22
|
-
def generate_spec_from_page: (String name, String source_file, ?ai: bool) -> void
|
|
23
|
-
def generate_model_data: (String name) -> void
|
|
24
|
-
def model_template: (String name) -> String
|
|
25
|
-
def destroy_scaffold: (String name, ?Array[String]? components) -> void
|
|
26
|
-
def detect_scaffold_types: () -> Array[String]
|
|
27
|
-
def interactive_scaffold: () -> void
|
|
28
16
|
end
|
|
@@ -12,10 +12,4 @@ class UtilityCommands < Thor
|
|
|
12
12
|
def debug: (String toggle) -> void
|
|
13
13
|
def start_appium: () -> void
|
|
14
14
|
def desktop: () -> void
|
|
15
|
-
def llm: (?String? provider) -> void
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
def configure_llm: (String provider) -> void
|
|
20
|
-
def show_llm_status: () -> void
|
|
21
15
|
end
|
|
@@ -6,11 +6,7 @@ class CucumberGenerator < Generator
|
|
|
6
6
|
def generate_env_file: () -> void
|
|
7
7
|
def generate_world: () -> void
|
|
8
8
|
def generate_cucumber_file: () -> void
|
|
9
|
-
def generate_visual_feature: () -> void
|
|
10
|
-
def generate_visual_steps: () -> void
|
|
11
9
|
def generate_accessibility_feature: () -> void
|
|
12
10
|
def generate_accessibility_steps: () -> void
|
|
13
|
-
def generate_performance_feature: () -> void
|
|
14
|
-
def generate_performance_steps: () -> void
|
|
15
11
|
def template_name: () -> String
|
|
16
12
|
end
|
|
@@ -15,24 +15,13 @@ class Generator < Thor::Group
|
|
|
15
15
|
def ios?: () -> bool
|
|
16
16
|
def android?: () -> bool
|
|
17
17
|
def rspec?: () -> bool
|
|
18
|
-
def minitest?: () -> bool
|
|
19
18
|
def selenium?: () -> bool
|
|
20
|
-
def capybara?: () -> bool
|
|
21
19
|
def watir?: () -> bool
|
|
22
20
|
def web?: () -> bool
|
|
23
21
|
def selenium_based?: () -> bool
|
|
24
22
|
|
|
25
23
|
# Add-on predicates
|
|
26
24
|
def axe_addon?: () -> bool
|
|
27
|
-
def visual_addon?: () -> bool
|
|
28
|
-
def lighthouse_addon?: () -> bool
|
|
29
|
-
|
|
30
|
-
# Skip/reporter predicates
|
|
31
|
-
def skip_allure?: () -> bool
|
|
32
|
-
def skip_video?: () -> bool
|
|
33
|
-
def allure_reporter?: () -> bool
|
|
34
|
-
def junit_reporter?: () -> bool
|
|
35
|
-
def json_reporter?: () -> bool
|
|
36
25
|
|
|
37
26
|
private
|
|
38
27
|
|
|
@@ -5,14 +5,10 @@ class HelpersGenerator < Generator
|
|
|
5
5
|
private
|
|
6
6
|
|
|
7
7
|
def generate_allure_helper: () -> void
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
def generate_browser_helper: () -> void
|
|
10
10
|
def generate_spec_helper: () -> void
|
|
11
11
|
def generate_driver_helper: () -> void
|
|
12
|
-
def generate_capybara_helper: () -> void
|
|
13
12
|
def generate_appium_helper: () -> void
|
|
14
|
-
def generate_test_helper: () -> void
|
|
15
13
|
def generate_debug_helper: () -> void
|
|
16
|
-
def generate_visual_helper: () -> void
|
|
17
|
-
def generate_performance_helper: () -> void
|
|
18
14
|
end
|
|
@@ -3,8 +3,7 @@ module InvokeGenerators
|
|
|
3
3
|
def self?.generate_framework: (?Hash[Symbol, untyped] structure) -> void
|
|
4
4
|
def self?.add_generator: (Array[String] generators, *String gens) -> void
|
|
5
5
|
def self?.invoke_generator: (?Hash[Symbol, untyped] structure) -> void
|
|
6
|
-
def self?.
|
|
7
|
-
def self?.reporter_flags: (String? reporter) -> Array[String]
|
|
6
|
+
def self?.collect_flags: (Hash[Symbol, untyped] structure) -> Array[String]
|
|
8
7
|
def self?.mobile_automation?: (String automation) -> bool
|
|
9
8
|
def self?.to_bool: (String? string) -> bool?
|
|
10
9
|
end
|
|
@@ -16,14 +16,10 @@ class MenuGenerator
|
|
|
16
16
|
def offer_desktop_download: () -> void
|
|
17
17
|
def select_test_framework: (String automation) -> void
|
|
18
18
|
def create_framework_options: (Hash[Symbol, untyped] params) -> untyped
|
|
19
|
-
def
|
|
20
|
-
def select_accessibility: (String framework, String automation_type, ?String? ci_platform, ?String? reporter) -> void
|
|
21
|
-
def select_visual: (String framework, String automation_type, ?String? ci_platform, ?String? reporter, ?bool accessibility) -> void
|
|
22
|
-
def select_performance: (String framework, String automation_type, ?String? ci_platform, ?String? reporter, ?bool accessibility, ?bool visual) -> void
|
|
19
|
+
def select_accessibility: (String framework, String automation_type) -> void
|
|
23
20
|
def mobile_automation?: (String automation_type) -> bool
|
|
24
|
-
def create_framework: (String framework, String automation_type, ?
|
|
21
|
+
def create_framework: (String framework, String automation_type, ?accessibility: bool) -> void
|
|
25
22
|
def yes_no_menu_choices: () -> Hash[Symbol, Proc]
|
|
26
23
|
def select_automation_framework: (untyped menu) -> void
|
|
27
24
|
def automation_options: (untyped menu) -> void
|
|
28
|
-
def select_ci_platform: (String framework, String automation) -> void
|
|
29
25
|
end
|
data/sig/ruby_raider.rbs
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# Type definitions for main RubyRaider entry point
|
|
2
2
|
module RubyRaider
|
|
3
3
|
class Raider < Thor
|
|
4
|
-
def self.plugin_commands?: () -> bool
|
|
5
4
|
def current_version: () -> String
|
|
6
5
|
|
|
7
6
|
def new: (String project_name) -> void
|
|
8
7
|
def version: () -> void
|
|
9
|
-
def adopt: () -> void
|
|
10
8
|
|
|
11
9
|
private
|
|
12
10
|
|
|
13
|
-
def
|
|
11
|
+
def merge_flags: (Hash[Symbol, untyped] params) -> void
|
|
14
12
|
end
|
|
15
13
|
end
|
|
@@ -8,7 +8,6 @@ module ScaffoldProjectDetector
|
|
|
8
8
|
def self?.detect_framework: (?String? gemfile) -> String
|
|
9
9
|
def self?.read_gemfile: () -> String
|
|
10
10
|
def self?.selenium?: () -> bool
|
|
11
|
-
def self?.capybara?: () -> bool
|
|
12
11
|
def self?.watir?: () -> bool
|
|
13
12
|
def self?.config: () -> Hash[String, untyped]
|
|
14
13
|
end
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
class Scaffolding < Thor::Group
|
|
3
3
|
include Thor::Actions
|
|
4
4
|
|
|
5
|
-
OVERRIDE_DIR: String
|
|
6
|
-
|
|
7
5
|
attr_writer uses: Array[String]
|
|
8
6
|
|
|
9
7
|
def self.source_root: () -> String
|
|
10
|
-
def self.planned_path: (String name, String type, ?String? custom_path) -> String?
|
|
11
8
|
|
|
12
9
|
# Generation methods
|
|
13
10
|
def generate_page: () -> void
|
|
@@ -17,18 +14,6 @@ class Scaffolding < Thor::Group
|
|
|
17
14
|
def generate_steps: () -> void
|
|
18
15
|
def generate_component: () -> void
|
|
19
16
|
def generate_config: () -> void
|
|
20
|
-
def generate_spec_from_page: (String source_file, ?ai: bool) -> void
|
|
21
|
-
def generate_page_from_url: (Hash[Symbol, untyped] analysis) -> void
|
|
22
|
-
def generate_spec_from_url: (Hash[Symbol, untyped] analysis) -> void
|
|
23
|
-
|
|
24
|
-
# Deletion methods
|
|
25
|
-
def delete_page: () -> void
|
|
26
|
-
def delete_feature: () -> void
|
|
27
|
-
def delete_spec: () -> void
|
|
28
|
-
def delete_helper: () -> void
|
|
29
|
-
def delete_steps: () -> void
|
|
30
|
-
def delete_component: () -> void
|
|
31
|
-
def delete_config: () -> void
|
|
32
17
|
|
|
33
18
|
# Template helpers
|
|
34
19
|
def class_name: () -> String?
|
|
@@ -41,15 +26,7 @@ class Scaffolding < Thor::Group
|
|
|
41
26
|
def framework_type: () -> String
|
|
42
27
|
def project_config: () -> Hash[String, untyped]
|
|
43
28
|
def selenium?: () -> bool
|
|
44
|
-
def capybara?: () -> bool
|
|
45
29
|
def watir?: () -> bool
|
|
46
30
|
def uses_list: () -> Array[String]
|
|
47
|
-
def introspected: () -> PageIntrospector?
|
|
48
|
-
def url_data: () -> Hash[Symbol, untyped]?
|
|
49
|
-
def ai_scenarios: () -> Hash[Symbol, untyped]
|
|
50
31
|
def default_path: (String standard_path, String file_type) -> String
|
|
51
|
-
|
|
52
|
-
private
|
|
53
|
-
|
|
54
|
-
def enrich_with_ai_scenarios: () -> void
|
|
55
32
|
end
|
data/sig/utilities/utilities.rbs
CHANGED
|
@@ -13,10 +13,6 @@ module Utilities
|
|
|
13
13
|
def self?.platform=: (String platform) -> void
|
|
14
14
|
def self?.browser_options=: (Array[String] opts) -> void
|
|
15
15
|
def self?.delete_browser_options: () -> void
|
|
16
|
-
def self?.llm_provider=: (String provider) -> void
|
|
17
|
-
def self?.llm_api_key=: (String key) -> void
|
|
18
|
-
def self?.llm_model=: (String model) -> void
|
|
19
|
-
def self?.llm_url=: (String url) -> void
|
|
20
16
|
def self?.debug=: (bool enabled) -> void
|
|
21
17
|
def self?.batch_update: (**untyped settings) -> void
|
|
22
18
|
def self?.run: (?String? opts) -> void
|
|
@@ -45,10 +45,6 @@ RSpec.describe RubyRaider::Raider do
|
|
|
45
45
|
expect(described_class.map['v']).to eq('version')
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
it 'maps a to adopt' do
|
|
49
|
-
expect(described_class.map['a']).to eq('adopt')
|
|
50
|
-
end
|
|
51
|
-
|
|
52
48
|
it 'maps g to generate' do
|
|
53
49
|
expect(described_class.map['g']).to eq('generate')
|
|
54
50
|
end
|
|
@@ -56,19 +52,11 @@ RSpec.describe RubyRaider::Raider do
|
|
|
56
52
|
it 'maps u to utility' do
|
|
57
53
|
expect(described_class.map['u']).to eq('utility')
|
|
58
54
|
end
|
|
59
|
-
|
|
60
|
-
it 'maps pm to plugin_manager' do
|
|
61
|
-
expect(described_class.map['pm']).to eq('plugin_manager')
|
|
62
|
-
end
|
|
63
55
|
end
|
|
64
56
|
|
|
65
57
|
describe 'registered subcommands' do
|
|
66
58
|
let(:subcommands) { described_class.subcommands }
|
|
67
59
|
|
|
68
|
-
it 'includes adopt' do
|
|
69
|
-
expect(subcommands).to include('adopt')
|
|
70
|
-
end
|
|
71
|
-
|
|
72
60
|
it 'includes generate' do
|
|
73
61
|
expect(subcommands).to include('generate')
|
|
74
62
|
end
|
|
@@ -76,54 +64,5 @@ RSpec.describe RubyRaider::Raider do
|
|
|
76
64
|
it 'includes utility' do
|
|
77
65
|
expect(subcommands).to include('utility')
|
|
78
66
|
end
|
|
79
|
-
|
|
80
|
-
it 'includes plugin_manager' do
|
|
81
|
-
expect(subcommands).to include('plugin_manager')
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
RSpec.describe AdoptCommands do
|
|
87
|
-
let(:source_dir) { 'tmp_cmd_adopt_source' }
|
|
88
|
-
let(:output_dir) { 'tmp_cmd_adopt_output' }
|
|
89
|
-
|
|
90
|
-
before do
|
|
91
|
-
FileUtils.mkdir_p(source_dir)
|
|
92
|
-
File.write("#{source_dir}/Gemfile", "gem 'rspec'\ngem 'selenium-webdriver'\n")
|
|
93
|
-
FileUtils.mkdir_p("#{source_dir}/spec")
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
after do
|
|
97
|
-
FileUtils.rm_rf(source_dir)
|
|
98
|
-
FileUtils.rm_rf(output_dir)
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
describe 'project command with parameters' do
|
|
102
|
-
it 'calls AdoptMenu.adopt with parsed params' do
|
|
103
|
-
result = { plan: double(warnings: [], output_path: output_dir), results: { pages: 0, tests: 0, features: 0, steps: 0, errors: [] } } # rubocop:disable RSpec/VerifiedDoubles
|
|
104
|
-
allow(Adopter::AdoptMenu).to receive(:adopt).and_return(result)
|
|
105
|
-
|
|
106
|
-
expect do
|
|
107
|
-
described_class.new.invoke(:project, nil, [source_dir, '-p',
|
|
108
|
-
"output_path:#{output_dir}",
|
|
109
|
-
'target_automation:selenium',
|
|
110
|
-
'target_framework:rspec'])
|
|
111
|
-
end.to output(/Adoption complete/).to_stdout
|
|
112
|
-
|
|
113
|
-
expect(Adopter::AdoptMenu).to have_received(:adopt).with(
|
|
114
|
-
hash_including(source_path: source_dir, target_automation: 'selenium', target_framework: 'rspec')
|
|
115
|
-
)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
describe 'project command without parameters' do
|
|
120
|
-
it 'calls AdoptMenu#run' do
|
|
121
|
-
menu = instance_double(Adopter::AdoptMenu, run: nil)
|
|
122
|
-
allow(Adopter::AdoptMenu).to receive(:new).and_return(menu)
|
|
123
|
-
|
|
124
|
-
described_class.new.invoke(:project, nil, [source_dir])
|
|
125
|
-
|
|
126
|
-
expect(menu).to have_received(:run)
|
|
127
|
-
end
|
|
128
67
|
end
|
|
129
68
|
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
require 'yaml'
|
|
5
|
+
require_relative '../../../lib/generators/invoke_generators'
|
|
6
|
+
require_relative '../../../lib/commands/utility_commands'
|
|
7
|
+
require_relative '../../../lib/utilities/utilities'
|
|
8
|
+
|
|
9
|
+
# Standalone test — does NOT require spec_helper to avoid generating all 54 projects.
|
|
10
|
+
# Generates only the specific projects needed for browser update testing.
|
|
11
|
+
|
|
12
|
+
describe 'Browser update after framework creation' do
|
|
13
|
+
include InvokeGenerators
|
|
14
|
+
|
|
15
|
+
orig_dir = Dir.pwd
|
|
16
|
+
|
|
17
|
+
def generate_project(framework:, automation:)
|
|
18
|
+
name = "browser_update_#{framework}_#{automation}"
|
|
19
|
+
generate_framework(automation: automation, framework: framework, name: name)
|
|
20
|
+
name
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
after do
|
|
24
|
+
Dir.chdir orig_dir
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
shared_examples 'updates browser config after creation' do |framework, automation|
|
|
28
|
+
before(:all) do # rubocop:disable RSpec/BeforeAfterAll
|
|
29
|
+
@project_name = generate_project(framework: framework, automation: automation)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
after(:all) do # rubocop:disable RSpec/BeforeAfterAll
|
|
33
|
+
Dir.chdir orig_dir
|
|
34
|
+
FileUtils.rm_rf(@project_name) if @project_name
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
before do
|
|
38
|
+
Dir.chdir @project_name
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'starts with chrome as default browser' do
|
|
42
|
+
config = YAML.load_file('config/config.yml')
|
|
43
|
+
expect(config['browser']).to eql 'chrome'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'strips colon prefix when setting browser' do
|
|
47
|
+
UtilityCommands.new.invoke(:browser, nil, %w[:firefox])
|
|
48
|
+
config = YAML.load_file('config/config.yml')
|
|
49
|
+
expect(config['browser']).to eql 'firefox'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'stores browser without colon so browser_arguments keys match' do
|
|
53
|
+
UtilityCommands.new.invoke(:browser, nil, %w[:firefox])
|
|
54
|
+
config = YAML.load_file('config/config.yml')
|
|
55
|
+
expect(config['browser_arguments']).to have_key('firefox')
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'sets browser arguments for the current browser' do
|
|
59
|
+
UtilityCommands.new.invoke(:browser, nil, %w[:chrome --opts headless no-sandbox])
|
|
60
|
+
config = YAML.load_file('config/config.yml')
|
|
61
|
+
expect(config['browser']).to eql 'chrome'
|
|
62
|
+
expect(config['browser_arguments']['chrome']).to eql %w[headless no-sandbox]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'enables headless mode via config key' do
|
|
66
|
+
UtilityCommands.new.invoke(:headless, nil, %w[on])
|
|
67
|
+
config = YAML.load_file('config/config.yml')
|
|
68
|
+
expect(config['headless']).to be true
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'disables headless mode via config key' do
|
|
72
|
+
UtilityCommands.new.invoke(:headless, nil, %w[on])
|
|
73
|
+
UtilityCommands.new.invoke(:headless, nil, %w[off])
|
|
74
|
+
config = YAML.load_file('config/config.yml')
|
|
75
|
+
expect(config['headless']).to be false
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'updates viewport dimensions' do
|
|
79
|
+
UtilityCommands.new.invoke(:viewport, nil, %w[375x812])
|
|
80
|
+
config = YAML.load_file('config/config.yml')
|
|
81
|
+
expect(config['viewport']).to eq({ 'width' => 375, 'height' => 812 })
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it 'updates timeout' do
|
|
85
|
+
UtilityCommands.new.invoke(:timeout, nil, %w[30])
|
|
86
|
+
config = YAML.load_file('config/config.yml')
|
|
87
|
+
expect(config['timeout']).to eq 30
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'applies multiple sequential updates without losing earlier changes' do
|
|
91
|
+
UtilityCommands.new.invoke(:browser, nil, %w[:firefox])
|
|
92
|
+
UtilityCommands.new.invoke(:headless, nil, %w[on])
|
|
93
|
+
UtilityCommands.new.invoke(:viewport, nil, %w[1920x1080])
|
|
94
|
+
UtilityCommands.new.invoke(:timeout, nil, %w[15])
|
|
95
|
+
|
|
96
|
+
config = YAML.load_file('config/config.yml')
|
|
97
|
+
expect(config['browser']).to eql 'firefox'
|
|
98
|
+
expect(config['headless']).to be true
|
|
99
|
+
expect(config['viewport']).to eq({ 'width' => 1920, 'height' => 1080 })
|
|
100
|
+
expect(config['timeout']).to eq 15
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it 'deletes browser arguments after setting them' do
|
|
104
|
+
UtilityCommands.new.invoke(:browser, nil, %w[:firefox --opts headless])
|
|
105
|
+
UtilityCommands.new.invoke(:browser, nil, %w[--delete])
|
|
106
|
+
config = YAML.load_file('config/config.yml')
|
|
107
|
+
expect(config.dig('browser_arguments', 'firefox')).to be_nil
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
context 'with selenium + rspec' do
|
|
112
|
+
include_examples 'updates browser config after creation', 'rspec', 'selenium'
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
context 'with selenium + cucumber' do
|
|
116
|
+
include_examples 'updates browser config after creation', 'cucumber', 'selenium'
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
context 'with watir + rspec' do
|
|
120
|
+
include_examples 'updates browser config after creation', 'rspec', 'watir'
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
end
|
|
@@ -34,16 +34,6 @@ describe ScaffoldingCommands do
|
|
|
34
34
|
expect(Pathname.new("page_objects/pages/#{name}.rb")).to be_file
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
it 'deletes a spec' do
|
|
38
|
-
scaffold.new.invoke(:spec, nil, %w[login --delete])
|
|
39
|
-
expect(Pathname.new('spec/login_spec.rb')).not_to be_file
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it 'deletes a helper' do
|
|
43
|
-
scaffold.new.invoke(:helper, nil, %w[driver --delete])
|
|
44
|
-
expect(Pathname.new('helpers/driver_helper.rb')).not_to be_file
|
|
45
|
-
end
|
|
46
|
-
|
|
47
37
|
it 'creates a page' do
|
|
48
38
|
scaffold.new.invoke(:page, nil, %W[#{name}])
|
|
49
39
|
expect(Pathname.new("page_objects/pages/#{name}.rb")).to be_file
|
|
@@ -94,16 +84,6 @@ describe ScaffoldingCommands do
|
|
|
94
84
|
expect(Pathname.new("features/step_definitions/#{name}_steps.rb")).to be_file
|
|
95
85
|
end
|
|
96
86
|
|
|
97
|
-
it 'deletes a page' do
|
|
98
|
-
scaffold.new.invoke(:page, nil, %w[login --delete])
|
|
99
|
-
expect(Pathname.new('page_objects/pages/login_page.rb')).not_to be_file
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
it 'deletes a feature' do
|
|
103
|
-
scaffold.new.invoke(:feature, nil, %w[login --delete])
|
|
104
|
-
expect(Pathname.new('features/login.feature')).not_to be_file
|
|
105
|
-
end
|
|
106
|
-
|
|
107
87
|
it 'creates a feature' do
|
|
108
88
|
scaffold.new.invoke(:feature, nil, %W[#{name} --path #{new_path}])
|
|
109
89
|
expect(Pathname.new("#{new_path}/#{name}.feature")).to be_file
|
|
@@ -40,13 +40,13 @@ describe UtilityCommands do
|
|
|
40
40
|
it 'updates the browser' do
|
|
41
41
|
utility.new.invoke(:browser, nil, %w[:firefox])
|
|
42
42
|
config = YAML.load_file('config/config.yml')
|
|
43
|
-
expect(config['browser']).to eql '
|
|
43
|
+
expect(config['browser']).to eql 'firefox'
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it 'updates the browser arguments for the current browser' do
|
|
47
47
|
utility.new.invoke(:browser, nil, %w[:firefox --opts headless start-maximized start-fullscreen])
|
|
48
48
|
config = YAML.load_file('config/config.yml')
|
|
49
|
-
expect(config['browser_arguments']['
|
|
49
|
+
expect(config['browser_arguments']['firefox']).to eql %w[headless start-maximized start-fullscreen]
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -94,20 +94,20 @@ describe UtilityCommands do
|
|
|
94
94
|
it 'updates the browser arguments for the current browser' do
|
|
95
95
|
utility.new.invoke(:browser, nil, %w[:firefox --opts headless])
|
|
96
96
|
config = YAML.load_file('config/config.yml')
|
|
97
|
-
expect(config['browser_arguments']['
|
|
97
|
+
expect(config['browser_arguments']['firefox']).to eql %w[headless]
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
it 'deletes the browser arguments when passed with the delete parameter' do
|
|
101
101
|
utility.new.invoke(:browser, nil, %w[:firefox --opts headless --delete])
|
|
102
102
|
config = YAML.load_file('config/config.yml')
|
|
103
|
-
expect(config.dig('browser_arguments', '
|
|
103
|
+
expect(config.dig('browser_arguments', 'firefox')).to be_nil
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
it 'deletes the browser arguments' do
|
|
107
107
|
utility.new.invoke(:browser, nil, %w[:firefox --opts headless])
|
|
108
108
|
utility.new.invoke(:browser, nil, %w[--delete])
|
|
109
109
|
config = YAML.load_file('config/config.yml')
|
|
110
|
-
expect(config.dig('browser_arguments', '
|
|
110
|
+
expect(config.dig('browser_arguments', 'firefox')).to be_nil
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
end
|