ruby_raider 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/e2e_tests.yml +0 -17
- data/.github/workflows/system_tests.yml +0 -22
- data/README.md +8 -62
- data/lib/commands/scaffolding_commands.rb +1 -192
- data/lib/commands/utility_commands.rb +0 -43
- data/lib/generators/automation/templates/login.tt +1 -9
- data/lib/generators/automation/templates/page.tt +1 -7
- data/lib/generators/automation/templates/partials/initialize_selector.tt +1 -3
- data/lib/generators/automation/templates/partials/visit_method.tt +2 -6
- data/lib/generators/common_generator.rb +0 -6
- data/lib/generators/cucumber/cucumber_generator.rb +0 -24
- data/lib/generators/cucumber/templates/accessibility_steps.tt +2 -6
- data/lib/generators/cucumber/templates/cucumber.tt +0 -7
- data/lib/generators/cucumber/templates/env.tt +1 -3
- data/lib/generators/cucumber/templates/partials/appium_env.tt +1 -6
- data/lib/generators/cucumber/templates/partials/selenium_env.tt +0 -5
- data/lib/generators/cucumber/templates/partials/watir_env.tt +0 -5
- data/lib/generators/cucumber/templates/partials/web_steps.tt +4 -4
- data/lib/generators/cucumber/templates/world.tt +1 -3
- data/lib/generators/generator.rb +2 -46
- data/lib/generators/helper_generator.rb +4 -42
- data/lib/generators/infrastructure/templates/github.tt +2 -2
- data/lib/generators/infrastructure/templates/github_appium.tt +2 -6
- data/lib/generators/invoke_generators.rb +4 -25
- data/lib/generators/menu_generator.rb +10 -100
- data/lib/generators/rspec/rspec_generator.rb +0 -11
- data/lib/generators/rspec/templates/accessibility_spec.tt +2 -6
- data/lib/generators/rspec/templates/spec.tt +6 -8
- data/lib/generators/templates/common/gemfile.tt +0 -26
- data/lib/generators/templates/common/git_ignore.tt +0 -2
- data/lib/generators/templates/common/partials/mobile_config.tt +0 -4
- data/lib/generators/templates/common/partials/web_config.tt +0 -4
- data/lib/generators/templates/common/rakefile.tt +0 -9
- data/lib/generators/templates/common/read_me.tt +4 -10
- data/lib/generators/templates/helpers/allure_helper.tt +0 -10
- data/lib/generators/templates/helpers/partials/debug_diagnostics.tt +1 -3
- data/lib/generators/templates/helpers/partials/debug_start.tt +1 -3
- data/lib/generators/templates/helpers/partials/quit_driver.tt +1 -3
- data/lib/generators/templates/helpers/partials/screenshot.tt +1 -3
- data/lib/generators/templates/helpers/spec_helper.tt +2 -39
- data/lib/ruby_raider.rb +2 -50
- data/lib/scaffolding/project_detector.rb +2 -9
- data/lib/scaffolding/scaffolding.rb +0 -109
- data/lib/scaffolding/templates/component.tt +1 -4
- data/lib/scaffolding/templates/page_object.tt +0 -10
- data/lib/scaffolding/templates/spec.tt +2 -6
- data/lib/scaffolding/templates/steps.tt +0 -2
- data/lib/utilities/utilities.rb +23 -29
- data/lib/version +1 -1
- data/sig/commands/scaffolding_commands.rbs +0 -12
- data/sig/commands/utility_commands.rbs +0 -6
- data/sig/generators/cucumber/cucumber_generator.rbs +0 -4
- data/sig/generators/generator.rbs +0 -11
- data/sig/generators/helper_generator.rbs +1 -5
- data/sig/generators/invoke_generators.rbs +1 -2
- data/sig/generators/menu_generator.rbs +2 -6
- data/sig/generators/rspec/rspec_generator.rbs +0 -2
- data/sig/ruby_raider.rbs +1 -3
- data/sig/scaffolding/project_detector.rbs +0 -1
- data/sig/scaffolding/scaffolding.rbs +0 -23
- data/sig/utilities/utilities.rbs +0 -4
- data/spec/commands/raider_commands_spec.rb +0 -61
- data/spec/integration/commands/browser_update_after_creation_spec.rb +123 -0
- data/spec/integration/commands/scaffolding_commands_spec.rb +0 -20
- data/spec/integration/commands/utility_commands_spec.rb +5 -5
- data/spec/integration/content/ci_content_spec.rb +6 -61
- data/spec/integration/content/common_content_spec.rb +0 -64
- data/spec/integration/content/config_content_spec.rb +1 -51
- data/spec/integration/content/content_helper.rb +2 -2
- data/spec/integration/content/gemfile_content_spec.rb +0 -71
- data/spec/integration/content/helper_content_spec.rb +4 -240
- data/spec/integration/content/page_content_spec.rb +0 -89
- data/spec/integration/content/syntax_validation_spec.rb +2 -2
- data/spec/integration/content/test_content_spec.rb +0 -119
- data/spec/integration/end_to_end_features_spec.rb +13 -411
- data/spec/integration/end_to_end_spec.rb +0 -96
- data/spec/integration/generators/axe_addon_spec.rb +2 -52
- data/spec/integration/generators/common_generator_spec.rb +1 -13
- data/spec/integration/generators/config_features_spec.rb +3 -81
- data/spec/integration/generators/debug_helper_spec.rb +0 -20
- data/spec/integration/generators/github_generator_spec.rb +5 -15
- data/spec/integration/generators/helpers_generator_spec.rb +0 -37
- data/spec/integration/scaffolding_e2e_spec.rb +2 -237
- data/spec/integration/settings_helper.rb +1 -3
- data/spec/integration/spec_helper.rb +6 -11
- data/spec/menus/menu_generator_spec.rb +4 -107
- data/spec/scaffolding/scaffold_project_detector_spec.rb +4 -26
- data/spec/scaffolding/scaffolding_features_spec.rb +0 -183
- data/spec/system/selenium_spec.rb +1 -4
- data/spec/system/support/system_test_helper.rb +0 -1
- data/spec/system/watir_spec.rb +1 -4
- data/spec/utilities/headless_config_spec.rb +0 -7
- metadata +3 -97
- data/lib/adopter/adopt_menu.rb +0 -146
- data/lib/adopter/converters/base_converter.rb +0 -84
- data/lib/adopter/converters/identity_converter.rb +0 -53
- data/lib/adopter/migration_plan.rb +0 -74
- data/lib/adopter/migrator.rb +0 -96
- data/lib/adopter/plan_builder.rb +0 -275
- data/lib/adopter/project_analyzer.rb +0 -252
- data/lib/adopter/project_detector.rb +0 -157
- data/lib/generators/cucumber/templates/partials/capybara_env.tt +0 -38
- data/lib/generators/cucumber/templates/partials/capybara_world.tt +0 -6
- data/lib/generators/cucumber/templates/performance_feature.tt +0 -5
- data/lib/generators/cucumber/templates/performance_steps.tt +0 -17
- data/lib/generators/cucumber/templates/visual_feature.tt +0 -5
- data/lib/generators/cucumber/templates/visual_steps.tt +0 -19
- data/lib/generators/infrastructure/gitlab_generator.rb +0 -11
- data/lib/generators/infrastructure/templates/gitlab.tt +0 -46
- data/lib/generators/minitest/minitest_generator.rb +0 -35
- data/lib/generators/minitest/templates/accessibility_test.tt +0 -26
- data/lib/generators/minitest/templates/performance_test.tt +0 -18
- data/lib/generators/minitest/templates/test.tt +0 -64
- data/lib/generators/minitest/templates/visual_test.tt +0 -23
- data/lib/generators/rspec/templates/performance_spec.tt +0 -18
- data/lib/generators/rspec/templates/visual_spec.tt +0 -20
- data/lib/generators/templates/helpers/capybara_helper.tt +0 -32
- data/lib/generators/templates/helpers/performance_helper.tt +0 -57
- data/lib/generators/templates/helpers/visual_helper.tt +0 -58
- data/lib/llm/client.rb +0 -79
- data/lib/llm/config.rb +0 -57
- data/lib/llm/prompts.rb +0 -84
- data/lib/llm/provider.rb +0 -27
- data/lib/llm/providers/anthropic_provider.rb +0 -43
- data/lib/llm/providers/ollama_provider.rb +0 -56
- data/lib/llm/providers/openai_provider.rb +0 -42
- data/lib/llm/response_parser.rb +0 -67
- data/lib/plugin/plugin.rb +0 -111
- data/lib/plugin/plugin_exposer.rb +0 -55
- data/lib/scaffolding/crud_generator.rb +0 -94
- data/lib/scaffolding/dry_run_presenter.rb +0 -16
- data/lib/scaffolding/page_introspector.rb +0 -45
- data/lib/scaffolding/scaffold_menu.rb +0 -103
- data/lib/scaffolding/templates/page_from_url.tt +0 -75
- data/lib/scaffolding/templates/spec_from_page.tt +0 -31
- data/lib/scaffolding/templates/spec_from_url.tt +0 -46
- data/lib/scaffolding/url_analyzer.rb +0 -179
- data/sig/adopter/adopt_menu.rbs +0 -25
- data/sig/adopter/converters/base_converter.rbs +0 -23
- data/sig/adopter/converters/identity_converter.rbs +0 -16
- data/sig/adopter/migration_plan.rbs +0 -34
- data/sig/adopter/migrator.rbs +0 -21
- data/sig/adopter/plan_builder.rbs +0 -38
- data/sig/adopter/project_analyzer.rbs +0 -39
- data/sig/adopter/project_detector.rbs +0 -26
- data/sig/generators/infrastructure/gitlab_generator.rbs +0 -4
- data/sig/generators/minitest/minitest_generator.rbs +0 -8
- data/sig/llm/client.rbs +0 -15
- data/sig/llm/config.rbs +0 -20
- data/sig/llm/prompts.rbs +0 -8
- data/sig/llm/provider.rbs +0 -12
- data/sig/llm/providers/anthropic_provider.rbs +0 -16
- data/sig/llm/providers/ollama_provider.rbs +0 -18
- data/sig/llm/providers/openai_provider.rbs +0 -16
- data/sig/llm/response_parser.rbs +0 -13
- data/sig/plugin/plugin.rbs +0 -24
- data/sig/plugin/plugin_exposer.rbs +0 -20
- data/sig/scaffolding/crud_generator.rbs +0 -16
- data/sig/scaffolding/dry_run_presenter.rbs +0 -4
- data/sig/scaffolding/page_introspector.rbs +0 -14
- data/sig/scaffolding/scaffold_menu.rbs +0 -18
- data/sig/scaffolding/url_analyzer.rbs +0 -28
- data/spec/adopter/adopt_menu_spec.rb +0 -176
- data/spec/adopter/converters/identity_converter_spec.rb +0 -145
- data/spec/adopter/migration_plan_spec.rb +0 -113
- data/spec/adopter/migrator_spec.rb +0 -277
- data/spec/adopter/plan_builder_spec.rb +0 -298
- data/spec/adopter/project_analyzer_spec.rb +0 -337
- data/spec/adopter/project_detector_spec.rb +0 -295
- data/spec/generators/generator_spec.rb +0 -23
- data/spec/integration/content/reporter_content_spec.rb +0 -236
- data/spec/integration/content/skip_flags_content_spec.rb +0 -206
- data/spec/integration/generators/gitlab_generator_spec.rb +0 -38
- data/spec/integration/generators/lighthouse_addon_spec.rb +0 -132
- data/spec/integration/generators/minitest_generator_spec.rb +0 -64
- data/spec/integration/generators/reporter_spec.rb +0 -159
- data/spec/integration/generators/skip_flags_spec.rb +0 -134
- data/spec/integration/generators/visual_addon_spec.rb +0 -148
- data/spec/llm/client_spec.rb +0 -79
- data/spec/llm/config_spec.rb +0 -92
- data/spec/llm/prompts_spec.rb +0 -49
- data/spec/llm/response_parser_spec.rb +0 -92
- data/spec/menus/adopter_adopt_menu_spec.rb +0 -97
- data/spec/scaffolding/page_introspector_spec.rb +0 -82
- data/spec/scaffolding/url_analyzer_spec.rb +0 -110
- data/spec/system/adopt_matrix_spec.rb +0 -537
- data/spec/system/adopt_spec.rb +0 -225
- data/spec/system/capybara_spec.rb +0 -42
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
require 'tmpdir'
|
|
2
2
|
require_relative '../../helpers/allure_helper'
|
|
3
|
-
require_relative '../../helpers/video_helper'
|
|
4
3
|
|
|
5
4
|
Before do
|
|
6
5
|
AllureHelper.configure
|
|
7
6
|
driver.start_driver
|
|
8
|
-
@video_recorder = VideoHelper.recorder_for(driver)
|
|
9
|
-
@video_recorder&.start(self.class.to_s)
|
|
10
7
|
end
|
|
11
8
|
|
|
12
9
|
After do |scenario|
|
|
13
|
-
video_file = @video_recorder&.stop
|
|
14
|
-
AllureHelper.add_video(scenario.name, video_file)
|
|
15
10
|
Dir.mktmpdir do |temp_folder|
|
|
16
11
|
screenshot = driver.screenshot("#{temp_folder}/#{scenario.name}.png")
|
|
17
12
|
AllureHelper.add_screenshot(scenario.name, screenshot)
|
|
18
13
|
end
|
|
19
14
|
driver.quit_driver
|
|
20
|
-
end
|
|
15
|
+
end
|
|
@@ -7,7 +7,6 @@ require 'rspec'
|
|
|
7
7
|
require 'tmpdir'
|
|
8
8
|
require 'yaml'
|
|
9
9
|
require_relative '../../helpers/allure_helper'
|
|
10
|
-
require_relative '../../helpers/video_helper'
|
|
11
10
|
require_relative '../../helpers/debug_helper'
|
|
12
11
|
|
|
13
12
|
Before do
|
|
@@ -17,8 +16,6 @@ Before do
|
|
|
17
16
|
else
|
|
18
17
|
driver.manage.window.maximize
|
|
19
18
|
end
|
|
20
|
-
@video_recorder = VideoHelper.recorder_for(driver)
|
|
21
|
-
@video_recorder&.start(self.class.to_s)
|
|
22
19
|
DebugHelper.enable_network_logging(driver)
|
|
23
20
|
@debug_action_logger = DebugHelper.action_logger_for(self.class.to_s)
|
|
24
21
|
end
|
|
@@ -29,8 +26,6 @@ After do |scenario|
|
|
|
29
26
|
DebugHelper.capture_network_logs(DebugHelper.resolve_selenium_driver(driver), DebugHelper.sanitize(scenario.name))
|
|
30
27
|
end
|
|
31
28
|
@debug_action_logger&.close
|
|
32
|
-
video_file = @video_recorder&.stop
|
|
33
|
-
AllureHelper.add_video(scenario.name, video_file)
|
|
34
29
|
Dir.mktmpdir do |temp_folder|
|
|
35
30
|
screenshot = driver.save_screenshot("#{temp_folder}/#{scenario.name}.png")
|
|
36
31
|
AllureHelper.add_screenshot(scenario.name, screenshot)
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
require 'tmpdir'
|
|
4
4
|
require 'yaml'
|
|
5
5
|
require_relative '../../helpers/allure_helper'
|
|
6
|
-
require_relative '../../helpers/video_helper'
|
|
7
6
|
require_relative '../../helpers/debug_helper'
|
|
8
7
|
|
|
9
8
|
Before do
|
|
@@ -13,8 +12,6 @@ Before do
|
|
|
13
12
|
else
|
|
14
13
|
browser.window.maximize
|
|
15
14
|
end
|
|
16
|
-
@video_recorder = VideoHelper.recorder_for(browser)
|
|
17
|
-
@video_recorder&.start(self.class.to_s)
|
|
18
15
|
DebugHelper.enable_network_logging(browser)
|
|
19
16
|
@debug_action_logger = DebugHelper.action_logger_for(self.class.to_s)
|
|
20
17
|
end
|
|
@@ -25,8 +22,6 @@ After do |scenario|
|
|
|
25
22
|
DebugHelper.capture_network_logs(DebugHelper.resolve_selenium_driver(browser), DebugHelper.sanitize(scenario.name))
|
|
26
23
|
end
|
|
27
24
|
@debug_action_logger&.close
|
|
28
|
-
video_file = @video_recorder&.stop
|
|
29
|
-
AllureHelper.add_video(scenario.name, video_file)
|
|
30
25
|
Dir.mktmpdir do |temp_folder|
|
|
31
26
|
screenshot = browser.screenshot.save("#{temp_folder}/#{scenario.name}.png")
|
|
32
27
|
AllureHelper.add_screenshot(scenario.name, screenshot)
|
|
@@ -9,8 +9,8 @@ require_relative '../../page_objects/pages/login'
|
|
|
9
9
|
|
|
10
10
|
Given("I'm a {user} on the login page") do |user|
|
|
11
11
|
@user = user
|
|
12
|
-
@login_page = <% if
|
|
13
|
-
@login_page
|
|
12
|
+
@login_page = <% if watir? %>Login.new(browser)<% else %>Login.new(driver)<% end %>
|
|
13
|
+
@login_page.visit
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
When('I login with my credentials') do
|
|
@@ -19,7 +19,7 @@ When('I login with my credentials') do
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
Then("I'm logged in") do
|
|
22
|
-
account_page = <% if
|
|
23
|
-
account_page
|
|
22
|
+
account_page = <% if watir? %>Account.new(browser)<% else %>Account.new(driver)<% end %>
|
|
23
|
+
account_page.visit
|
|
24
24
|
expect(account_page.header.customer_name).to eq "Welcome back #{@user['name']}"
|
|
25
25
|
end
|
data/lib/generators/generator.rb
CHANGED
|
@@ -7,8 +7,6 @@ class Generator < Thor::Group
|
|
|
7
7
|
include Thor::Actions
|
|
8
8
|
include TemplateRenderer
|
|
9
9
|
|
|
10
|
-
LATEST_RUBY = '3.4'
|
|
11
|
-
|
|
12
10
|
argument :automation
|
|
13
11
|
argument :framework
|
|
14
12
|
argument :name
|
|
@@ -16,7 +14,7 @@ class Generator < Thor::Group
|
|
|
16
14
|
def self.source_paths
|
|
17
15
|
base_path = File.dirname(__FILE__)
|
|
18
16
|
%W[#{base_path}/automation/templates #{base_path}/cucumber/templates
|
|
19
|
-
#{base_path}/rspec/templates
|
|
17
|
+
#{base_path}/rspec/templates
|
|
20
18
|
#{base_path}/templates #{base_path}/infrastructure/templates ]
|
|
21
19
|
end
|
|
22
20
|
|
|
@@ -53,68 +51,26 @@ class Generator < Thor::Group
|
|
|
53
51
|
args.include?('rspec')
|
|
54
52
|
end
|
|
55
53
|
|
|
56
|
-
def minitest?
|
|
57
|
-
args.include?('minitest')
|
|
58
|
-
end
|
|
59
|
-
|
|
60
54
|
def selenium?
|
|
61
55
|
args.include?('selenium')
|
|
62
56
|
end
|
|
63
57
|
|
|
64
|
-
def capybara?
|
|
65
|
-
args.include?('capybara')
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def visual_addon?
|
|
69
|
-
args.include?('visual_addon')
|
|
70
|
-
end
|
|
71
|
-
|
|
72
58
|
def watir?
|
|
73
59
|
args.include?('watir')
|
|
74
60
|
end
|
|
75
61
|
|
|
76
62
|
def web?
|
|
77
|
-
(args & %w[selenium watir
|
|
63
|
+
(args & %w[selenium watir]).count.positive?
|
|
78
64
|
end
|
|
79
65
|
|
|
80
66
|
def axe_addon?
|
|
81
67
|
args.include?('axe_addon')
|
|
82
68
|
end
|
|
83
69
|
|
|
84
|
-
def lighthouse_addon?
|
|
85
|
-
args.include?('lighthouse_addon')
|
|
86
|
-
end
|
|
87
|
-
|
|
88
70
|
def selenium_based?
|
|
89
71
|
args.include?('selenium')
|
|
90
72
|
end
|
|
91
73
|
|
|
92
|
-
def skip_allure?
|
|
93
|
-
args.include?('skip_allure')
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def skip_video?
|
|
97
|
-
args.include?('skip_video')
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def allure_reporter?
|
|
101
|
-
has_reporter = args.any? { |a| a&.start_with?('reporter_') }
|
|
102
|
-
has_reporter ? args.include?('reporter_allure') : !skip_allure?
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def junit_reporter?
|
|
106
|
-
args.include?('reporter_junit')
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
def json_reporter?
|
|
110
|
-
args.include?('reporter_json')
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def ruby_version
|
|
114
|
-
arg = args.find { |a| a&.start_with?('ruby_version:') }
|
|
115
|
-
arg ? arg.split(':', 2).last : LATEST_RUBY
|
|
116
|
-
end
|
|
117
|
-
|
|
118
74
|
private
|
|
119
75
|
|
|
120
76
|
def _initializer
|
|
@@ -6,84 +6,46 @@ class HelpersGenerator < Generator
|
|
|
6
6
|
def generate_helpers
|
|
7
7
|
generate_browser_helper
|
|
8
8
|
generate_driver_helper
|
|
9
|
-
generate_capybara_helper
|
|
10
9
|
generate_appium_helper
|
|
11
10
|
generate_allure_helper
|
|
12
|
-
generate_video_helper
|
|
13
11
|
generate_debug_helper
|
|
14
|
-
|
|
15
|
-
generate_performance_helper
|
|
16
|
-
|
|
17
|
-
if minitest?
|
|
18
|
-
generate_test_helper
|
|
19
|
-
else
|
|
20
|
-
generate_spec_helper
|
|
21
|
-
end
|
|
12
|
+
generate_spec_helper
|
|
22
13
|
end
|
|
23
14
|
|
|
24
15
|
private
|
|
25
16
|
|
|
26
17
|
def generate_allure_helper
|
|
27
|
-
return unless allure_reporter?
|
|
28
|
-
|
|
29
18
|
template('helpers/allure_helper.tt', "#{name}/helpers/allure_helper.rb")
|
|
30
19
|
end
|
|
31
20
|
|
|
32
|
-
def generate_video_helper
|
|
33
|
-
return if skip_video?
|
|
34
|
-
|
|
35
|
-
template('helpers/video_helper.tt', "#{name}/helpers/video_helper.rb")
|
|
36
|
-
end
|
|
37
|
-
|
|
38
21
|
def generate_browser_helper
|
|
39
|
-
return if selenium_based? || mobile?
|
|
22
|
+
return if selenium_based? || mobile?
|
|
40
23
|
|
|
41
24
|
template('helpers/browser_helper.tt', "#{name}/helpers/browser_helper.rb")
|
|
42
25
|
end
|
|
43
26
|
|
|
44
27
|
def generate_spec_helper
|
|
45
|
-
return if cucumber?
|
|
28
|
+
return if cucumber?
|
|
46
29
|
|
|
47
30
|
template('helpers/spec_helper.tt', "#{name}/helpers/spec_helper.rb")
|
|
48
31
|
end
|
|
49
32
|
|
|
50
33
|
def generate_driver_helper
|
|
51
|
-
return if watir?
|
|
34
|
+
return if watir?
|
|
52
35
|
|
|
53
36
|
template('helpers/driver_helper.tt', "#{name}/helpers/driver_helper.rb")
|
|
54
37
|
end
|
|
55
38
|
|
|
56
|
-
def generate_capybara_helper
|
|
57
|
-
return unless capybara?
|
|
58
|
-
|
|
59
|
-
template('helpers/capybara_helper.tt', "#{name}/helpers/capybara_helper.rb")
|
|
60
|
-
end
|
|
61
|
-
|
|
62
39
|
def generate_appium_helper
|
|
63
40
|
return unless cross_platform?
|
|
64
41
|
|
|
65
42
|
template('helpers/appium_helper.tt', "#{name}/helpers/appium_helper.rb")
|
|
66
43
|
end
|
|
67
44
|
|
|
68
|
-
def generate_test_helper
|
|
69
|
-
template('helpers/test_helper.tt', "#{name}/helpers/test_helper.rb")
|
|
70
|
-
end
|
|
71
|
-
|
|
72
45
|
def generate_debug_helper
|
|
73
46
|
return unless web?
|
|
74
47
|
|
|
75
48
|
template('helpers/debug_helper.tt', "#{name}/helpers/debug_helper.rb")
|
|
76
49
|
end
|
|
77
50
|
|
|
78
|
-
def generate_visual_helper
|
|
79
|
-
return unless visual_addon? && web?
|
|
80
|
-
|
|
81
|
-
template('helpers/visual_helper.tt', "#{name}/helpers/visual_helper.rb")
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def generate_performance_helper
|
|
85
|
-
return unless lighthouse_addon? && web?
|
|
86
|
-
|
|
87
|
-
template('helpers/performance_helper.tt', "#{name}/helpers/performance_helper.rb")
|
|
88
|
-
end
|
|
89
51
|
end
|
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
- name: Set up Ruby
|
|
23
23
|
uses: ruby/setup-ruby@v1
|
|
24
24
|
with:
|
|
25
|
-
ruby-version:
|
|
25
|
+
ruby-version: 3.4.0
|
|
26
26
|
bundler-cache: true
|
|
27
27
|
|
|
28
28
|
- name: Set up Chrome
|
|
@@ -34,7 +34,7 @@ jobs:
|
|
|
34
34
|
run: mkdir -p allure-results
|
|
35
35
|
|
|
36
36
|
- name: Run tests
|
|
37
|
-
run: <%- if framework == 'cucumber' -%>bundle exec cucumber features --format pretty<%-
|
|
37
|
+
run: <%- if framework == 'cucumber' -%>bundle exec cucumber features --format pretty<%- else -%>bundle exec rspec spec --format documentation<%- end %>
|
|
38
38
|
env:
|
|
39
39
|
HEADLESS: true
|
|
40
40
|
|
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
- uses: actions/checkout@v4
|
|
15
15
|
- uses: ruby/setup-ruby@v1
|
|
16
16
|
with:
|
|
17
|
-
ruby-version:
|
|
17
|
+
ruby-version: 3.4.0
|
|
18
18
|
bundler-cache: true
|
|
19
19
|
|
|
20
20
|
- name: Download iOS app
|
|
@@ -47,8 +47,6 @@ jobs:
|
|
|
47
47
|
- name: Run tests
|
|
48
48
|
<%- if cucumber? -%>
|
|
49
49
|
run: bundle exec cucumber features/ --format pretty
|
|
50
|
-
<%- elsif minitest? -%>
|
|
51
|
-
run: bundle exec ruby -Itest test/test_pdp_page.rb
|
|
52
50
|
<%- else -%>
|
|
53
51
|
run: bundle exec rspec spec/ --format documentation
|
|
54
52
|
<%- end -%>
|
|
@@ -63,7 +61,7 @@ jobs:
|
|
|
63
61
|
- uses: actions/checkout@v4
|
|
64
62
|
- uses: ruby/setup-ruby@v1
|
|
65
63
|
with:
|
|
66
|
-
ruby-version:
|
|
64
|
+
ruby-version: 3.4.0
|
|
67
65
|
bundler-cache: true
|
|
68
66
|
|
|
69
67
|
- name: Download Android app
|
|
@@ -98,8 +96,6 @@ jobs:
|
|
|
98
96
|
script: |
|
|
99
97
|
<%- if cucumber? -%>
|
|
100
98
|
bundle exec cucumber features/ --format pretty
|
|
101
|
-
<%- elsif minitest? -%>
|
|
102
|
-
bundle exec ruby -Itest test/test_pdp_page.rb
|
|
103
99
|
<%- else -%>
|
|
104
100
|
bundle exec rspec spec/ --format documentation
|
|
105
101
|
<%- end -%>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
require_relative 'infrastructure/github_generator'
|
|
2
|
-
require_relative 'infrastructure/gitlab_generator'
|
|
3
2
|
require_relative 'automation/automation_generator'
|
|
4
3
|
require_relative 'common_generator'
|
|
5
4
|
require_relative 'cucumber/cucumber_generator'
|
|
6
5
|
require_relative 'helper_generator'
|
|
7
|
-
require_relative 'minitest/minitest_generator'
|
|
8
6
|
require_relative 'rspec/rspec_generator'
|
|
9
7
|
|
|
10
8
|
module InvokeGenerators
|
|
@@ -14,14 +12,13 @@ module InvokeGenerators
|
|
|
14
12
|
generators = %w[Automation Common Helpers]
|
|
15
13
|
framework = structure[:framework]
|
|
16
14
|
add_generator(generators, framework.capitalize)
|
|
17
|
-
add_generator(generators,
|
|
18
|
-
extra_args =
|
|
15
|
+
add_generator(generators, 'Github')
|
|
16
|
+
extra_args = collect_flags(structure)
|
|
19
17
|
generators.each do |generator|
|
|
20
18
|
invoke_generator({
|
|
21
19
|
automation: structure[:automation],
|
|
22
20
|
framework:,
|
|
23
21
|
generator:,
|
|
24
|
-
ci_platform: structure[:ci_platform],
|
|
25
22
|
name: structure[:name],
|
|
26
23
|
extra_args:
|
|
27
24
|
})
|
|
@@ -36,7 +33,7 @@ module InvokeGenerators
|
|
|
36
33
|
GENERATOR_CLASSES = Hash.new { |h, k| h[k] = Object.const_get("#{k}Generator") }
|
|
37
34
|
|
|
38
35
|
def invoke_generator(structure = {})
|
|
39
|
-
args = [structure[:automation], structure[:framework], structure[:name]
|
|
36
|
+
args = [structure[:automation], structure[:framework], structure[:name]]
|
|
40
37
|
args.concat(structure[:extra_args] || [])
|
|
41
38
|
generator_class = GENERATOR_CLASSES[structure[:generator]]
|
|
42
39
|
generator = generator_class.new(args)
|
|
@@ -45,30 +42,12 @@ module InvokeGenerators
|
|
|
45
42
|
generator.invoke_all
|
|
46
43
|
end
|
|
47
44
|
|
|
48
|
-
def
|
|
45
|
+
def collect_flags(structure)
|
|
49
46
|
flags = []
|
|
50
|
-
flags << 'skip_allure' if structure[:skip_allure]
|
|
51
|
-
flags << 'skip_video' if structure[:skip_video]
|
|
52
47
|
flags << 'axe_addon' if structure[:accessibility] && !mobile_automation?(structure[:automation])
|
|
53
|
-
flags << 'visual_addon' if structure[:visual] && !mobile_automation?(structure[:automation])
|
|
54
|
-
flags << 'lighthouse_addon' if structure[:performance] && !mobile_automation?(structure[:automation])
|
|
55
|
-
flags << "ruby_version:#{structure[:ruby_version]}" if structure[:ruby_version]
|
|
56
|
-
flags.concat(reporter_flags(structure[:reporter]))
|
|
57
48
|
flags
|
|
58
49
|
end
|
|
59
50
|
|
|
60
|
-
def reporter_flags(reporter)
|
|
61
|
-
case reporter
|
|
62
|
-
when 'allure' then ['reporter_allure']
|
|
63
|
-
when 'junit' then ['reporter_junit']
|
|
64
|
-
when 'json' then ['reporter_json']
|
|
65
|
-
when 'both' then %w[reporter_allure reporter_junit]
|
|
66
|
-
when 'all' then %w[reporter_allure reporter_junit reporter_json]
|
|
67
|
-
when 'none' then ['reporter_none']
|
|
68
|
-
else []
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
51
|
def mobile_automation?(automation)
|
|
73
52
|
%w[ios android cross_platform].include?(automation)
|
|
74
53
|
end
|
|
@@ -29,12 +29,7 @@ class MenuGenerator
|
|
|
29
29
|
structure = {
|
|
30
30
|
automation: options[:automation],
|
|
31
31
|
framework: options[:framework],
|
|
32
|
-
ci_platform: options[:ci_platform],
|
|
33
|
-
reporter: options[:reporter],
|
|
34
32
|
accessibility: options[:accessibility],
|
|
35
|
-
visual: options[:visual],
|
|
36
|
-
performance: options[:performance],
|
|
37
|
-
ruby_version: options[:ruby_version],
|
|
38
33
|
name: @name
|
|
39
34
|
}
|
|
40
35
|
generate_framework(structure)
|
|
@@ -74,88 +69,24 @@ class MenuGenerator
|
|
|
74
69
|
|
|
75
70
|
def select_test_framework(automation)
|
|
76
71
|
prompt.select('Please select your test framework') do |menu|
|
|
77
|
-
menu.choice :Cucumber, -> {
|
|
78
|
-
menu.choice :Rspec, -> {
|
|
79
|
-
menu.choice :Minitest, -> { select_ci_platform('Minitest', automation) }
|
|
72
|
+
menu.choice :Cucumber, -> { select_accessibility('Cucumber', automation) }
|
|
73
|
+
menu.choice :Rspec, -> { select_accessibility('Rspec', automation) }
|
|
80
74
|
menu.choice :Quit, -> { exit }
|
|
81
75
|
end
|
|
82
76
|
end
|
|
83
77
|
|
|
84
|
-
FrameworkOptions = Struct.new(:automation, :framework, :
|
|
85
|
-
:ruby_version)
|
|
78
|
+
FrameworkOptions = Struct.new(:automation, :framework, :accessibility)
|
|
86
79
|
|
|
87
80
|
def create_framework_options(params)
|
|
88
|
-
FrameworkOptions.new(params[:automation], params[:framework], params[:
|
|
89
|
-
params[:accessibility], params[:visual], params[:performance], params[:ruby_version])
|
|
81
|
+
FrameworkOptions.new(params[:automation], params[:framework], params[:accessibility])
|
|
90
82
|
end
|
|
91
83
|
|
|
92
|
-
def
|
|
93
|
-
|
|
94
|
-
menu.choice :Allure, -> { select_accessibility(framework, automation_type, ci_platform, 'allure') }
|
|
95
|
-
menu.choice :JUnit, -> { select_accessibility(framework, automation_type, ci_platform, 'junit') }
|
|
96
|
-
menu.choice :JSON, -> { select_accessibility(framework, automation_type, ci_platform, 'json') }
|
|
97
|
-
menu.choice :Both, -> { select_accessibility(framework, automation_type, ci_platform, 'both') }
|
|
98
|
-
menu.choice :All, -> { select_accessibility(framework, automation_type, ci_platform, 'all') }
|
|
99
|
-
menu.choice :None, -> { select_accessibility(framework, automation_type, ci_platform, 'none') }
|
|
100
|
-
menu.choice :Quit, -> { exit }
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def select_accessibility(framework, automation_type, ci_platform = nil, reporter = nil)
|
|
105
|
-
return create_framework(framework, automation_type, ci_platform:, reporter:) if mobile_automation?(automation_type)
|
|
84
|
+
def select_accessibility(framework, automation_type)
|
|
85
|
+
return create_framework(framework, automation_type) if mobile_automation?(automation_type)
|
|
106
86
|
|
|
107
87
|
prompt.select('Add accessibility testing (axe)?') do |menu|
|
|
108
|
-
menu.choice :Yes, -> {
|
|
109
|
-
menu.choice :No, -> {
|
|
110
|
-
menu.choice :Quit, -> { exit }
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def select_visual(framework, automation_type, ci_platform = nil, reporter = nil, accessibility: false)
|
|
115
|
-
prompt.select('Add visual regression testing?') do |menu|
|
|
116
|
-
menu.choice :Yes, lambda {
|
|
117
|
-
select_performance(framework, automation_type, ci_platform, reporter, accessibility:, visual: true)
|
|
118
|
-
}
|
|
119
|
-
menu.choice :No, lambda {
|
|
120
|
-
select_performance(framework, automation_type, ci_platform, reporter, accessibility:)
|
|
121
|
-
}
|
|
122
|
-
menu.choice :Quit, -> { exit }
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
def select_performance(framework, automation_type, ci_platform = nil, reporter = nil, accessibility: false,
|
|
127
|
-
visual: false)
|
|
128
|
-
prompt.select('Add Lighthouse performance auditing?') do |menu|
|
|
129
|
-
menu.choice :Yes, lambda {
|
|
130
|
-
select_ruby_version(framework, automation_type, ci_platform:, reporter:, accessibility:, visual:,
|
|
131
|
-
performance: true)
|
|
132
|
-
}
|
|
133
|
-
menu.choice :No, lambda {
|
|
134
|
-
select_ruby_version(framework, automation_type, ci_platform:, reporter:, accessibility:, visual:)
|
|
135
|
-
}
|
|
136
|
-
menu.choice :Quit, -> { exit }
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def select_ruby_version(framework, automation_type, ci_platform: nil, reporter: nil, accessibility: false,
|
|
141
|
-
visual: false, performance: false)
|
|
142
|
-
prompt.select('Select Ruby version for your project') do |menu|
|
|
143
|
-
menu.choice :'3.4 (latest)', lambda {
|
|
144
|
-
create_framework(framework, automation_type, ci_platform:, reporter:, accessibility:, visual:, performance:,
|
|
145
|
-
ruby_version: '3.4')
|
|
146
|
-
}
|
|
147
|
-
menu.choice :'3.3', lambda {
|
|
148
|
-
create_framework(framework, automation_type, ci_platform:, reporter:, accessibility:, visual:, performance:,
|
|
149
|
-
ruby_version: '3.3')
|
|
150
|
-
}
|
|
151
|
-
menu.choice :'3.2', lambda {
|
|
152
|
-
create_framework(framework, automation_type, ci_platform:, reporter:, accessibility:, visual:, performance:,
|
|
153
|
-
ruby_version: '3.2')
|
|
154
|
-
}
|
|
155
|
-
menu.choice :'3.1', lambda {
|
|
156
|
-
create_framework(framework, automation_type, ci_platform:, reporter:, accessibility:, visual:, performance:,
|
|
157
|
-
ruby_version: '3.1')
|
|
158
|
-
}
|
|
88
|
+
menu.choice :Yes, -> { create_framework(framework, automation_type, accessibility: true) }
|
|
89
|
+
menu.choice :No, -> { create_framework(framework, automation_type) }
|
|
159
90
|
menu.choice :Quit, -> { exit }
|
|
160
91
|
end
|
|
161
92
|
end
|
|
@@ -164,26 +95,15 @@ class MenuGenerator
|
|
|
164
95
|
%w[ios android cross_platform].include?(automation_type)
|
|
165
96
|
end
|
|
166
97
|
|
|
167
|
-
def create_framework(framework, automation_type,
|
|
168
|
-
visual: false, performance: false, ruby_version: nil)
|
|
98
|
+
def create_framework(framework, automation_type, accessibility: false)
|
|
169
99
|
options = create_framework_options(automation: automation_type,
|
|
170
100
|
framework: framework.downcase,
|
|
171
|
-
|
|
172
|
-
reporter:,
|
|
173
|
-
accessibility:,
|
|
174
|
-
visual:,
|
|
175
|
-
performance:,
|
|
176
|
-
ruby_version:)
|
|
101
|
+
accessibility:)
|
|
177
102
|
|
|
178
103
|
puts 'Chosen Options:'
|
|
179
104
|
puts " Automation Type: #{options[:automation]}"
|
|
180
105
|
puts " Framework: #{options[:framework]}"
|
|
181
|
-
puts " CI Platform: #{options[:ci_platform]}" if options[:ci_platform]
|
|
182
|
-
puts " Reporter: #{options[:reporter]}" if options[:reporter]
|
|
183
106
|
puts ' Accessibility: enabled' if options[:accessibility]
|
|
184
|
-
puts ' Visual Testing: enabled' if options[:visual]
|
|
185
|
-
puts ' Performance Auditing: enabled' if options[:performance]
|
|
186
|
-
puts " Ruby Version: #{options[:ruby_version]}" if options[:ruby_version]
|
|
187
107
|
|
|
188
108
|
set_up_framework(options)
|
|
189
109
|
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
|
@@ -204,17 +124,7 @@ class MenuGenerator
|
|
|
204
124
|
|
|
205
125
|
def automation_options(menu)
|
|
206
126
|
menu.choice :Selenium, -> { choose_test_framework('selenium') }
|
|
207
|
-
menu.choice :Capybara, -> { choose_test_framework('capybara') }
|
|
208
127
|
menu.choice :Appium, -> { choose_test_framework('appium') }
|
|
209
128
|
menu.choice :Watir, -> { choose_test_framework('watir') }
|
|
210
129
|
end
|
|
211
|
-
|
|
212
|
-
def select_ci_platform(framework, automation)
|
|
213
|
-
prompt.select('Would you like to configure CI?') do |menu|
|
|
214
|
-
menu.choice :'Github Actions', -> { select_reporter(framework, automation, 'github') }
|
|
215
|
-
menu.choice :'Gitlab CI/CD', -> { select_reporter(framework, automation, 'gitlab') }
|
|
216
|
-
menu.choice :No, -> { select_reporter(framework, automation) }
|
|
217
|
-
menu.choice :Quit, -> { exit }
|
|
218
|
-
end
|
|
219
|
-
end
|
|
220
130
|
end
|
|
@@ -15,21 +15,10 @@ class RspecGenerator < Generator
|
|
|
15
15
|
template('spec.tt', "#{name}/spec/pdp_page_spec.rb")
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def generate_visual_spec
|
|
19
|
-
return unless visual_addon? && web?
|
|
20
|
-
|
|
21
|
-
template('visual_spec.tt', "#{name}/spec/visual_spec.rb")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
18
|
def generate_accessibility_spec
|
|
25
19
|
return unless axe_addon? && web?
|
|
26
20
|
|
|
27
21
|
template('accessibility_spec.tt', "#{name}/spec/accessibility_spec.rb")
|
|
28
22
|
end
|
|
29
23
|
|
|
30
|
-
def generate_performance_spec
|
|
31
|
-
return unless lighthouse_addon? && web?
|
|
32
|
-
|
|
33
|
-
template('performance_spec.tt', "#{name}/spec/performance_spec.rb")
|
|
34
|
-
end
|
|
35
24
|
end
|
|
@@ -4,9 +4,7 @@ require_relative '../helpers/spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe 'Accessibility' do
|
|
6
6
|
before do
|
|
7
|
-
<% if
|
|
8
|
-
visit '/'
|
|
9
|
-
<% elsif watir? -%>
|
|
7
|
+
<% if watir? -%>
|
|
10
8
|
browser.goto 'https://raider-test-site.onrender.com/'
|
|
11
9
|
<% else -%>
|
|
12
10
|
driver.get 'https://raider-test-site.onrender.com/'
|
|
@@ -14,9 +12,7 @@ driver.get 'https://raider-test-site.onrender.com/'
|
|
|
14
12
|
end
|
|
15
13
|
|
|
16
14
|
it 'has no accessibility violations on the page' do
|
|
17
|
-
<% if
|
|
18
|
-
expect(page).to be_axe_clean
|
|
19
|
-
<% elsif watir? -%>
|
|
15
|
+
<% if watir? -%>
|
|
20
16
|
expect(browser.driver).to be_axe_clean
|
|
21
17
|
<% else -%>
|
|
22
18
|
expect(driver).to be_axe_clean
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%- if selenium_based? || watir?
|
|
1
|
+
<%- if selenium_based? || watir? -%>
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative '../helpers/spec_helper'
|
|
@@ -10,16 +10,15 @@ require_relative '../page_objects/pages/login'
|
|
|
10
10
|
# require 'debug' # Ruby's built-in debugger (binding.break)
|
|
11
11
|
# require 'pry' # Pry debugger (binding.pry)
|
|
12
12
|
|
|
13
|
-
<%- if selenium_based? || watir? || capybara? -%>
|
|
14
13
|
describe 'Login' do
|
|
15
14
|
subject(:header) { account_page.header.customer_name }
|
|
16
15
|
|
|
17
16
|
let(:user) { ModelFactory.for('users')['registered user'] }
|
|
18
|
-
let(:login_page) { <% if
|
|
19
|
-
let(:account_page) { <% if
|
|
17
|
+
let(:login_page) { <% if watir? -%>Login.new(browser)<% else -%>Login.new(driver)<% end -%> }
|
|
18
|
+
let(:account_page) { <% if watir? -%>Account.new(browser)<% else -%>Account.new(driver)<% end -%> }
|
|
20
19
|
|
|
21
20
|
before do
|
|
22
|
-
login_page
|
|
21
|
+
login_page.visit
|
|
23
22
|
login_page.login(user['username'], password)
|
|
24
23
|
end
|
|
25
24
|
|
|
@@ -28,7 +27,7 @@ describe 'Login' do
|
|
|
28
27
|
|
|
29
28
|
it 'can successfully log in' do
|
|
30
29
|
# binding.break # Uncomment to pause here and inspect state
|
|
31
|
-
account_page
|
|
30
|
+
account_page.visit
|
|
32
31
|
expect(header).to eq "Welcome back #{user['name']}"
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -37,12 +36,11 @@ describe 'Login' do
|
|
|
37
36
|
let(:password) { 'wrongPassword' }
|
|
38
37
|
|
|
39
38
|
it 'cannot log in' do
|
|
40
|
-
login_page
|
|
39
|
+
login_page.visit
|
|
41
40
|
expect(header).to eq 'Login or register'
|
|
42
41
|
end
|
|
43
42
|
end
|
|
44
43
|
end
|
|
45
|
-
<%- end -%>
|
|
46
44
|
<%- else -%>
|
|
47
45
|
<% if cross_platform? -%>
|
|
48
46
|
require_relative '../helpers/appium_helper'
|