ruby_raider 0.4.1 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -6
- data/README.md +6 -0
- data/lib/commands/scaffolding_commands.rb +2 -2
- data/lib/commands/utility_commands.rb +8 -0
- data/lib/generators/automation_generator.rb +7 -7
- data/lib/generators/common_generator.rb +2 -0
- data/lib/generators/cucumber_generator.rb +1 -1
- data/lib/generators/helper_generator.rb +6 -0
- data/lib/generators/menu_generator.rb +9 -5
- data/lib/generators/rspec_generator.rb +2 -2
- data/lib/generators/templates/automation/abstract_page.tt +4 -0
- data/lib/generators/templates/automation/appium_caps.tt +7 -0
- data/lib/generators/templates/automation/home_page.tt +1 -5
- data/lib/generators/templates/automation/partials/android_caps.tt +5 -0
- data/lib/generators/templates/automation/partials/cross_platform_caps.tt +14 -0
- data/lib/generators/templates/automation/partials/home_page_selector.tt +8 -0
- data/lib/generators/templates/automation/partials/ios_caps.tt +6 -0
- data/lib/generators/templates/automation/partials/pdp_page_selector.tt +8 -0
- data/lib/generators/templates/automation/pdp_page.tt +1 -5
- data/lib/generators/templates/common/config.tt +5 -2
- data/lib/generators/templates/common/partials/mobile_config.tt +1 -0
- data/lib/generators/templates/common/partials/web_config.tt +2 -0
- data/lib/generators/templates/common/read_me.tt +4 -0
- data/lib/generators/templates/helpers/appium_helper.tt +29 -0
- data/lib/generators/templates/helpers/driver_helper.tt +15 -2
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +8 -5
- data/lib/generators/templates/helpers/raider_helper.tt +3 -0
- data/lib/utilities/utilities.rb +5 -0
- data/ruby_raider.gemspec +2 -1
- data/spec/automation_generator_spec.rb +33 -150
- data/spec/common_generator_spec.rb +58 -105
- data/spec/cucumber_generator_spec.rb +18 -53
- data/spec/helpers_generator_spec.rb +73 -90
- data/spec/rspec_generator_spec.rb +15 -61
- data/spec/scaffolding_commands_spec.rb +162 -0
- data/spec/spec_helper.rb +20 -0
- metadata +26 -6
- data/lib/generators/templates/automation/appium_settings.tt +0 -5
- data/lib/generators/templates/automation/partials/android_settings.tt +0 -8
- data/lib/generators/templates/automation/partials/ios_settings.tt +0 -8
- data/spec/scaffolding_spec.rb +0 -234
data/spec/scaffolding_spec.rb
DELETED
@@ -1,234 +0,0 @@
|
|
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
|