ruby_raider 0.3.3 → 0.3.6
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/reek.yml +23 -0
- data/.github/workflows/rspec.yml +27 -0
- data/.github/workflows/rubocop.yml +28 -0
- data/.rubocop.yml +3 -1
- data/README.md +37 -20
- data/Rakefile +11 -7
- data/lib/commands/scaffolding_commands.rb +116 -0
- data/lib/commands/utility_commands.rb +67 -0
- data/lib/generators/menu_generator.rb +67 -52
- data/lib/generators/templates/common/read_me.tt +13 -10
- data/lib/generators/templates/cucumber/env.tt +3 -3
- data/lib/generators/templates/cucumber/partials/selenium_appium_env.tt +6 -4
- data/lib/generators/templates/cucumber/partials/watir_env.tt +6 -5
- data/lib/generators/templates/helpers/allure_helper.tt +1 -1
- data/lib/generators/templates/helpers/browser_helper.tt +5 -5
- data/lib/generators/templates/helpers/driver_helper.tt +2 -3
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +25 -0
- data/lib/generators/templates/helpers/partials/quit_driver.tt +3 -3
- data/lib/generators/templates/helpers/partials/screenshot.tt +3 -3
- data/lib/generators/templates/helpers/partials/select_driver.tt +3 -3
- data/lib/generators/templates/helpers/spec_helper.tt +2 -2
- data/lib/ruby_raider.rb +4 -119
- data/lib/scaffolding/scaffolding.rb +11 -2
- data/lib/utilities/utilities.rb +10 -0
- data/ruby_raider.gemspec +1 -1
- data/spec/scaffolding_spec.rb +234 -0
- metadata +9 -4
- data/lib/generators/templates/helpers/partials/new_driver.tt +0 -12
- data/spec/ruby_raider_spec.rb +0 -213
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'yaml'
|
3
3
|
<% if automation == 'selenium' -%>
|
4
|
+
require 'active_support/inflector'
|
4
5
|
require 'webdrivers'
|
5
6
|
<% else -%>
|
6
7
|
require 'appium_lib'
|
@@ -9,10 +10,8 @@ require_relative 'driver_helper'
|
|
9
10
|
|
10
11
|
module Raider
|
11
12
|
module DriverHelper
|
12
|
-
class << self
|
13
13
|
attr_reader :driver
|
14
14
|
|
15
|
-
<%= ERB.new(File.read(File.expand_path('./partials/
|
16
|
-
end
|
15
|
+
<%= ERB.new(File.read(File.expand_path('./partials/driver_and_options.tt', __dir__))).result(binding).strip! %>
|
17
16
|
end
|
18
17
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<% if automation == 'selenium' %>
|
2
|
+
def new_driver(*opts)
|
3
|
+
@config = YAML.load_file('config/config.yml')
|
4
|
+
browser = @config['browser'].to_sym
|
5
|
+
@driver = Selenium::WebDriver.for(browser, capabilities: browser_options(*opts))
|
6
|
+
end
|
7
|
+
|
8
|
+
def browser_options(*opts)
|
9
|
+
opts = opts.empty? ? @config['browser_options'] : opts
|
10
|
+
create_options(*opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_options(*opts)
|
14
|
+
browser = @config['browser'] == :ie ? @config['browser'].to_s.upcase : @config['browser'].to_s.capitalize
|
15
|
+
caps = "Selenium::WebDriver::#{browser}::Options".constantize.new
|
16
|
+
opts.each {|option| caps.add_argument(option) }
|
17
|
+
caps
|
18
|
+
end
|
19
|
+
<% else %>
|
20
|
+
def new_driver
|
21
|
+
appium_file = File.join(Dir.pwd, 'appium.txt')
|
22
|
+
caps = Appium.load_appium_txt(file: appium_file)
|
23
|
+
@driver = Appium::Driver.new(caps)
|
24
|
+
end
|
25
|
+
<% end %>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% case automation
|
2
2
|
when 'selenium' %>
|
3
|
-
|
3
|
+
driver.save_screenshot("allure-results/screenshots/#{example_name}.png")
|
4
4
|
<% when 'watir' %>
|
5
|
-
|
5
|
+
browser.screenshot.save("allure-results/screenshots/#{example_name}.png")
|
6
6
|
<% else %>
|
7
|
-
|
7
|
+
driver.screenshot("allure-results/screenshots/#{example_name}.png")
|
8
8
|
<% end %>
|
@@ -14,15 +14,15 @@ module Raider
|
|
14
14
|
AllureHelper.configure
|
15
15
|
RSpec.configure do |config|
|
16
16
|
config.formatter = AllureHelper.formatter
|
17
|
+
<% if automation == 'watir' %>config.include(BrowserHelper)<% else %>config.include(DriverHelper)<% end %>
|
17
18
|
config.before(:each) do
|
18
19
|
<%= ERB.new(File.read(File.expand_path('./partials/select_driver.tt', __dir__))).result(binding).strip! %>
|
19
20
|
end
|
20
21
|
|
21
22
|
config.after(:each) do
|
22
23
|
example_name = self.class.descendant_filtered_examples.first.description
|
23
|
-
status = self.class.descendant_filtered_examples.first.execution_result.status
|
24
24
|
<%= ERB.new(File.read(File.expand_path('./partials/screenshot.tt', __dir__))).result(binding).strip! %>
|
25
|
-
AllureHelper.add_screenshot example_name
|
25
|
+
AllureHelper.add_screenshot example_name
|
26
26
|
<%= ERB.new(File.read(File.expand_path('./partials/quit_driver.tt', __dir__))).result(binding).strip! %>
|
27
27
|
end
|
28
28
|
end
|
data/lib/ruby_raider.rb
CHANGED
@@ -1,124 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require 'yaml'
|
5
|
-
require_relative 'generators/menu_generator'
|
6
|
-
require_relative '../lib/scaffolding/scaffolding'
|
7
|
-
require_relative '../lib/utilities/utilities'
|
3
|
+
require_relative '../lib/commands/scaffolding_commands'
|
8
4
|
|
9
|
-
class RubyRaider
|
10
|
-
|
11
|
-
|
12
|
-
def new(project_name)
|
13
|
-
MenuGenerator.generate_choice_menu(project_name)
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'page [PAGE_NAME]', 'Creates a new page object'
|
17
|
-
option :path,
|
18
|
-
type: :string, required: false, desc: 'The path where your page will be created', aliases: '-p'
|
19
|
-
option :delete,
|
20
|
-
type: :boolean, required: false, desc: 'This will delete the selected page', aliases: '-d'
|
21
|
-
|
22
|
-
def page(name)
|
23
|
-
path = options[:path].nil? ? load_config_path('page') : options[:path]
|
24
|
-
if options[:delete]
|
25
|
-
Scaffolding.new([name, path]).delete_class
|
26
|
-
else
|
27
|
-
Scaffolding.new([name, path]).generate_class
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
desc 'feature [FEATURE_NAME]', 'Creates a new feature'
|
32
|
-
option :path,
|
33
|
-
type: :string, required: false, desc: 'The path where your feature will be created', aliases: '-p'
|
34
|
-
option :delete,
|
35
|
-
type: :boolean, required: false, desc: 'This will delete the selected feature', aliases: '-d'
|
36
|
-
|
37
|
-
def feature(name)
|
38
|
-
path = options[:path].nil? ? load_config_path('feature') : options[:path]
|
39
|
-
if options[:delete]
|
40
|
-
Scaffolding.new([name, path]).delete_feature
|
41
|
-
else
|
42
|
-
Scaffolding.new([name, path]).generate_feature
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
desc 'spec [SPEC_NAME]', 'Creates a new spec'
|
47
|
-
option :path,
|
48
|
-
type: :string, required: false, desc: 'The path where your spec will be created', aliases: '-p'
|
49
|
-
option :delete,
|
50
|
-
type: :boolean, required: false, desc: 'This will delete the selected spec', aliases: '-d'
|
51
|
-
|
52
|
-
def spec(name)
|
53
|
-
path = options[:path].nil? ? load_config_path('spec') : options[:path]
|
54
|
-
if options[:delete]
|
55
|
-
Scaffolding.new([name, path]).delete_spec
|
56
|
-
else
|
57
|
-
Scaffolding.new([name, path]).generate_spec
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
desc 'helper [HELPER_NAME]', 'Creates a new helper'
|
62
|
-
option :path,
|
63
|
-
type: :string, required: false, desc: 'The path where your helper will be created', aliases: '-p'
|
64
|
-
option :delete,
|
65
|
-
type: :boolean, required: false, desc: 'This will delete the selected helper', aliases: '-d'
|
66
|
-
|
67
|
-
def helper(name)
|
68
|
-
path = options[:path].nil? ? load_config_path('helper') : options[:path]
|
69
|
-
if options[:delete]
|
70
|
-
Scaffolding.new([name, path]).delete_helper
|
71
|
-
else
|
72
|
-
Scaffolding.new([name, path]).generate_helper
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
desc 'path [PATH]', 'Sets the default path for scaffolding'
|
77
|
-
option :feature,
|
78
|
-
type: :boolean, required: false, desc: 'The default path for your features', aliases: '-f'
|
79
|
-
option :helper,
|
80
|
-
type: :boolean, required: false, desc: 'The default path for your helpers', aliases: '-h'
|
81
|
-
option :spec,
|
82
|
-
type: :boolean, required: false, desc: 'The default path for your specs', aliases: '-s'
|
83
|
-
def path(default_path)
|
84
|
-
type = options.empty? ? 'page' : options.keys.first
|
85
|
-
Utilities.new.send("#{type}_path=", default_path)
|
86
|
-
end
|
87
|
-
|
88
|
-
desc 'url [URL]', 'Sets the default url for a project'
|
89
|
-
|
90
|
-
def url(default_url)
|
91
|
-
Utilities.new.url = default_url
|
92
|
-
end
|
93
|
-
|
94
|
-
desc 'browser [BROWSER]', 'Sets the default browser for a project'
|
95
|
-
|
96
|
-
def browser(default_browser)
|
97
|
-
Utilities.new.browser = default_browser
|
98
|
-
end
|
99
|
-
|
100
|
-
desc 'raid', 'It runs all the tests in a project'
|
101
|
-
|
102
|
-
def raid
|
103
|
-
Utilities.new.run
|
104
|
-
end
|
105
|
-
|
106
|
-
desc 'scaffold [SCAFFOLD_NAME]', 'It generates everything needed to start automating'
|
107
|
-
def scaffold(name)
|
108
|
-
if Pathname.new('spec').exist? && !Pathname.new('features').exist?
|
109
|
-
Scaffolding.new([name, load_config_path('spec')]).generate_spec
|
110
|
-
Scaffolding.new([name, load_config_path('page')]).generate_class
|
111
|
-
elsif Pathname.new('features').exist?
|
112
|
-
Scaffolding.new([name, load_config_path('feature')]).generate_feature
|
113
|
-
Scaffolding.new([name, load_config_path('page')]).generate_class
|
114
|
-
else
|
115
|
-
raise 'No features or spec folders where found. We are not sure which type of project you are running'
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
no_commands do
|
120
|
-
def load_config_path(type)
|
121
|
-
YAML.load_file('config/config.yml')["#{type}_path"] unless YAML.load_file('config/config.yml').nil?
|
122
|
-
end
|
5
|
+
class RubyRaider
|
6
|
+
def self.start
|
7
|
+
ScaffoldingCommands.start
|
123
8
|
end
|
124
9
|
end
|
@@ -5,7 +5,7 @@ require 'thor'
|
|
5
5
|
class Scaffolding < Thor::Group
|
6
6
|
include Thor::Actions
|
7
7
|
|
8
|
-
argument :name
|
8
|
+
argument :name, optional: true
|
9
9
|
argument :path, optional: true
|
10
10
|
|
11
11
|
def self.source_root
|
@@ -28,6 +28,11 @@ class Scaffolding < Thor::Group
|
|
28
28
|
template('helper.tt', default_path("helpers/#{name}_helper.rb", '_helper.rb'))
|
29
29
|
end
|
30
30
|
|
31
|
+
def generate_config
|
32
|
+
template('../../generators/templates/common/config.tt',
|
33
|
+
default_path('config/config.yml', '.yml'))
|
34
|
+
end
|
35
|
+
|
31
36
|
def delete_class
|
32
37
|
remove_file(default_path("page_objects/pages/#{name}_page.rb", '_page.rb'))
|
33
38
|
end
|
@@ -44,7 +49,11 @@ class Scaffolding < Thor::Group
|
|
44
49
|
remove_file(default_path("helpers/#{name}_helper.rb", '_helper.rb'))
|
45
50
|
end
|
46
51
|
|
52
|
+
def delete_config
|
53
|
+
remove_file(default_path('config/config.yml', '.yml'))
|
54
|
+
end
|
55
|
+
|
47
56
|
def default_path(standard_path, file_type)
|
48
|
-
path
|
57
|
+
path ? "#{path}/#{name}#{file_type}" : standard_path
|
49
58
|
end
|
50
59
|
end
|
data/lib/utilities/utilities.rb
CHANGED
@@ -38,6 +38,16 @@ class Utilities
|
|
38
38
|
overwrite_yaml
|
39
39
|
end
|
40
40
|
|
41
|
+
def browser_options=(*opts)
|
42
|
+
@config['browser_options'] = opts.flatten
|
43
|
+
overwrite_yaml
|
44
|
+
end
|
45
|
+
|
46
|
+
def delete_browser_options
|
47
|
+
@config.delete('browser_options')
|
48
|
+
overwrite_yaml
|
49
|
+
end
|
50
|
+
|
41
51
|
def run
|
42
52
|
if File.directory? 'spec'
|
43
53
|
system 'rspec spec/'
|
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.3.
|
5
|
+
s.version = '0.3.6'
|
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']
|
@@ -0,0 +1,234 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../lib/generators/common_generator'
|
4
|
+
require_relative '../lib/commands/scaffolding_commands'
|
5
|
+
require_relative 'spec_helper'
|
6
|
+
|
7
|
+
describe ScaffoldingCommands do
|
8
|
+
let(:scaffold) { ScaffoldingCommands }
|
9
|
+
let(:name) { 'test' }
|
10
|
+
|
11
|
+
context 'with a spec folder' do
|
12
|
+
before(:all) do
|
13
|
+
ScaffoldingCommands.new.invoke(:config)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'scaffolds for rspec' do
|
17
|
+
scaffold.new.invoke(:scaffold, nil, %W[#{name}])
|
18
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
19
|
+
expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'with a features folder' do
|
24
|
+
it 'scaffolds for cucumber' do
|
25
|
+
FileUtils.mkdir 'features'
|
26
|
+
scaffold.new.invoke(:scaffold, nil, %W[#{name}])
|
27
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
28
|
+
expect(Pathname.new("features/#{name}.feature")).to be_file
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
after(:all) do
|
33
|
+
folders = %w[test config page_objects features]
|
34
|
+
folders.each do |folder|
|
35
|
+
FileUtils.rm_rf(folder)
|
36
|
+
end
|
37
|
+
FileUtils.rm('spec/test_spec.rb') if Pathname.new('spec/test_spec.rb').exist?
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'with path from config file' do
|
41
|
+
before(:all) do
|
42
|
+
ScaffoldingCommands.new.invoke(:config)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'creates a page' do
|
46
|
+
scaffold.new.invoke(:page, nil, %W[#{name}])
|
47
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'creates a feature' do
|
51
|
+
scaffold.new.invoke(:feature, nil, %W[#{name}])
|
52
|
+
expect(Pathname.new("features/#{name}.feature")).to be_file
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'creates a spec' do
|
56
|
+
scaffold.new.invoke(:spec, nil, %W[#{name}])
|
57
|
+
expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'creates a helper' do
|
61
|
+
scaffold.new.invoke(:helper, nil, %W[#{name}])
|
62
|
+
expect(Pathname.new("helpers/#{name}_helper.rb")).to be_file
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'deletes a page' do
|
66
|
+
scaffold.new.invoke(:page, nil, %W[#{name}])
|
67
|
+
scaffold.new.invoke(:page, nil, %W[#{name} --delete])
|
68
|
+
expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to_not be_file
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'deletes a feature' do
|
72
|
+
scaffold.new.invoke(:feature, nil, %W[#{name}])
|
73
|
+
scaffold.new.invoke(:feature, nil, %W[#{name} --delete])
|
74
|
+
expect(Pathname.new("features/#{name}.feature")).to_not be_file
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'deletes a spec' do
|
78
|
+
scaffold.new.invoke(:spec, nil, %W[#{name}])
|
79
|
+
scaffold.new.invoke(:spec, nil, %W[#{name} --delete])
|
80
|
+
expect(Pathname.new("spec/#{name}_spec.rb")).to_not be_file
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'deletes a helper' do
|
84
|
+
scaffold.new.invoke(:helper, nil, %W[#{name}])
|
85
|
+
scaffold.new.invoke(:helper, nil, %W[#{name} --delete])
|
86
|
+
expect(Pathname.new("helpers/#{name}_helper.rb")).to_not be_file
|
87
|
+
end
|
88
|
+
|
89
|
+
after(:all) do
|
90
|
+
folders = %w[test config page_objects features helpers]
|
91
|
+
folders.each do |folder|
|
92
|
+
FileUtils.rm_rf(folder)
|
93
|
+
end
|
94
|
+
FileUtils.rm('spec/test_spec.rb') if Pathname.new('spec/test_spec.rb').exist?
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'with path option' do
|
99
|
+
let(:path) { 'test_folder' }
|
100
|
+
|
101
|
+
it 'creates a page' do
|
102
|
+
scaffold.new.invoke(:page, nil, %W[#{name} --path #{path}])
|
103
|
+
expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'creates a feature' do
|
107
|
+
scaffold.new.invoke(:feature, nil, %W[#{name} --path #{path}])
|
108
|
+
expect(Pathname.new("#{path}/#{name}.feature")).to be_file
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'creates a spec' do
|
112
|
+
scaffold.new.invoke(:spec, nil, %W[#{name} --path #{path}])
|
113
|
+
expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'creates a helper' do
|
117
|
+
scaffold.new.invoke(:helper, nil, %W[#{name} --path #{path}])
|
118
|
+
expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
|
119
|
+
end
|
120
|
+
|
121
|
+
after(:each) do
|
122
|
+
FileUtils.rm_rf(path)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'changes the default path' do
|
127
|
+
let(:path) { 'test_folder' }
|
128
|
+
|
129
|
+
before(:all) do
|
130
|
+
ScaffoldingCommands.new.invoke(:config)
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'changes the path for pages' do
|
134
|
+
scaffold.new.invoke(:path, nil, %W[#{path}])
|
135
|
+
config = YAML.load_file('config/config.yml')
|
136
|
+
expect(config['page_path']).to eql path
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'changes the path for features' do
|
140
|
+
scaffold.new.invoke(:path, nil, %W[#{path} -f])
|
141
|
+
config = YAML.load_file('config/config.yml')
|
142
|
+
expect(config['feature_path']).to eql path
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'changes the path for specs' do
|
146
|
+
scaffold.new.invoke(:path, nil, %W[#{path} -s])
|
147
|
+
config = YAML.load_file('config/config.yml')
|
148
|
+
expect(config['spec_path']).to eql path
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'creates page' do
|
152
|
+
scaffold.new.invoke(:path, nil, %W[#{path}])
|
153
|
+
scaffold.new.invoke(:page, nil, %W[#{name}])
|
154
|
+
expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'creates feature' do
|
158
|
+
scaffold.new.invoke(:path, nil, %W[#{path} -f])
|
159
|
+
scaffold.new.invoke(:feature, nil, %W[#{name}])
|
160
|
+
expect(Pathname.new("#{path}/#{name}.feature")).to be_file
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'creates spec' do
|
164
|
+
scaffold.new.invoke(:path, nil, %W[#{path} -s])
|
165
|
+
scaffold.new.invoke(:spec, nil, %W[#{name}])
|
166
|
+
expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'creates spec' do
|
170
|
+
scaffold.new.invoke(:path, nil, %W[#{path} -h])
|
171
|
+
scaffold.new.invoke(:helper, nil, %W[#{name}])
|
172
|
+
expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
|
173
|
+
end
|
174
|
+
|
175
|
+
after(:all) do
|
176
|
+
folders = %w[test_folder test config]
|
177
|
+
folders.each do |folder|
|
178
|
+
FileUtils.rm_rf(folder)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context 'updates the config file' do
|
184
|
+
before(:all) do
|
185
|
+
CommonGenerator.new(%w[rspec selenium test]).invoke(:generate_config_file)
|
186
|
+
FileUtils.cp_lr('test/config', './')
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'updates the url' do
|
190
|
+
scaffold.new.invoke(:url, nil, %W[test.com])
|
191
|
+
config = YAML.load_file('config/config.yml')
|
192
|
+
expect(config['url']).to eql 'test.com'
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'updates the browser' do
|
196
|
+
scaffold.new.invoke(:browser, nil, %W[:firefox])
|
197
|
+
config = YAML.load_file('config/config.yml')
|
198
|
+
expect(config['browser']).to eql ':firefox'
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'updates the browser and the browser options' do
|
202
|
+
scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless start-maximized start-fullscreen])
|
203
|
+
config = YAML.load_file('config/config.yml')
|
204
|
+
expect(config['browser']).to eql ':firefox'
|
205
|
+
expect(config['browser_options']).to eql %W[headless start-maximized start-fullscreen]
|
206
|
+
end
|
207
|
+
|
208
|
+
it 'updates only the browser options' do
|
209
|
+
scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless])
|
210
|
+
config = YAML.load_file('config/config.yml')
|
211
|
+
expect(config['browser_options']).to eql %w[headless]
|
212
|
+
end
|
213
|
+
|
214
|
+
it 'deletes the browser options when passed with the delete parameter' do
|
215
|
+
scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless --delete])
|
216
|
+
config = YAML.load_file('config/config.yml')
|
217
|
+
expect(config['browser_options']).to be_nil
|
218
|
+
end
|
219
|
+
|
220
|
+
it 'deletes the browser options' do
|
221
|
+
scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless])
|
222
|
+
scaffold.new.invoke(:browser, nil, %W[--delete])
|
223
|
+
config = YAML.load_file('config/config.yml')
|
224
|
+
expect(config['browser_options']).to be_nil
|
225
|
+
end
|
226
|
+
|
227
|
+
after(:all) do
|
228
|
+
folders = %w[test config]
|
229
|
+
folders.each do |folder|
|
230
|
+
FileUtils.rm_rf(folder)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
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.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pequeno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -117,6 +117,9 @@ extra_rdoc_files: []
|
|
117
117
|
files:
|
118
118
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
119
119
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
120
|
+
- ".github/workflows/reek.yml"
|
121
|
+
- ".github/workflows/rspec.yml"
|
122
|
+
- ".github/workflows/rubocop.yml"
|
120
123
|
- ".gitignore"
|
121
124
|
- ".reek.yml"
|
122
125
|
- ".rubocop.yml"
|
@@ -127,6 +130,8 @@ files:
|
|
127
130
|
- README.md
|
128
131
|
- Rakefile
|
129
132
|
- bin/raider
|
133
|
+
- lib/commands/scaffolding_commands.rb
|
134
|
+
- lib/commands/utility_commands.rb
|
130
135
|
- lib/generators/automation_generator.rb
|
131
136
|
- lib/generators/common_generator.rb
|
132
137
|
- lib/generators/cucumber_generator.rb
|
@@ -167,7 +172,7 @@ files:
|
|
167
172
|
- lib/generators/templates/helpers/driver_helper.tt
|
168
173
|
- lib/generators/templates/helpers/partials/allure_imports.tt
|
169
174
|
- lib/generators/templates/helpers/partials/allure_requirements.tt
|
170
|
-
- lib/generators/templates/helpers/partials/
|
175
|
+
- lib/generators/templates/helpers/partials/driver_and_options.tt
|
171
176
|
- lib/generators/templates/helpers/partials/quit_driver.tt
|
172
177
|
- lib/generators/templates/helpers/partials/require_automation.tt
|
173
178
|
- lib/generators/templates/helpers/partials/screenshot.tt
|
@@ -190,7 +195,7 @@ files:
|
|
190
195
|
- spec/cucumber_generator_spec.rb
|
191
196
|
- spec/helpers_generator_spec.rb
|
192
197
|
- spec/rspec_generator_spec.rb
|
193
|
-
- spec/
|
198
|
+
- spec/scaffolding_spec.rb
|
194
199
|
- spec/spec_helper.rb
|
195
200
|
homepage: https://github.com/RubyRaider/ruby_raider
|
196
201
|
licenses:
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<% if automation == 'selenium' %>
|
2
|
-
def new_driver(caps = {})
|
3
|
-
browser = YAML.load_file('config/config.yml')['browser'].to_sym
|
4
|
-
@driver = Selenium::WebDriver.for(browser, desired_capabilities: caps)
|
5
|
-
end
|
6
|
-
<% else %>
|
7
|
-
def new_driver
|
8
|
-
appium_file = File.join(Dir.pwd, 'appium.txt')
|
9
|
-
caps = Appium.load_appium_txt(file: appium_file)
|
10
|
-
@driver = Appium::Driver.new(caps)
|
11
|
-
end
|
12
|
-
<% end %>
|