ruby_raider 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +13 -0
- data/Rakefile +12 -0
- data/lib/desktop/base_screen.rb +5 -0
- data/lib/desktop/installation_screen.rb +137 -0
- data/lib/desktop/runner_screen.rb +123 -0
- data/lib/generators/automation/automation_examples_generator.rb +36 -0
- data/lib/generators/automation/automation_generator.rb +28 -0
- data/lib/generators/cucumber/cucumber_examples_generator.rb +17 -0
- data/lib/generators/cucumber/cucumber_generator.rb +13 -0
- data/lib/generators/generator.rb +2 -2
- data/lib/generators/invoke_generators.rb +47 -0
- data/lib/generators/menu_generator.rb +24 -27
- data/lib/generators/rspec/rspec_examples_generator.rb +17 -0
- data/lib/generators/rspec/rspec_generator.rb +9 -0
- data/lib/ruby_raider.rb +7 -0
- data/ruby_raider.gemspec +2 -1
- data/spec/automation_generator_spec.rb +71 -15
- data/spec/cucumber_generator_spec.rb +29 -1
- data/spec/rspec_generator_spec.rb +21 -1
- data/spec/spec_helper.rb +20 -5
- metadata +63 -41
- data/lib/generators/automation_generator.rb +0 -59
- data/lib/generators/cucumber_generator.rb +0 -25
- data/lib/generators/rspec_generator.rb +0 -21
- /data/lib/generators/{templates/automation → automation/templates}/abstract_component.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/abstract_page.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/app_page.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/appium_caps.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/component.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/home_page.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/login_page.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/android_caps.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/cross_platform_caps.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/element.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/home_page_selector.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/initialize_selector.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/ios_caps.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/pdp_page_selector.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/require_raider.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/selenium_login.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/url_methods.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/visit_method.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/visual_login.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/partials/watir_login.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/pdp_page.tt +0 -0
- /data/lib/generators/{templates/automation → automation/templates}/visual_options.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/env.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/feature.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/partials/appium_env.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/partials/driver_world.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/partials/mobile_steps.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/partials/selenium_appium_env.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/partials/watir_env.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/partials/watir_world.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/partials/web_steps.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/steps.tt +0 -0
- /data/lib/generators/{templates/cucumber → cucumber/templates}/world.tt +0 -0
- /data/lib/generators/{templates/rspec → rspec/templates}/base_spec.tt +0 -0
- /data/lib/generators/{templates/rspec → rspec/templates}/spec.tt +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5a0388aca21402e7be2b8d5ca425f3041941f3ad881447bce6f90569414403a
|
4
|
+
data.tar.gz: 7efeafb1ac1f8ab1549f7105da42a5687ef493681816ecf814778eadfa084549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a307df303d10f89f67a3efc9997d330ec2b29796f6ad29d5f7cddf4197e532a4bb545414a0a00a0503cfaa5bf34e1d936044e3119560157cd31c5b0194d17d55
|
7
|
+
data.tar.gz: b6e18d3e3fcb74f2127bea109c66e68302af4baf1def97ca3b6f6d3bc1ee027f642d4bbb7794f491477af7f5b00995abb4ec1b1977cde83687649737e2bb7a1b
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# These are supported funding model platforms
|
2
|
+
|
3
|
+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [ruby_raider]
|
4
|
+
patreon: # Replace with a single Patreon username
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
11
|
+
otechie: # Replace with a single Otechie username
|
12
|
+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
13
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
data/Rakefile
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require_relative 'lib/ruby_raider'
|
4
4
|
require_relative 'lib/commands/scaffolding_commands'
|
5
|
+
require_relative 'lib/desktop/installation_screen'
|
6
|
+
require_relative 'lib/desktop/runner_screen'
|
5
7
|
|
6
8
|
desc 'Creates a new test project'
|
7
9
|
task :new, [:name] do |_t, args|
|
@@ -27,3 +29,13 @@ desc 'Download mobile builds'
|
|
27
29
|
task :builds, [:type] do |_t, args|
|
28
30
|
ScaffoldingCommands.new.invoke(:download_builds, nil, %W[#{args.type}])
|
29
31
|
end
|
32
|
+
|
33
|
+
desc 'Open the desktop app'
|
34
|
+
task :open do
|
35
|
+
InstallationScreen.new.launch
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'Open the run screen'
|
39
|
+
task :runner do
|
40
|
+
RunnerScreen.new.launch
|
41
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base_screen'
|
4
|
+
require_relative '../generators/invoke_generators'
|
5
|
+
|
6
|
+
class InstallationScreen < BaseScreen
|
7
|
+
include InvokeGenerators
|
8
|
+
|
9
|
+
attr_accessor :entry_text
|
10
|
+
|
11
|
+
def launch
|
12
|
+
window('Ruby Raider', 800, 600) do
|
13
|
+
margined true
|
14
|
+
tab do
|
15
|
+
tab_item('Installer') do
|
16
|
+
vertical_box do
|
17
|
+
vertical_box do
|
18
|
+
stretchy false
|
19
|
+
label('Project Name') do
|
20
|
+
stretchy false
|
21
|
+
end
|
22
|
+
|
23
|
+
entry do
|
24
|
+
stretchy false # Smart default option for appending to horizontal_box
|
25
|
+
text <=> [self, :entry_text, { after_write: lambda { |text|
|
26
|
+
@project_name = text
|
27
|
+
$stdout.flush
|
28
|
+
} }] # bidirectional data-binding between text property and entry_text attribute, printing after write to model.
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
vertical_box do
|
33
|
+
stretchy false
|
34
|
+
|
35
|
+
@radio = radio_buttons do
|
36
|
+
stretchy false
|
37
|
+
|
38
|
+
items 'Web', 'Mobile'
|
39
|
+
selected_item 'Web'
|
40
|
+
on_selected do |buttons|
|
41
|
+
if buttons.selected_item == 'Web'
|
42
|
+
@mobile_automation.hide
|
43
|
+
@platforms.hide
|
44
|
+
@web_automation.show
|
45
|
+
else
|
46
|
+
@web_automation.hide
|
47
|
+
@mobile_automation.show
|
48
|
+
@platforms.show
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
@mobile_automation = combobox do
|
54
|
+
stretchy false
|
55
|
+
visible false
|
56
|
+
items 'Appium'
|
57
|
+
selected_item 'Appium'
|
58
|
+
end
|
59
|
+
|
60
|
+
@web_automation = combobox do
|
61
|
+
stretchy false
|
62
|
+
visible true
|
63
|
+
items 'Selenium', 'Watir'
|
64
|
+
selected_item 'Selenium'
|
65
|
+
end
|
66
|
+
|
67
|
+
@platforms = combobox do
|
68
|
+
stretchy false
|
69
|
+
visible false
|
70
|
+
items 'Android', 'iOS', 'Cross-Platform'
|
71
|
+
selected_item 'iOS'
|
72
|
+
end
|
73
|
+
|
74
|
+
@framework = combobox do
|
75
|
+
stretchy false
|
76
|
+
visible true
|
77
|
+
items 'Cucumber', 'Rspec'
|
78
|
+
selected_item 'Cucumber'
|
79
|
+
|
80
|
+
on_selected do |items|
|
81
|
+
if items.selected_item == 'Rspec' && @radio.selected_item != 'Mobile'
|
82
|
+
@visual_checkbox.show
|
83
|
+
else
|
84
|
+
@visual_checkbox.hide
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
@visual_checkbox = checkbox('Applitools integration') do
|
90
|
+
stretchy false
|
91
|
+
visible false
|
92
|
+
end
|
93
|
+
|
94
|
+
@example_checkbox = checkbox('Add example files') do
|
95
|
+
stretchy false
|
96
|
+
visible true
|
97
|
+
end
|
98
|
+
|
99
|
+
button('Create Project') do
|
100
|
+
stretchy false
|
101
|
+
on_clicked do
|
102
|
+
automation = if @web_automation.visible?
|
103
|
+
@web_automation.selected_item
|
104
|
+
else
|
105
|
+
@mobile_automation.selected_item
|
106
|
+
end
|
107
|
+
structure = {
|
108
|
+
automation: automation,
|
109
|
+
examples: @example_checkbox.checked,
|
110
|
+
framework: @framework.selected_item,
|
111
|
+
generators: %w[Automation Common Helpers],
|
112
|
+
name: @project_name,
|
113
|
+
visual: @visual_checkbox.checked
|
114
|
+
}
|
115
|
+
generate_framework(structure)
|
116
|
+
@installation_box.text = if File.directory?(@project_name)
|
117
|
+
"Your project has been created, close this window, go to the folder #{@project_name} and run 'raider open'"
|
118
|
+
else
|
119
|
+
'There was a problem creating your project try again'
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
vertical_box do
|
125
|
+
stretchy false
|
126
|
+
@installation_box = multiline_entry do
|
127
|
+
stretchy false
|
128
|
+
text 'Your installation result will appear here...'
|
129
|
+
$stdout.flush
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end.show
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open3'
|
4
|
+
require 'yaml'
|
5
|
+
require_relative 'base_screen'
|
6
|
+
|
7
|
+
class RunnerScreen < BaseScreen
|
8
|
+
attr_accessor :contacts
|
9
|
+
|
10
|
+
CONFIG_ITEM = Struct.new(:attribute, :value)
|
11
|
+
CAP = Struct.new(:attribute, :value)
|
12
|
+
|
13
|
+
if File.directory?('spec')
|
14
|
+
@folder = 'spec'
|
15
|
+
@framework = 'rspec'
|
16
|
+
@extension = '*_spec.rb'
|
17
|
+
else
|
18
|
+
@folder = 'features'
|
19
|
+
@framework = 'cucumber'
|
20
|
+
@extension = '*.features'
|
21
|
+
end
|
22
|
+
|
23
|
+
window('Ruby Raider', 1200, 800) do
|
24
|
+
margined true
|
25
|
+
vertical_box do
|
26
|
+
grid do
|
27
|
+
stretchy false
|
28
|
+
|
29
|
+
button('▶') do
|
30
|
+
left 0
|
31
|
+
on_clicked do
|
32
|
+
output = Open3.popen3("#{@framework} #{@tests.selected_item}") do |_stdin, stdout, _stderr|
|
33
|
+
stdout.read
|
34
|
+
end
|
35
|
+
system "rspec #{@tests.selected_item}"
|
36
|
+
@results.text = output
|
37
|
+
end
|
38
|
+
end
|
39
|
+
button('■') do
|
40
|
+
left 1
|
41
|
+
on_clicked do
|
42
|
+
pp 'The stop feature will be implemented in a later release'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
@tests = combobox do
|
47
|
+
left 2
|
48
|
+
files = Dir.glob(File.join(@folder, @extension))
|
49
|
+
items files
|
50
|
+
selected_item files.first
|
51
|
+
@file = File.open(files.first)
|
52
|
+
|
53
|
+
on_selected do |items|
|
54
|
+
@results.text = ''
|
55
|
+
path = items.selected_item
|
56
|
+
@file = File.open(path)
|
57
|
+
@text_box.text = @file.read
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
button('Open Dashboard') do
|
62
|
+
left 3
|
63
|
+
halign :end
|
64
|
+
on_clicked do
|
65
|
+
system 'allure serve allure-reports'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
tab do
|
71
|
+
stretchy true
|
72
|
+
|
73
|
+
tab_item('Tests') do
|
74
|
+
horizontal_box do
|
75
|
+
@text_box = multiline_entry do
|
76
|
+
text @file.read
|
77
|
+
|
78
|
+
on_changed do |e|
|
79
|
+
File.write(@tests.selected_item, e.text)
|
80
|
+
$stdout.flush # for Windows
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
@results = multiline_entry do
|
85
|
+
text ''
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
tab_item('Configuration') do
|
91
|
+
@config = YAML.load_file('config/config.yml')
|
92
|
+
config_items = @config.map { |key, value| CONFIG_ITEM.new(key, value) }
|
93
|
+
vertical_box do
|
94
|
+
refined_table(
|
95
|
+
model_array: config_items,
|
96
|
+
table_columns: {
|
97
|
+
'Attribute' => :text,
|
98
|
+
'Value' => { text: { editable: true } }
|
99
|
+
},
|
100
|
+
table_editable: true,
|
101
|
+
per_page: 20
|
102
|
+
)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
tab_item('Capabilities') do
|
106
|
+
caps = File.exist?('config/capabilities.yml') ? YAML.load_file('config/capabilities.yml') : []
|
107
|
+
caps = caps.map { |key, value| CAP.new(key, value) }
|
108
|
+
vertical_box do
|
109
|
+
refined_table(
|
110
|
+
model_array: caps,
|
111
|
+
table_columns: {
|
112
|
+
'Attribute' => :text,
|
113
|
+
'Value' => { text: { editable: true } }
|
114
|
+
},
|
115
|
+
table_editable: true,
|
116
|
+
per_page: 20
|
117
|
+
)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end.show
|
123
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../generator'
|
4
|
+
|
5
|
+
class AutomationExamplesGenerator < Generator
|
6
|
+
def generate_login_page
|
7
|
+
return unless (@_initializer.first & %w[android ios cross_platform]).empty?
|
8
|
+
|
9
|
+
template('login_page.tt', "#{name}/page_objects/pages/login_page.rb")
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_home_page
|
13
|
+
return if (@_initializer.first & %w[android ios cross_platform]).empty?
|
14
|
+
|
15
|
+
template('home_page.tt', "#{name}/page_objects/pages/home_page.rb")
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate_pdp_page
|
19
|
+
return if (@_initializer.first & %w[android ios cross_platform]).empty?
|
20
|
+
|
21
|
+
template('pdp_page.tt', "#{name}/page_objects/pages/pdp_page.rb")
|
22
|
+
end
|
23
|
+
|
24
|
+
def generate_header_component
|
25
|
+
return unless (@_initializer.first & %w[android ios cross_platform]).empty?
|
26
|
+
return if @_initializer.first.last
|
27
|
+
|
28
|
+
template('component.tt', "#{name}/page_objects/components/header_component.rb")
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_app_page
|
32
|
+
return unless @_initializer.first.last
|
33
|
+
|
34
|
+
template('app_page.tt', "#{name}/page_objects/pages/app_page.rb")
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../generator'
|
4
|
+
|
5
|
+
class AutomationGenerator < Generator
|
6
|
+
def generate_abstract_page
|
7
|
+
template('abstract_page.tt', "#{name}/page_objects/abstract/abstract_page.rb")
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate_abstract_component
|
11
|
+
return unless (@_initializer.first & %w[android ios cross_platform]).empty?
|
12
|
+
return if @_initializer.first.last
|
13
|
+
|
14
|
+
template('abstract_component.tt', "#{name}/page_objects/abstract/abstract_component.rb")
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate_appium_settings
|
18
|
+
return if (@_initializer.first & %w[android ios cross_platform]).empty?
|
19
|
+
|
20
|
+
template('appium_caps.tt', "#{name}/config/capabilities.yml")
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_visual_options
|
24
|
+
return unless @_initializer.first.last
|
25
|
+
|
26
|
+
template('visual_options.tt', "#{name}/config/options.yml")
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../generator'
|
4
|
+
|
5
|
+
class CucumberExamplesGenerator < Generator
|
6
|
+
def generate_feature
|
7
|
+
template('feature.tt', "#{name}/features/#{template_name}.feature")
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate_steps
|
11
|
+
template('steps.tt', "#{name}/features/step_definitions/#{template_name}_steps.rb")
|
12
|
+
end
|
13
|
+
|
14
|
+
def template_name
|
15
|
+
@template_name ||= (@_initializer.first & %w[android ios cross_platform]).empty? ? 'login' : 'home'
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../generator'
|
4
|
+
|
5
|
+
class CucumberGenerator < Generator
|
6
|
+
def generate_env_file
|
7
|
+
template('env.tt', "#{name}/features/support/env.rb")
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate_world
|
11
|
+
template('world.tt', "#{name}/world.rb")
|
12
|
+
end
|
13
|
+
end
|
data/lib/generators/generator.rb
CHANGED
@@ -10,7 +10,7 @@ class Generator < Thor::Group
|
|
10
10
|
argument :name
|
11
11
|
argument :visual_automation, optional: true
|
12
12
|
|
13
|
-
def self.
|
14
|
-
|
13
|
+
def self.source_paths
|
14
|
+
%W[#{File.dirname(__FILE__)}/automation/templates #{File.dirname(__FILE__)}/cucumber/templates #{File.dirname(__FILE__)}/rspec/templates #{File.dirname(__FILE__)}/templates]
|
15
15
|
end
|
16
16
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative 'automation/automation_generator'
|
2
|
+
require_relative 'automation/automation_examples_generator'
|
3
|
+
require_relative 'common_generator'
|
4
|
+
require_relative 'cucumber/cucumber_generator'
|
5
|
+
require_relative 'cucumber/cucumber_examples_generator'
|
6
|
+
require_relative 'helper_generator'
|
7
|
+
require_relative 'rspec/rspec_generator'
|
8
|
+
require_relative 'rspec/rspec_examples_generator'
|
9
|
+
|
10
|
+
module InvokeGenerators
|
11
|
+
def generate_framework(structure = {})
|
12
|
+
generators = %w[Automation Common Helpers]
|
13
|
+
add_generator(generators, structure[:framework].capitalize)
|
14
|
+
generators = add_examples(generators) if structure[:examples]
|
15
|
+
generators.each do |generator|
|
16
|
+
invoke_generator({
|
17
|
+
automation: structure[:automation],
|
18
|
+
framework: structure[:framework],
|
19
|
+
generator: generator,
|
20
|
+
name: structure[:name],
|
21
|
+
visual: structure[:visual]
|
22
|
+
})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_generator(generators, *gens)
|
27
|
+
gens.each { |generator| generators.push generator }
|
28
|
+
end
|
29
|
+
|
30
|
+
def add_examples(generators)
|
31
|
+
if generators.include?('Cucumber')
|
32
|
+
generators.push('CucumberExamples')
|
33
|
+
else
|
34
|
+
generators.push('RspecExamples')
|
35
|
+
end
|
36
|
+
|
37
|
+
generators.push('AutomationExamples')
|
38
|
+
end
|
39
|
+
|
40
|
+
def invoke_generator(structure = {})
|
41
|
+
Object.const_get("#{structure[:generator]}Generator")
|
42
|
+
.new([structure[:automation],
|
43
|
+
structure[:framework],
|
44
|
+
structure[:name],
|
45
|
+
structure[:visual]]).invoke_all
|
46
|
+
end
|
47
|
+
end
|
@@ -1,19 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'tty-prompt'
|
4
|
-
require_relative '
|
5
|
-
require_relative 'common_generator'
|
6
|
-
require_relative 'cucumber_generator'
|
7
|
-
require_relative 'helper_generator'
|
8
|
-
require_relative 'rspec_generator'
|
4
|
+
require_relative '../generators/invoke_generators'
|
9
5
|
|
10
6
|
class MenuGenerator
|
11
|
-
attr_reader :prompt, :name
|
7
|
+
attr_reader :prompt, :name
|
8
|
+
|
9
|
+
include InvokeGenerators
|
12
10
|
|
13
11
|
def initialize(project_name)
|
14
12
|
@prompt = TTY::Prompt.new
|
15
13
|
@name = project_name
|
16
|
-
@generators = %w[Automation Common Helpers]
|
17
14
|
end
|
18
15
|
|
19
16
|
def generate_choice_menu
|
@@ -27,7 +24,7 @@ class MenuGenerator
|
|
27
24
|
|
28
25
|
def choose_visual_automation
|
29
26
|
prompt.select('Do you want to add visual automation with applitools?') do |menu|
|
30
|
-
menu.choice :Yes, -> { true
|
27
|
+
menu.choice :Yes, -> { true }
|
31
28
|
menu.choice :No, -> { false }
|
32
29
|
menu.choice :Quit, -> { exit }
|
33
30
|
end
|
@@ -39,8 +36,15 @@ class MenuGenerator
|
|
39
36
|
select_test_framework(automation)
|
40
37
|
end
|
41
38
|
|
42
|
-
def set_up_framework(automation, framework, visual_automation)
|
43
|
-
|
39
|
+
def set_up_framework(automation, framework, visual_automation, with_examples)
|
40
|
+
structure = {
|
41
|
+
automation: automation,
|
42
|
+
framework: framework,
|
43
|
+
name: @name,
|
44
|
+
visual: visual_automation,
|
45
|
+
examples: with_examples
|
46
|
+
}
|
47
|
+
generate_framework(structure)
|
44
48
|
system "cd #{name} && gem install bundler && bundle install"
|
45
49
|
end
|
46
50
|
|
@@ -53,35 +57,28 @@ class MenuGenerator
|
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
56
|
-
def generate_framework(automation, framework, visual_automation)
|
57
|
-
add_generator framework.capitalize
|
58
|
-
generators.each { |generator| invoke_generator(automation, framework, generator, visual_automation) }
|
59
|
-
end
|
60
|
-
|
61
|
-
protected
|
62
|
-
|
63
|
-
def add_generator(*opts)
|
64
|
-
opts.each { |opt| @generators.push opt }
|
65
|
-
end
|
66
|
-
|
67
60
|
private
|
68
61
|
|
69
|
-
def framework_choice(framework, automation_type)
|
62
|
+
def framework_choice(framework, automation_type, with_examples: true)
|
70
63
|
visual_automation = choose_visual_automation if %w[selenium watir].include?(automation_type) && framework == 'Rspec'
|
71
64
|
|
72
|
-
set_up_framework(automation_type, framework.downcase, visual_automation)
|
65
|
+
set_up_framework(automation_type, framework.downcase, visual_automation, with_examples)
|
73
66
|
prompt.say("You have chosen to use #{framework} with #{automation_type}")
|
74
67
|
end
|
75
68
|
|
76
69
|
def select_test_framework(automation)
|
77
70
|
prompt.select('Please select your test framework') do |menu|
|
78
|
-
menu.choice :Cucumber, -> {
|
79
|
-
menu.choice :Rspec, -> {
|
71
|
+
menu.choice :Cucumber, -> { select_example_files('Cucumber', automation) }
|
72
|
+
menu.choice :Rspec, -> { select_example_files('Rspec', automation) }
|
80
73
|
menu.choice :Quit, -> { exit }
|
81
74
|
end
|
82
75
|
end
|
83
76
|
|
84
|
-
def
|
85
|
-
|
77
|
+
def select_example_files(framework, automation)
|
78
|
+
prompt.select('Would you like to create example files?') do |menu|
|
79
|
+
menu.choice :Yes, -> { framework_choice(framework, automation) }
|
80
|
+
menu.choice :No, -> { framework_choice(framework, automation, with_examples: false) }
|
81
|
+
menu.choice :Quit, -> { exit }
|
82
|
+
end
|
86
83
|
end
|
87
84
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../generator'
|
4
|
+
|
5
|
+
class RspecExamplesGenerator < Generator
|
6
|
+
def generate_login_spec
|
7
|
+
return unless (@_initializer.first & %w[android ios cross_platform]).empty?
|
8
|
+
|
9
|
+
template('spec.tt', "#{name}/spec/login_page_spec.rb")
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_pdp_spec
|
13
|
+
return if (@_initializer.first & %w[android ios cross_platform]).empty?
|
14
|
+
|
15
|
+
template('spec.tt', "#{name}/spec/pdp_page_spec.rb")
|
16
|
+
end
|
17
|
+
end
|
data/lib/ruby_raider.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require_relative '../lib/commands/open_ai_commands'
|
4
4
|
require_relative '../lib/commands/scaffolding_commands'
|
5
5
|
require_relative '../lib/commands/utility_commands'
|
6
|
+
require_relative '../lib/desktop/installation_screen'
|
7
|
+
require_relative '../lib/desktop/runner_screen'
|
6
8
|
|
7
9
|
module RubyRaider
|
8
10
|
class Raider < Thor
|
@@ -14,6 +16,11 @@ module RubyRaider
|
|
14
16
|
|
15
17
|
map '-n' => 'new'
|
16
18
|
|
19
|
+
desc 'open', 'It opens the Ruby Raider desktop app'
|
20
|
+
def open
|
21
|
+
InstallationScreen.new.launch
|
22
|
+
end
|
23
|
+
|
17
24
|
desc 'version', 'It shows the version of Ruby Raider you are currently using'
|
18
25
|
def version
|
19
26
|
spec = Gem::Specification.find_by_name('ruby_raider')
|
data/ruby_raider.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ruby_raider'
|
5
|
-
s.version = '0.5.
|
5
|
+
s.version = '0.5.7'
|
6
6
|
s.summary = 'A gem to make setup and start of UI automation projects easier'
|
7
7
|
s.description = 'This gem has everything you need to start working with test automation'
|
8
8
|
s.authors = ['Agustin Pequeno']
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
|
23
23
|
|
24
24
|
s.add_runtime_dependency 'faraday', '~> 2.7'
|
25
|
+
s.add_runtime_dependency 'glimmer-dsl-libui', '~> 0.7.3'
|
25
26
|
s.add_runtime_dependency 'ruby-openai', '~> 3.5'
|
26
27
|
s.add_runtime_dependency 'thor', '~> 1.2.1'
|
27
28
|
s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
|