ruby_raider 0.5.9 → 0.6.1
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/auto_assign-issues.yml +8 -0
- data/.github/workflows/rspec.yml +2 -0
- data/.reek.yml +5 -1
- data/Rakefile +1 -7
- data/lib/commands/open_ai_commands.rb +9 -7
- data/lib/commands/scaffolding_commands.rb +35 -24
- data/lib/commands/utility_commands.rb +19 -7
- data/lib/desktop/components/base_component.rb +18 -0
- data/lib/desktop/components/runner_components.rb +185 -0
- data/lib/desktop/screens/runner_screen.rb +20 -0
- data/lib/generators/automation/automation_examples_generator.rb +14 -11
- data/lib/generators/automation/automation_generator.rb +4 -4
- data/lib/generators/automation/templates/partials/selenium_login.tt +5 -5
- data/lib/generators/automation/templates/partials/url_methods.tt +1 -0
- data/lib/generators/automation/templates/partials/watir_login.tt +1 -1
- data/lib/generators/common_generator.rb +11 -3
- data/lib/generators/generator.rb +21 -1
- data/lib/generators/helper_generator.rb +21 -18
- data/lib/generators/invoke_generators.rb +5 -2
- data/lib/generators/menu_generator.rb +38 -19
- data/lib/generators/rspec/rspec_examples_generator.rb +14 -2
- data/lib/generators/rspec/templates/base_spec.tt +3 -1
- data/lib/generators/rspec/templates/data.tt +4 -0
- data/lib/generators/rspec/templates/factory.tt +10 -0
- data/lib/generators/rspec/templates/spec.tt +11 -7
- data/lib/generators/templates/common/gemfile.tt +5 -0
- data/lib/generators/templates/common/reek.tt +9 -0
- data/lib/generators/templates/common/rubocop.tt +92 -0
- data/lib/generators/templates/helpers/driver_helper.tt +2 -2
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +3 -1
- data/lib/generators/templates/helpers/raider_helper.tt +0 -1
- data/lib/open_ai/open_ai.rb +13 -7
- data/lib/ruby_raider.rb +6 -7
- data/lib/utilities/utilities.rb +6 -18
- data/ruby_raider.gemspec +1 -1
- data/spec/common_generator_spec.rb +11 -5
- data/spec/open_ai_commands_spec.rb +5 -4
- data/spec/rspec_generator_spec.rb +12 -0
- data/spec/ruby_raider_spec.rb +31 -0
- data/spec/spec_helper.rb +4 -12
- metadata +11 -7
- data/lib/desktop/base_screen.rb +0 -5
- data/lib/desktop/installation_screen.rb +0 -137
- data/lib/desktop/runner_screen.rb +0 -123
- data/lib/generators/templates/helpers/partials/require_automation.tt +0 -3
- data/lib/generators/templates/helpers/selenium_helper.tt +0 -36
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require_relative 'spec_helper'
|
3
|
+
require_relative '../lib/ruby_raider'
|
4
|
+
|
5
|
+
describe RubyRaider do
|
6
|
+
shared_examples 'execute framework' do |name|
|
7
|
+
it 'runs the tests' do
|
8
|
+
Bundler.with_unbundled_env do
|
9
|
+
Dir.chdir(name) do
|
10
|
+
`bundle exec raider u browser_options headless | raider u raid`
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with a Rspec and Selenium project' do
|
17
|
+
include_examples 'execute framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with a Rspec and Watir project' do
|
21
|
+
include_examples 'execute framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}"
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with a Cucumber and Selenium project' do
|
25
|
+
include_examples 'execute framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'with a Cucumber and Watir project' do
|
29
|
+
include_examples 'execute framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[3]}"
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,27 +3,19 @@
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'rspec'
|
5
5
|
require_relative '../lib/generators/invoke_generators'
|
6
|
+
require_relative 'support/settings_helper'
|
6
7
|
|
7
8
|
AUTOMATION_TYPES = %w[android ios selenium watir cross_platform].freeze
|
8
9
|
FRAMEWORKS = %w[cucumber rspec].freeze
|
9
10
|
|
10
|
-
def create_settings(framework, automation, examples, visual)
|
11
|
-
{
|
12
|
-
automation: automation,
|
13
|
-
examples: examples,
|
14
|
-
framework: framework,
|
15
|
-
name: "#{framework}_#{automation}#{'_visual' if visual}#{'_without_examples' unless examples}",
|
16
|
-
visual: visual
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
11
|
RSpec.configure do |config|
|
21
12
|
config.include(InvokeGenerators)
|
13
|
+
config.include(SettingsHelper)
|
22
14
|
config.before(:all) do
|
23
15
|
FRAMEWORKS.each do |framework|
|
24
16
|
AUTOMATION_TYPES.each do |automation|
|
25
17
|
[true, false].product([true, false]) do |examples, visual|
|
26
|
-
settings = create_settings(framework, automation, examples, visual)
|
18
|
+
settings = create_settings(framework: framework, automation: automation, examples: examples, visual: visual)
|
27
19
|
generate_framework(settings)
|
28
20
|
end
|
29
21
|
end
|
@@ -34,7 +26,7 @@ RSpec.configure do |config|
|
|
34
26
|
FRAMEWORKS.each do |framework|
|
35
27
|
AUTOMATION_TYPES.each do |automation|
|
36
28
|
[true, false].product([true, false]) do |examples, visual|
|
37
|
-
settings = create_settings(framework, automation, examples, visual)
|
29
|
+
settings = create_settings(framework: framework, automation: automation, examples: examples, visual: visual)
|
38
30
|
FileUtils.rm_rf(settings[:name])
|
39
31
|
end
|
40
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_raider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pequeno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- ".github/FUNDING.yml"
|
189
189
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
190
190
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
191
|
+
- ".github/auto_assign-issues.yml"
|
191
192
|
- ".github/workflows/reek.yml"
|
192
193
|
- ".github/workflows/rspec.yml"
|
193
194
|
- ".github/workflows/rubocop.yml"
|
@@ -204,9 +205,9 @@ files:
|
|
204
205
|
- lib/commands/open_ai_commands.rb
|
205
206
|
- lib/commands/scaffolding_commands.rb
|
206
207
|
- lib/commands/utility_commands.rb
|
207
|
-
- lib/desktop/
|
208
|
-
- lib/desktop/
|
209
|
-
- lib/desktop/runner_screen.rb
|
208
|
+
- lib/desktop/components/base_component.rb
|
209
|
+
- lib/desktop/components/runner_components.rb
|
210
|
+
- lib/desktop/screens/runner_screen.rb
|
210
211
|
- lib/generators/automation/automation_examples_generator.rb
|
211
212
|
- lib/generators/automation/automation_generator.rb
|
212
213
|
- lib/generators/automation/templates/abstract_component.tt
|
@@ -252,6 +253,8 @@ files:
|
|
252
253
|
- lib/generators/rspec/rspec_examples_generator.rb
|
253
254
|
- lib/generators/rspec/rspec_generator.rb
|
254
255
|
- lib/generators/rspec/templates/base_spec.tt
|
256
|
+
- lib/generators/rspec/templates/data.tt
|
257
|
+
- lib/generators/rspec/templates/factory.tt
|
255
258
|
- lib/generators/rspec/templates/spec.tt
|
256
259
|
- lib/generators/templates/common/config.tt
|
257
260
|
- lib/generators/templates/common/gemfile.tt
|
@@ -260,6 +263,8 @@ files:
|
|
260
263
|
- lib/generators/templates/common/partials/web_config.tt
|
261
264
|
- lib/generators/templates/common/rakefile.tt
|
262
265
|
- lib/generators/templates/common/read_me.tt
|
266
|
+
- lib/generators/templates/common/reek.tt
|
267
|
+
- lib/generators/templates/common/rubocop.tt
|
263
268
|
- lib/generators/templates/helpers/allure_helper.tt
|
264
269
|
- lib/generators/templates/helpers/appium_helper.tt
|
265
270
|
- lib/generators/templates/helpers/browser_helper.tt
|
@@ -268,11 +273,9 @@ files:
|
|
268
273
|
- lib/generators/templates/helpers/partials/allure_requirements.tt
|
269
274
|
- lib/generators/templates/helpers/partials/driver_and_options.tt
|
270
275
|
- lib/generators/templates/helpers/partials/quit_driver.tt
|
271
|
-
- lib/generators/templates/helpers/partials/require_automation.tt
|
272
276
|
- lib/generators/templates/helpers/partials/screenshot.tt
|
273
277
|
- lib/generators/templates/helpers/partials/select_driver.tt
|
274
278
|
- lib/generators/templates/helpers/raider_helper.tt
|
275
|
-
- lib/generators/templates/helpers/selenium_helper.tt
|
276
279
|
- lib/generators/templates/helpers/spec_helper.tt
|
277
280
|
- lib/generators/templates/helpers/visual_helper.tt
|
278
281
|
- lib/generators/templates/helpers/visual_spec_helper.tt
|
@@ -291,6 +294,7 @@ files:
|
|
291
294
|
- spec/helpers_generator_spec.rb
|
292
295
|
- spec/open_ai_commands_spec.rb
|
293
296
|
- spec/rspec_generator_spec.rb
|
297
|
+
- spec/ruby_raider_spec.rb
|
294
298
|
- spec/scaffolding_commands_spec.rb
|
295
299
|
- spec/spec_helper.rb
|
296
300
|
- spec/utility_commands_spec.rb
|
data/lib/desktop/base_screen.rb
DELETED
@@ -1,137 +0,0 @@
|
|
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
|
@@ -1,123 +0,0 @@
|
|
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)) || ['No Files are created']
|
49
|
-
items files
|
50
|
-
selected_item files.first
|
51
|
-
@file = File.open(files.first) unless files.first == 'No Files are created'
|
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
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'selenium-webdriver'
|
4
|
-
require_relative 'driver_helper'
|
5
|
-
|
6
|
-
module Raider
|
7
|
-
module SeleniumHelper
|
8
|
-
def click_when_present
|
9
|
-
# This is an example of an implicit wait in selenium
|
10
|
-
wait = Selenium::WebDriver::Wait.new(timeout: 15)
|
11
|
-
wait.until { displayed? }
|
12
|
-
click
|
13
|
-
end
|
14
|
-
|
15
|
-
def select_by(key, value)
|
16
|
-
# Creates new Select object to use the select by method
|
17
|
-
dropdown = Selenium::WebDriver::Support::Select.new self
|
18
|
-
dropdown.select_by(key, value)
|
19
|
-
end
|
20
|
-
|
21
|
-
def hover
|
22
|
-
# Using actions to move the mouse over an element
|
23
|
-
DriverHelper.driver.action.move_to(self).perform
|
24
|
-
end
|
25
|
-
|
26
|
-
# How to perform right click through the context click method
|
27
|
-
def right_click
|
28
|
-
DriverHelper.driver.action.context_click(self).perform
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Here we are opening the selenium class and adding our custom method
|
33
|
-
class Selenium::WebDriver::Element
|
34
|
-
include SeleniumHelper
|
35
|
-
end
|
36
|
-
end
|