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/sig/llm/client.rbs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Type definitions for Llm::Client
|
|
2
|
-
module Llm
|
|
3
|
-
module Client
|
|
4
|
-
MAX_RETRIES: Integer
|
|
5
|
-
BASE_DELAY: Integer
|
|
6
|
-
|
|
7
|
-
def self?.complete: (String prompt, ?String? system_prompt) -> String?
|
|
8
|
-
def self?.available?: () -> bool
|
|
9
|
-
def self?.status: () -> Hash[Symbol, untyped]
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def self?.build_provider: () -> Llm::Provider?
|
|
14
|
-
end
|
|
15
|
-
end
|
data/sig/llm/config.rbs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Type definitions for Llm::Config
|
|
2
|
-
module Llm
|
|
3
|
-
class Config
|
|
4
|
-
PROVIDERS: Array[String]
|
|
5
|
-
|
|
6
|
-
attr_reader provider_name: String?
|
|
7
|
-
attr_reader api_key: String?
|
|
8
|
-
attr_reader model: String?
|
|
9
|
-
attr_reader url: String?
|
|
10
|
-
|
|
11
|
-
def initialize: () -> void
|
|
12
|
-
def configured?: () -> bool
|
|
13
|
-
def build_provider: () -> Provider?
|
|
14
|
-
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
def env: (String key) -> String?
|
|
18
|
-
def config_value: (String key) -> String?
|
|
19
|
-
end
|
|
20
|
-
end
|
data/sig/llm/prompts.rbs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Type definitions for Llm::Prompts
|
|
2
|
-
module Llm
|
|
3
|
-
module Prompts
|
|
4
|
-
def self?.analyze_page: (String html, String url) -> String
|
|
5
|
-
def self?.generate_test_scenarios: (String class_name, Array[Hash[Symbol, untyped]] methods, String automation, String framework) -> String
|
|
6
|
-
def self?.system_prompt: () -> String
|
|
7
|
-
end
|
|
8
|
-
end
|
data/sig/llm/provider.rbs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Type definitions for Llm::Provider
|
|
2
|
-
module Llm
|
|
3
|
-
class Provider
|
|
4
|
-
def complete: (String prompt, ?system_prompt: String?) -> String?
|
|
5
|
-
def available?: () -> bool
|
|
6
|
-
def name: () -> String
|
|
7
|
-
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
def build_messages: (String prompt, String? system_prompt) -> Array[Hash[String, String]]
|
|
11
|
-
end
|
|
12
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Type definitions for Anthropic provider
|
|
2
|
-
module Llm
|
|
3
|
-
module Providers
|
|
4
|
-
class AnthropicProvider < Provider
|
|
5
|
-
DEFAULT_MODEL: String
|
|
6
|
-
|
|
7
|
-
def initialize: (api_key: String, ?model: String?) -> void
|
|
8
|
-
def complete: (String prompt, ?system_prompt: String?) -> String?
|
|
9
|
-
def available?: () -> bool
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def build_client: () -> untyped
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Type definitions for Ollama provider
|
|
2
|
-
module Llm
|
|
3
|
-
module Providers
|
|
4
|
-
class OllamaProvider < Provider
|
|
5
|
-
DEFAULT_MODEL: String
|
|
6
|
-
DEFAULT_URL: String
|
|
7
|
-
TIMEOUT: Integer
|
|
8
|
-
|
|
9
|
-
def initialize: (?model: String?, ?url: String?) -> void
|
|
10
|
-
def complete: (String prompt, ?system_prompt: String?) -> String?
|
|
11
|
-
def available?: () -> bool
|
|
12
|
-
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
def post_request: (URI::Generic uri, Hash[Symbol, untyped] body) -> Net::HTTPResponse
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Type definitions for OpenAI provider
|
|
2
|
-
module Llm
|
|
3
|
-
module Providers
|
|
4
|
-
class OpenaiProvider < Provider
|
|
5
|
-
DEFAULT_MODEL: String
|
|
6
|
-
|
|
7
|
-
def initialize: (api_key: String, ?model: String?) -> void
|
|
8
|
-
def complete: (String prompt, ?system_prompt: String?) -> String?
|
|
9
|
-
def available?: () -> bool
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def build_client: () -> untyped
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
data/sig/llm/response_parser.rbs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Type definitions for Llm::ResponseParser
|
|
2
|
-
module Llm
|
|
3
|
-
module ResponseParser
|
|
4
|
-
def self?.parse_json: (String? response) -> Hash[Symbol, untyped]?
|
|
5
|
-
def self?.extract_elements: (String? response) -> Array[Hash[Symbol, untyped]]?
|
|
6
|
-
def self?.extract_scenarios: (String? response) -> Array[Hash[Symbol, untyped]]?
|
|
7
|
-
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
def self?.normalize_element: (Hash[Symbol, untyped] element) -> Hash[Symbol, untyped]?
|
|
11
|
-
def self?.extract_json: (String text) -> String?
|
|
12
|
-
end
|
|
13
|
-
end
|
data/sig/plugin/plugin.rbs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Type definitions for Plugin
|
|
2
|
-
module RubyRaider
|
|
3
|
-
module Plugin
|
|
4
|
-
def self?.add_plugin: (String plugin_name) -> void
|
|
5
|
-
def self?.delete_plugin: (String plugin_name) -> String?
|
|
6
|
-
def self?.installed_plugins: () -> Array[String]
|
|
7
|
-
def self?.installed?: (String plugin_name) -> bool
|
|
8
|
-
def self?.available?: (String plugin_name) -> bool
|
|
9
|
-
def self?.camelize: (String str) -> String
|
|
10
|
-
def self?.plugins: () -> Array[String]
|
|
11
|
-
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
def self?.add_plugin_to_gemfile: (String plugin_name) -> void
|
|
15
|
-
def self?.remove_plugin_from_gemfile: (String plugin_name) -> void
|
|
16
|
-
def self?.last_plugin?: () -> bool
|
|
17
|
-
def self?.read_gemfile: () -> Array[String]
|
|
18
|
-
def self?.comment_present?: () -> bool
|
|
19
|
-
def self?.plugin_present?: (String plugin_name) -> bool
|
|
20
|
-
def self?.remove_plugins_and_comments: (String plugin_name) -> Array[String]
|
|
21
|
-
def self?.update_gemfile: (Array[String] output_lines) -> void
|
|
22
|
-
def self?.gemfile_guard: () -> untyped
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Type definitions for PluginExposer
|
|
2
|
-
module RubyRaider
|
|
3
|
-
module PluginExposer
|
|
4
|
-
FILE_PATH: String
|
|
5
|
-
|
|
6
|
-
def self?.expose_commands: (String plugin_name) -> void
|
|
7
|
-
def self?.remove_command: (String plugin_name) -> void
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
def self?.any_commands?: () -> bool
|
|
12
|
-
def self?.read_loaded_commands: () -> Array[String]
|
|
13
|
-
def self?.formatted_command_without_space: (String plugin_name) -> String
|
|
14
|
-
def self?.formatted_command_with_space: (String plugin_name) -> String
|
|
15
|
-
def self?.plugin_present?: (String plugin_name) -> bool
|
|
16
|
-
def self?.select_command_formatting: (String plugin_name, String line) -> String?
|
|
17
|
-
def self?.require_plugin: (String plugin_name, String line) -> String?
|
|
18
|
-
def self?.delete_plugin_command: (String plugin_name) -> void
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Type definitions for CrudGenerator
|
|
2
|
-
class CrudGenerator
|
|
3
|
-
ACTIONS: Array[String]
|
|
4
|
-
|
|
5
|
-
def initialize: (String base_name, Class scaffolding_class, ^(String) -> String? config_loader) -> void
|
|
6
|
-
def generate: () -> Array[String]
|
|
7
|
-
def planned_files: () -> Array[String]
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
def generate_page: (String name) -> void
|
|
12
|
-
def generate_test: (String name) -> void
|
|
13
|
-
def generate_model: () -> void
|
|
14
|
-
def model_content: () -> String
|
|
15
|
-
def test_path: (String name) -> String
|
|
16
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Type definitions for PageIntrospector
|
|
2
|
-
class PageIntrospector
|
|
3
|
-
SKIP_METHODS: Array[String]
|
|
4
|
-
|
|
5
|
-
attr_reader class_name: String
|
|
6
|
-
attr_reader methods: Array[Hash[Symbol, untyped]]
|
|
7
|
-
|
|
8
|
-
def initialize: (String file_path) -> void
|
|
9
|
-
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
def extract_class_name: () -> String
|
|
13
|
-
def extract_public_methods: () -> Array[Hash[Symbol, untyped]]
|
|
14
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Type definitions for ScaffoldMenu
|
|
2
|
-
class ScaffoldMenu
|
|
3
|
-
COMPONENTS: Hash[String, Symbol]
|
|
4
|
-
|
|
5
|
-
def initialize: () -> void
|
|
6
|
-
def run: () -> Hash[Symbol, untyped]?
|
|
7
|
-
def self.build_options: (names: Array[String] | String, components: Array[Symbol] | Symbol, ?uses: Array[String] | String) -> Hash[Symbol, untyped]
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
def ask_names: () -> Array[String]
|
|
12
|
-
def ask_components: () -> Array[Symbol]
|
|
13
|
-
def ask_relationships: () -> Array[String]
|
|
14
|
-
def preview_and_confirm: (Array[String] names, Array[Symbol] components, Array[String] uses) -> Hash[Symbol, untyped]?
|
|
15
|
-
def planned_files: (Array[String] names, Array[Symbol] components) -> Array[String]
|
|
16
|
-
def file_for: (String name, Symbol component) -> String?
|
|
17
|
-
def default_components: (Hash[Symbol, untyped] project) -> Array[String]
|
|
18
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Type definitions for UrlAnalyzer
|
|
2
|
-
class UrlAnalyzer
|
|
3
|
-
INTERACTIVE_TAGS: Array[String]
|
|
4
|
-
|
|
5
|
-
attr_reader url: String
|
|
6
|
-
attr_reader page_name: String
|
|
7
|
-
attr_reader elements: Array[Hash[Symbol, untyped]]
|
|
8
|
-
|
|
9
|
-
def initialize: (String url, ?name_override: String?, ?ai: bool) -> void
|
|
10
|
-
def analyze: () -> UrlAnalyzer
|
|
11
|
-
def to_h: () -> Hash[Symbol, untyped]
|
|
12
|
-
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
def fetch_html: () -> String
|
|
16
|
-
def parse_elements: (String html) -> void
|
|
17
|
-
def parse_inputs: (String html) -> void
|
|
18
|
-
def parse_selects: (String html) -> void
|
|
19
|
-
def parse_textareas: (String html) -> void
|
|
20
|
-
def parse_buttons: (String html) -> void
|
|
21
|
-
def parse_links: (String html) -> void
|
|
22
|
-
def parse_attributes: (String attr_string) -> Hash[String, String]
|
|
23
|
-
def best_locator: (Hash[String, String] attrs, ?text: String?) -> Hash[Symbol, Symbol | String]
|
|
24
|
-
def infer_tag: (Hash[String, String] attrs) -> String
|
|
25
|
-
def build_element: (name: String, type: Symbol, locator: Hash[Symbol, Symbol | String], **untyped extra) -> Hash[Symbol, untyped]
|
|
26
|
-
def analyze_with_llm: (String html) -> Array[Hash[Symbol, untyped]]?
|
|
27
|
-
def derive_page_name: () -> String
|
|
28
|
-
end
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
require 'rspec'
|
|
5
|
-
require_relative '../../lib/adopter/adopt_menu'
|
|
6
|
-
|
|
7
|
-
RSpec.describe Adopter::AdoptMenu do
|
|
8
|
-
let(:source_dir) { 'tmp_adopt_menu_source' }
|
|
9
|
-
let(:output_dir) { 'tmp_adopt_menu_output' }
|
|
10
|
-
|
|
11
|
-
before do
|
|
12
|
-
FileUtils.mkdir_p(source_dir)
|
|
13
|
-
File.write("#{source_dir}/Gemfile", "gem 'rspec'\ngem 'selenium-webdriver'\ngem 'faker'\n")
|
|
14
|
-
FileUtils.mkdir_p("#{source_dir}/pages")
|
|
15
|
-
FileUtils.mkdir_p("#{source_dir}/spec")
|
|
16
|
-
|
|
17
|
-
File.write("#{source_dir}/pages/login_page.rb", <<~RUBY)
|
|
18
|
-
class LoginPage < BasePage
|
|
19
|
-
def login(user, pass)
|
|
20
|
-
driver.find_element(id: 'user').send_keys user
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
RUBY
|
|
24
|
-
|
|
25
|
-
File.write("#{source_dir}/spec/login_spec.rb", <<~RUBY)
|
|
26
|
-
describe 'Login' do
|
|
27
|
-
it 'can log in' do
|
|
28
|
-
expect(result).to eq 'ok'
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
RUBY
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
after do
|
|
35
|
-
FileUtils.rm_rf(source_dir)
|
|
36
|
-
FileUtils.rm_rf(output_dir)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
describe '.adopt' do
|
|
40
|
-
let(:params) do
|
|
41
|
-
{
|
|
42
|
-
source_path: source_dir,
|
|
43
|
-
output_path: output_dir,
|
|
44
|
-
target_automation: 'selenium',
|
|
45
|
-
target_framework: 'rspec'
|
|
46
|
-
}
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'runs the full adoption pipeline' do
|
|
50
|
-
result = described_class.adopt(params)
|
|
51
|
-
|
|
52
|
-
expect(result[:plan]).to be_a(Adopter::MigrationPlan)
|
|
53
|
-
expect(result[:results][:pages]).to eq(1)
|
|
54
|
-
expect(result[:results][:tests]).to eq(1)
|
|
55
|
-
expect(File).to exist("#{output_dir}/Gemfile")
|
|
56
|
-
expect(File).to exist("#{output_dir}/page_objects/pages/login.rb")
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it 'merges custom gems into the generated Gemfile' do
|
|
60
|
-
described_class.adopt(params)
|
|
61
|
-
|
|
62
|
-
gemfile = File.read("#{output_dir}/Gemfile")
|
|
63
|
-
expect(gemfile).to include("gem 'faker'")
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it 'converts page content with raider conventions' do
|
|
67
|
-
described_class.adopt(params)
|
|
68
|
-
|
|
69
|
-
page = File.read("#{output_dir}/page_objects/pages/login.rb")
|
|
70
|
-
expect(page).to include('frozen_string_literal: true')
|
|
71
|
-
expect(page).to include('class LoginPage < Page')
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
context 'with capybara target' do
|
|
75
|
-
let(:params) do
|
|
76
|
-
{
|
|
77
|
-
source_path: source_dir,
|
|
78
|
-
output_path: output_dir,
|
|
79
|
-
target_automation: 'capybara',
|
|
80
|
-
target_framework: 'rspec'
|
|
81
|
-
}
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it 'removes driver arguments from page instantiation' do
|
|
85
|
-
File.write("#{source_dir}/spec/login_spec.rb", <<~RUBY)
|
|
86
|
-
describe 'Login' do
|
|
87
|
-
it 'can log in' do
|
|
88
|
-
@page = LoginPage.new(driver)
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
RUBY
|
|
92
|
-
|
|
93
|
-
result = described_class.adopt(params)
|
|
94
|
-
test_content = result[:plan].converted_tests.first.content
|
|
95
|
-
expect(test_content).to include('LoginPage.new')
|
|
96
|
-
expect(test_content).not_to include('LoginPage.new(driver)')
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
context 'with ci_platform' do
|
|
101
|
-
let(:params) do
|
|
102
|
-
{
|
|
103
|
-
source_path: source_dir,
|
|
104
|
-
output_path: output_dir,
|
|
105
|
-
target_automation: 'selenium',
|
|
106
|
-
target_framework: 'rspec',
|
|
107
|
-
ci_platform: 'github'
|
|
108
|
-
}
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
it 'generates CI configuration' do
|
|
112
|
-
described_class.adopt(params)
|
|
113
|
-
|
|
114
|
-
expect(File).to exist("#{output_dir}/.github")
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
describe '.validate_params!' do
|
|
120
|
-
it 'raises on missing source_path' do
|
|
121
|
-
expect { described_class.validate_params!({}) }.to raise_error(ArgumentError, /source_path/)
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
it 'raises on missing output_path' do
|
|
125
|
-
expect { described_class.validate_params!(source_path: 'x') }.to raise_error(ArgumentError, /output_path/)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
it 'raises on missing target_automation' do
|
|
129
|
-
expect do
|
|
130
|
-
described_class.validate_params!(source_path: 'x', output_path: 'y')
|
|
131
|
-
end.to raise_error(ArgumentError, /target_automation/)
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
it 'raises on missing target_framework' do
|
|
135
|
-
expect do
|
|
136
|
-
described_class.validate_params!(source_path: 'x', output_path: 'y', target_automation: 'selenium')
|
|
137
|
-
end.to raise_error(ArgumentError, /target_framework/)
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
it 'raises on invalid target_automation' do
|
|
141
|
-
expect do
|
|
142
|
-
described_class.validate_params!(
|
|
143
|
-
source_path: 'x', output_path: 'y',
|
|
144
|
-
target_automation: 'appium', target_framework: 'rspec'
|
|
145
|
-
)
|
|
146
|
-
end.to raise_error(ArgumentError, /target_automation must be/)
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
it 'raises on invalid target_framework' do
|
|
150
|
-
expect do
|
|
151
|
-
described_class.validate_params!(
|
|
152
|
-
source_path: 'x', output_path: 'y',
|
|
153
|
-
target_automation: 'selenium', target_framework: 'junit'
|
|
154
|
-
)
|
|
155
|
-
end.to raise_error(ArgumentError, /target_framework must be/)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
it 'accepts valid params without raising' do
|
|
159
|
-
expect do
|
|
160
|
-
described_class.validate_params!(
|
|
161
|
-
source_path: 'x', output_path: 'y',
|
|
162
|
-
target_automation: 'selenium', target_framework: 'rspec'
|
|
163
|
-
)
|
|
164
|
-
end.not_to raise_error
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
it 'accepts capybara as valid automation' do
|
|
168
|
-
expect do
|
|
169
|
-
described_class.validate_params!(
|
|
170
|
-
source_path: 'x', output_path: 'y',
|
|
171
|
-
target_automation: 'capybara', target_framework: 'minitest'
|
|
172
|
-
)
|
|
173
|
-
end.not_to raise_error
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
|
-
end
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rspec'
|
|
4
|
-
require_relative '../../../lib/adopter/converters/identity_converter'
|
|
5
|
-
|
|
6
|
-
RSpec.describe Adopter::Converters::IdentityConverter do
|
|
7
|
-
describe '#convert_page' do
|
|
8
|
-
context 'targeting selenium' do
|
|
9
|
-
let(:converter) { described_class.new('selenium') }
|
|
10
|
-
|
|
11
|
-
it 'adds frozen_string_literal if missing' do
|
|
12
|
-
input = "class LoginPage < BasePage\nend\n"
|
|
13
|
-
result = converter.convert_page(input, {})
|
|
14
|
-
expect(result).to start_with('# frozen_string_literal: true')
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'does not duplicate frozen_string_literal' do
|
|
18
|
-
input = "# frozen_string_literal: true\n\nclass LoginPage < Page\nend\n"
|
|
19
|
-
result = converter.convert_page(input, {})
|
|
20
|
-
expect(result.scan('frozen_string_literal').length).to eq(1)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it 'updates base class to Page' do
|
|
24
|
-
input = "class LoginPage < BasePage\nend\n"
|
|
25
|
-
result = converter.convert_page(input, {})
|
|
26
|
-
expect(result).to include('class LoginPage < Page')
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it 'preserves non-page base classes' do
|
|
30
|
-
input = "class UserFactory < ModelFactory\nend\n"
|
|
31
|
-
result = converter.convert_page(input, {})
|
|
32
|
-
expect(result).to include('class UserFactory < ModelFactory')
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it 'adds require_relative for abstract page' do
|
|
36
|
-
input = "class LoginPage < BasePage\nend\n"
|
|
37
|
-
result = converter.convert_page(input, {})
|
|
38
|
-
expect(result).to include("require_relative '../abstract/page'")
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it 'does not duplicate page require' do
|
|
42
|
-
input = "require_relative '../abstract/page'\n\nclass LoginPage < Page\nend\n"
|
|
43
|
-
result = converter.convert_page(input, {})
|
|
44
|
-
expect(result.scan("require_relative '../abstract/page'").length).to eq(1)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it 'swaps browser to driver in page instantiation' do
|
|
48
|
-
input = "class Test\n @page = LoginPage.new(browser)\nend\n"
|
|
49
|
-
result = converter.convert_page(input, {})
|
|
50
|
-
expect(result).to include('LoginPage.new(driver)')
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
context 'targeting capybara' do
|
|
55
|
-
let(:converter) { described_class.new('capybara') }
|
|
56
|
-
|
|
57
|
-
it 'removes driver argument from page instantiation' do
|
|
58
|
-
input = "class Test\n @page = LoginPage.new(driver)\nend\n"
|
|
59
|
-
result = converter.convert_page(input, {})
|
|
60
|
-
expect(result).to include('LoginPage.new')
|
|
61
|
-
expect(result).not_to include('LoginPage.new(driver)')
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it 'removes browser argument from page instantiation' do
|
|
65
|
-
input = " @page = LoginPage.new(browser)\n"
|
|
66
|
-
result = converter.convert_page(input, {})
|
|
67
|
-
expect(result).to include('LoginPage.new')
|
|
68
|
-
expect(result).not_to include('LoginPage.new(browser)')
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
context 'targeting watir' do
|
|
73
|
-
let(:converter) { described_class.new('watir') }
|
|
74
|
-
|
|
75
|
-
it 'swaps driver to browser in page instantiation' do
|
|
76
|
-
input = "class Test\n @page = LoginPage.new(driver)\nend\n"
|
|
77
|
-
result = converter.convert_page(input, {})
|
|
78
|
-
expect(result).to include('LoginPage.new(browser)')
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
describe '#convert_test' do
|
|
84
|
-
let(:converter) { described_class.new('selenium') }
|
|
85
|
-
|
|
86
|
-
it 'adds frozen_string_literal if missing' do
|
|
87
|
-
input = "describe 'Login' do\nend\n"
|
|
88
|
-
result = converter.convert_test(input, {})
|
|
89
|
-
expect(result).to start_with('# frozen_string_literal: true')
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
it 'updates helper require paths for selenium' do
|
|
93
|
-
input = "require_relative '../support/browser_setup'\n\ndescribe 'x' do; end\n"
|
|
94
|
-
result = converter.convert_test(input, {})
|
|
95
|
-
expect(result).to include("require_relative '../helpers/driver_helper'")
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
context 'targeting capybara' do
|
|
99
|
-
let(:converter) { described_class.new('capybara') }
|
|
100
|
-
|
|
101
|
-
it 'updates helper require paths for capybara' do
|
|
102
|
-
input = "require_relative '../support/driver_helper'\n\ndescribe 'x' do; end\n"
|
|
103
|
-
result = converter.convert_test(input, {})
|
|
104
|
-
expect(result).to include("require_relative '../helpers/capybara_helper'")
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
context 'targeting watir' do
|
|
109
|
-
let(:converter) { described_class.new('watir') }
|
|
110
|
-
|
|
111
|
-
it 'updates helper require paths for watir' do
|
|
112
|
-
input = "require_relative '../support/driver_setup'\n\ndescribe 'x' do; end\n"
|
|
113
|
-
result = converter.convert_test(input, {})
|
|
114
|
-
expect(result).to include("require_relative '../helpers/browser_helper'")
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
describe '#convert_step' do
|
|
120
|
-
context 'targeting capybara' do
|
|
121
|
-
let(:converter) { described_class.new('capybara') }
|
|
122
|
-
|
|
123
|
-
it 'removes driver argument from page instantiation in steps' do
|
|
124
|
-
input = <<~RUBY
|
|
125
|
-
Given('I am on the login page') do
|
|
126
|
-
@page = LoginPage.new(driver)
|
|
127
|
-
end
|
|
128
|
-
RUBY
|
|
129
|
-
result = converter.convert_step(input)
|
|
130
|
-
expect(result).to include('LoginPage.new')
|
|
131
|
-
expect(result).not_to include('LoginPage.new(driver)')
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
context 'targeting selenium' do
|
|
136
|
-
let(:converter) { described_class.new('selenium') }
|
|
137
|
-
|
|
138
|
-
it 'swaps browser to driver in step page instantiation' do
|
|
139
|
-
input = " @page = LoginPage.new(browser)\n"
|
|
140
|
-
result = converter.convert_step(input)
|
|
141
|
-
expect(result).to include('LoginPage.new(driver)')
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
end
|