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