sauce_bindings 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -6
- data/CHANGES.md +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +11 -87
- data/Rakefile +8 -6
- data/lib/sauce_bindings/capybara_session.rb +0 -3
- data/lib/sauce_bindings/errors.rb +7 -0
- data/lib/sauce_bindings/logger.rb +20 -0
- data/lib/sauce_bindings/options.rb +22 -4
- data/lib/sauce_bindings/session.rb +92 -18
- data/lib/sauce_bindings/version.rb +1 -1
- data/lib/sauce_bindings.rb +8 -0
- data/sauce_bindings.gemspec +6 -6
- data/spec/integration/desktop_spec.rb +25 -5
- data/spec/spec_helper.rb +39 -1
- data/spec/unit/capybara_session_spec.rb +10 -20
- data/spec/unit/deprecated_options_spec.rb +479 -456
- data/spec/unit/options_spec.rb +120 -153
- data/spec/unit/session_spec.rb +437 -84
- metadata +30 -28
@@ -4,468 +4,491 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
module SauceBindings
|
6
6
|
describe Options do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
7
|
+
context 'when using deprecated methods' do
|
8
|
+
describe '#new' do
|
9
|
+
let(:default_options) do
|
10
|
+
{'browserName' => 'chrome',
|
11
|
+
'browserVersion' => 'latest',
|
12
|
+
'platformName' => 'Windows 10',
|
13
|
+
'sauce:options' => {'build' => 'TEMP BUILD: 11'}}
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'uses latest Chrome version on Windows 10 by default' do
|
17
|
+
expect { @options = Options.new }.to have_deprecated_options_init
|
18
|
+
|
19
|
+
expect(@options.browser_name).to eq 'chrome'
|
20
|
+
expect(@options.browser_version).to eq 'latest'
|
21
|
+
expect(@options.platform_name).to eq 'Windows 10'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'accepts provided values for browser, browser version and platform name' do
|
25
|
+
expect {
|
26
|
+
@options = Options.new(browser_name: 'firefox',
|
27
|
+
browser_version: '123',
|
28
|
+
platform_name: 'Mac')
|
29
|
+
}.to have_deprecated_options_init
|
30
|
+
|
31
|
+
expect(@options.browser_name).to eq 'firefox'
|
32
|
+
expect(@options.browser_version).to eq '123'
|
33
|
+
expect(@options.platform_name).to eq 'Mac'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'accepts other w3c values' do
|
37
|
+
proxy = Selenium::WebDriver::Proxy.new(ssl: 'foo')
|
38
|
+
timeouts = {implicit: 1,
|
39
|
+
page_load: 59,
|
40
|
+
script: 29}
|
41
|
+
expect {
|
42
|
+
@options = Options.new(accept_insecure_certs: true,
|
43
|
+
page_load_strategy: 'eager',
|
44
|
+
proxy: proxy,
|
45
|
+
set_window_rect: true,
|
46
|
+
unhandled_prompt_behavior: 'accept',
|
47
|
+
strict_file_interactability: true,
|
48
|
+
timeouts: timeouts)
|
49
|
+
}.to have_deprecated_options_init
|
50
|
+
|
51
|
+
expect(@options.accept_insecure_certs).to eq true
|
52
|
+
expect(@options.page_load_strategy).to eq 'eager'
|
53
|
+
expect(@options.proxy).to eq proxy
|
54
|
+
expect(@options.set_window_rect).to eq true
|
55
|
+
expect(@options.unhandled_prompt_behavior).to eq 'accept'
|
56
|
+
expect(@options.strict_file_interactability).to eq true
|
57
|
+
expect(@options.timeouts).to eq timeouts
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'accepts Sauce Labs specific settings' do
|
61
|
+
custom_data = {foo: 'foo',
|
62
|
+
bar: 'bar'}
|
63
|
+
prerun = {executable: 'http://url.to/your/executable.exe',
|
64
|
+
args: ['--silent', '-a', '-q'],
|
65
|
+
background: false,
|
66
|
+
timeout: 120}
|
67
|
+
tags = %w[foo bar foobar]
|
68
|
+
sauce_options = {
|
69
|
+
avoid_proxy: true,
|
70
|
+
build: 'Sample Build Name',
|
71
|
+
capture_performance: true,
|
72
|
+
chromedriver_version: '71',
|
73
|
+
command_timeout: 2,
|
74
|
+
custom_data: custom_data,
|
75
|
+
extended_debugging: true,
|
76
|
+
idle_timeout: 3,
|
77
|
+
iedriver_version: '3.141.0',
|
78
|
+
max_duration: 300,
|
79
|
+
name: 'Sample Test Name',
|
80
|
+
parent_tunnel: 'Mommy',
|
81
|
+
prerun: prerun,
|
82
|
+
priority: 0,
|
83
|
+
public: 'team',
|
84
|
+
record_logs: false,
|
85
|
+
record_screenshots: false,
|
86
|
+
record_video: false,
|
87
|
+
screen_resolution: '10x10',
|
88
|
+
selenium_version: '3.141.59',
|
89
|
+
tags: tags,
|
90
|
+
time_zone: 'San Francisco',
|
91
|
+
tunnel_identifier: 'tunnelname',
|
92
|
+
video_upload_on_pass: false
|
93
|
+
}
|
94
|
+
|
95
|
+
expect { @options = Options.new(**sauce_options) }.to have_deprecated_options_init
|
96
|
+
|
97
|
+
expect(@options.avoid_proxy).to eq true
|
98
|
+
expect(@options.build).to eq 'Sample Build Name'
|
99
|
+
expect(@options.capture_performance).to eq true
|
100
|
+
expect(@options.chromedriver_version).to eq '71'
|
101
|
+
expect(@options.command_timeout).to eq 2
|
102
|
+
expect(@options.custom_data).to eq custom_data
|
103
|
+
expect(@options.extended_debugging).to eq true
|
104
|
+
expect(@options.idle_timeout).to eq 3
|
105
|
+
expect(@options.iedriver_version).to eq '3.141.0'
|
106
|
+
expect(@options.max_duration).to eq 300
|
107
|
+
expect(@options.name).to eq 'Sample Test Name'
|
108
|
+
expect(@options.parent_tunnel).to eq 'Mommy'
|
109
|
+
expect(@options.prerun).to eq prerun
|
110
|
+
expect(@options.priority).to eq 0
|
111
|
+
expect(@options.public).to eq 'team'
|
112
|
+
expect(@options.record_logs).to eq false
|
113
|
+
expect(@options.record_screenshots).to eq false
|
114
|
+
expect(@options.record_video).to eq false
|
115
|
+
expect(@options.screen_resolution).to eq '10x10'
|
116
|
+
expect(@options.selenium_version).to eq '3.141.59'
|
117
|
+
expect(@options.tags).to eq tags
|
118
|
+
expect(@options.time_zone).to eq 'San Francisco'
|
119
|
+
expect(@options.tunnel_identifier).to eq 'tunnelname'
|
120
|
+
expect(@options.video_upload_on_pass).to eq false
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'accepts Selenium Capabilities and overrides default browser' do
|
124
|
+
caps = Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true,
|
125
|
+
page_load_strategy: 'eager')
|
126
|
+
expect { @options = Options.new(selenium_options: caps) }.to have_deprecated_options_init
|
127
|
+
|
128
|
+
expect(@options.browser_name).to eq 'firefox'
|
129
|
+
expect(@options.accept_insecure_certs).to eq true
|
130
|
+
expect(@options.page_load_strategy).to eq 'eager'
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'accepts Selenium Options and overrides default browser' do
|
134
|
+
browser_opts = Selenium::WebDriver::Firefox::Options.new(args: ['--foo'])
|
135
|
+
expect { @options = Options.new(selenium_options: browser_opts) }.to have_deprecated_options_init
|
136
|
+
|
137
|
+
expect(@options.browser_name).to eq 'firefox'
|
138
|
+
expect(@options.selenium_options['moz:firefoxOptions']).to eq('args' => ['--foo'])
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'accepts Selenium Capabilities and Options class instances' do
|
142
|
+
caps = Selenium::WebDriver::Remote::Capabilities.chrome(accept_insecure_certs: true,
|
143
|
+
page_load_strategy: 'eager')
|
144
|
+
browser_opts = Selenium::WebDriver::Chrome::Options.new(args: ['--foo'])
|
145
|
+
expect { @options = Options.new(selenium_options: [caps, browser_opts]) }.to have_deprecated_options_init
|
146
|
+
|
147
|
+
expect(@options.page_load_strategy).to eq 'eager'
|
148
|
+
expect(@options.accept_insecure_certs).to eq true
|
149
|
+
expect(@options.selenium_options['goog:chromeOptions']).to eq('args' => ['--foo'])
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'accepts W3C, Sauce, Browser Options and Capabilities at the same time' do
|
153
|
+
caps = Selenium::WebDriver::Remote::Capabilities.chrome(page_load_strategy: 'eager')
|
154
|
+
browser_opts = Selenium::WebDriver::Firefox::Options.new(args: ['--foo'])
|
155
|
+
|
156
|
+
expect {
|
157
|
+
@options = Options.new(browser_version: '77',
|
158
|
+
accept_insecure_certs: true,
|
159
|
+
command_timeout: 2,
|
160
|
+
time_zone: 'Alaska',
|
161
|
+
selenium_options: [caps, browser_opts])
|
162
|
+
}.to have_deprecated_options_init
|
163
|
+
|
164
|
+
expect(@options.browser_name).to eq 'firefox'
|
165
|
+
expect(@options.browser_version).to eq '77'
|
166
|
+
expect(@options.platform_name).to eq 'Windows 10'
|
167
|
+
expect(@options.accept_insecure_certs).to eq true
|
168
|
+
expect(@options.command_timeout).to eq 2
|
169
|
+
expect(@options.time_zone).to eq 'Alaska'
|
170
|
+
expect(@options.page_load_strategy).to eq 'eager'
|
171
|
+
|
172
|
+
expect(@options.selenium_options['moz:firefoxOptions']).to eq('args' => ['--foo'])
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'creates a default build value' do
|
176
|
+
ClimateControl.modify(**BUILD_ENV) do
|
177
|
+
expect { @options = Options.new }.to have_deprecated_options_init
|
178
|
+
end
|
179
|
+
|
180
|
+
expect(@options.build).to eq 'TEMP BUILD: 11'
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'raises ArgumentError if parameter is not recognized as valid' do
|
184
|
+
expect {
|
185
|
+
expect { @options = Options.new(foo: 'bar') }.to have_deprecated_options_init
|
186
|
+
}.to raise_exception(ArgumentError)
|
187
|
+
end
|
59
188
|
end
|
60
189
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
caps = Selenium::WebDriver::Remote::Capabilities.chrome(page_load_strategy: 'eager')
|
155
|
-
browser_opts = Selenium::WebDriver::Firefox::Options.new(args: ['--foo'])
|
156
|
-
|
157
|
-
options = Options.new(browser_version: '77',
|
158
|
-
accept_insecure_certs: true,
|
159
|
-
command_timeout: 2,
|
160
|
-
time_zone: 'Alaska',
|
161
|
-
selenium_options: [caps, browser_opts])
|
162
|
-
|
163
|
-
expect(options.browser_name).to eq 'firefox'
|
164
|
-
expect(options.browser_version).to eq '77'
|
165
|
-
expect(options.platform_name).to eq 'Windows 10'
|
166
|
-
expect(options.accept_insecure_certs).to eq true
|
167
|
-
expect(options.command_timeout).to eq 2
|
168
|
-
expect(options.time_zone).to eq 'Alaska'
|
169
|
-
expect(options.page_load_strategy).to eq 'eager'
|
170
|
-
|
171
|
-
expect(options.selenium_options['moz:firefoxOptions']).to eq('args' => ['--foo'])
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'creates a default build value' do
|
175
|
-
options = Options.new
|
176
|
-
expect(options.build).to eq 'TEMP BUILD: 11'
|
177
|
-
end
|
178
|
-
|
179
|
-
it 'raises ArgumentError if parameter is not recognized as valid' do
|
180
|
-
expect { Options.new(foo: 'bar') }.to raise_exception(ArgumentError)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
describe '#accessors' do
|
185
|
-
it 'parses w3c values' do
|
186
|
-
proxy = Selenium::WebDriver::Proxy.new(ssl: 'foo')
|
187
|
-
timeouts = {implicit: 1,
|
188
|
-
page_load: 59,
|
189
|
-
script: 29}
|
190
|
-
|
191
|
-
options = Options.new
|
192
|
-
|
193
|
-
options.browser_name = 'firefox'
|
194
|
-
options.browser_version = '7'
|
195
|
-
options.platform_name = 'macOS 10.14'
|
196
|
-
options.accept_insecure_certs = true
|
197
|
-
options.page_load_strategy = 'eager'
|
198
|
-
options.proxy = proxy
|
199
|
-
options.set_window_rect = true
|
200
|
-
options.unhandled_prompt_behavior = 'accept'
|
201
|
-
options.strict_file_interactability = true
|
202
|
-
options.timeouts = timeouts
|
203
|
-
|
204
|
-
expect(options.browser_name).to eq 'firefox'
|
205
|
-
expect(options.browser_version).to eq '7'
|
206
|
-
expect(options.platform_name).to eq 'macOS 10.14'
|
207
|
-
expect(options.accept_insecure_certs).to eq true
|
208
|
-
expect(options.page_load_strategy).to eq 'eager'
|
209
|
-
expect(options.proxy).to eq proxy
|
210
|
-
expect(options.set_window_rect).to eq true
|
211
|
-
expect(options.unhandled_prompt_behavior).to eq 'accept'
|
212
|
-
expect(options.strict_file_interactability).to eq true
|
213
|
-
expect(options.timeouts).to eq timeouts
|
214
|
-
end
|
215
|
-
|
216
|
-
it 'parses Sauce values' do
|
217
|
-
custom_data = {foo: 'foo',
|
218
|
-
bar: 'bar'}
|
219
|
-
prerun = {executable: 'http://url.to/your/executable.exe',
|
220
|
-
args: ['--silent', '-a', '-q'],
|
221
|
-
background: false,
|
222
|
-
timeout: 120}
|
223
|
-
tags = %w[foo bar foobar]
|
224
|
-
|
225
|
-
options = Options.new
|
226
|
-
|
227
|
-
options.avoid_proxy = true
|
228
|
-
options.build = 'Sample Build Name'
|
229
|
-
options.capture_performance = true
|
230
|
-
options.chromedriver_version = '71'
|
231
|
-
options.command_timeout = 2
|
232
|
-
options.custom_data = custom_data
|
233
|
-
options.extended_debugging = true
|
234
|
-
options.idle_timeout = 3
|
235
|
-
options.iedriver_version = '3.141.0'
|
236
|
-
options.max_duration = 300
|
237
|
-
options.name = 'Sample Test Name'
|
238
|
-
options.parent_tunnel = 'Mommy'
|
239
|
-
options.prerun = prerun
|
240
|
-
options.priority = 0
|
241
|
-
options.public = 'team'
|
242
|
-
options.record_logs = false
|
243
|
-
options.record_screenshots = false
|
244
|
-
options.record_video = false
|
245
|
-
options.screen_resolution = '10x10'
|
246
|
-
options.selenium_version = '3.141.59'
|
247
|
-
options.tags = tags
|
248
|
-
options.time_zone = 'San Francisco'
|
249
|
-
options.tunnel_identifier = 'tunnelname'
|
250
|
-
options.video_upload_on_pass = false
|
251
|
-
|
252
|
-
expect(options.avoid_proxy).to eq true
|
253
|
-
expect(options.build).to eq 'Sample Build Name'
|
254
|
-
expect(options.capture_performance).to eq true
|
255
|
-
expect(options.chromedriver_version).to eq '71'
|
256
|
-
expect(options.command_timeout).to eq 2
|
257
|
-
expect(options.custom_data).to eq custom_data
|
258
|
-
expect(options.extended_debugging).to eq true
|
259
|
-
expect(options.idle_timeout).to eq 3
|
260
|
-
expect(options.iedriver_version).to eq '3.141.0'
|
261
|
-
expect(options.max_duration).to eq 300
|
262
|
-
expect(options.name).to eq 'Sample Test Name'
|
263
|
-
expect(options.parent_tunnel).to eq 'Mommy'
|
264
|
-
expect(options.prerun).to eq prerun
|
265
|
-
expect(options.priority).to eq 0
|
266
|
-
expect(options.public).to eq 'team'
|
267
|
-
expect(options.record_logs).to eq false
|
268
|
-
expect(options.record_screenshots).to eq false
|
269
|
-
expect(options.record_video).to eq false
|
270
|
-
expect(options.screen_resolution).to eq '10x10'
|
271
|
-
expect(options.selenium_version).to eq '3.141.59'
|
272
|
-
expect(options.tags).to eq tags
|
273
|
-
expect(options.time_zone).to eq 'San Francisco'
|
274
|
-
expect(options.tunnel_identifier).to eq 'tunnelname'
|
275
|
-
expect(options.video_upload_on_pass).to eq false
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
describe '#merge_capabilities' do
|
280
|
-
it 'loads options from configuration' do
|
281
|
-
timeouts = {implicit: 1,
|
282
|
-
page_load: 59,
|
283
|
-
script: 29}
|
284
|
-
custom_data = {foo: 'foo',
|
285
|
-
bar: 'bar'}
|
286
|
-
prerun = {executable: 'http://url.to/your/executable.exe',
|
287
|
-
args: ['--silent', '-a', '-q'],
|
288
|
-
background: false,
|
289
|
-
timeout: 120}
|
290
|
-
tags = %w[foo bar foobar]
|
291
|
-
|
292
|
-
options = Options.new
|
293
|
-
yaml = YAML.load_file('spec/deprecated_options.yml')
|
294
|
-
options.merge_capabilities(yaml['example_values'])
|
295
|
-
|
296
|
-
expect(options.browser_name).to eq 'firefox'
|
297
|
-
expect(options.browser_version).to eq '123'
|
298
|
-
expect(options.platform_name).to eq 'Mac'
|
299
|
-
expect(options.accept_insecure_certs).to eq true
|
300
|
-
expect(options.page_load_strategy).to eq 'eager'
|
301
|
-
expect(options.set_window_rect).to eq true
|
302
|
-
expect(options.unhandled_prompt_behavior).to eq 'accept'
|
303
|
-
expect(options.strict_file_interactability).to eq true
|
304
|
-
expect(options.timeouts).to eq timeouts
|
305
|
-
expect(options.avoid_proxy).to eq true
|
306
|
-
expect(options.build).to eq 'Sample Build Name'
|
307
|
-
expect(options.capture_performance).to eq true
|
308
|
-
expect(options.chromedriver_version).to eq '71'
|
309
|
-
expect(options.command_timeout).to eq 2
|
310
|
-
expect(options.custom_data).to eq custom_data
|
311
|
-
expect(options.extended_debugging).to eq true
|
312
|
-
expect(options.idle_timeout).to eq 3
|
313
|
-
expect(options.iedriver_version).to eq '3.141.0'
|
314
|
-
expect(options.max_duration).to eq 300
|
315
|
-
expect(options.name).to eq 'Sample Test Name'
|
316
|
-
expect(options.parent_tunnel).to eq 'Mommy'
|
317
|
-
expect(options.prerun).to eq prerun
|
318
|
-
expect(options.priority).to eq 0
|
319
|
-
expect(options.public).to eq 'team'
|
320
|
-
expect(options.record_logs).to eq false
|
321
|
-
expect(options.record_screenshots).to eq false
|
322
|
-
expect(options.record_video).to eq false
|
323
|
-
expect(options.screen_resolution).to eq '10x10'
|
324
|
-
expect(options.selenium_version).to eq '3.141.59'
|
325
|
-
expect(options.tags).to eq tags
|
326
|
-
expect(options.time_zone).to eq 'San Francisco'
|
327
|
-
expect(options.tunnel_identifier).to eq 'tunnelname'
|
328
|
-
expect(options.video_upload_on_pass).to eq false
|
329
|
-
end
|
330
|
-
|
331
|
-
it 'raises exception if value not recognized' do
|
332
|
-
options = Options.new
|
333
|
-
yaml = YAML.load_file('spec/deprecated_options.yml')
|
334
|
-
|
335
|
-
msg = 'foo is not a valid parameter for Options class'
|
336
|
-
expect { options.merge_capabilities(yaml['invalid_option']) }.to raise_exception(ArgumentError, msg)
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
describe '#capabilities' do
|
341
|
-
it 'correctly generates capabilities for w3c values' do
|
342
|
-
proxy = Selenium::WebDriver::Proxy.new(ssl: 'foo')
|
343
|
-
timeouts = {implicit: 1,
|
344
|
-
page_load: 59,
|
345
|
-
script: 29}
|
346
|
-
|
347
|
-
options = Options.new(browser_name: 'firefox',
|
348
|
-
platform_name: 'Mac',
|
349
|
-
accept_insecure_certs: true,
|
350
|
-
page_load_strategy: 'eager',
|
351
|
-
proxy: proxy,
|
352
|
-
set_window_rect: true,
|
353
|
-
unhandled_prompt_behavior: 'accept',
|
354
|
-
strict_file_interactability: true,
|
355
|
-
timeouts: timeouts)
|
356
|
-
|
357
|
-
proxy_type = Selenium::WebDriver::VERSION[0] == '3' ? 'MANUAL' : 'manual'
|
358
|
-
|
359
|
-
expect(options.capabilities).to eq('browserName' => 'firefox',
|
360
|
-
'browserVersion' => 'latest',
|
361
|
-
'platformName' => 'Mac',
|
362
|
-
'acceptInsecureCerts' => true,
|
363
|
-
'pageLoadStrategy' => 'eager',
|
364
|
-
'proxy' => {'proxyType' => proxy_type, 'sslProxy' => 'foo'},
|
365
|
-
'setWindowRect' => true,
|
366
|
-
'unhandledPromptBehavior' => 'accept',
|
367
|
-
'strictFileInteractability' => true,
|
368
|
-
'timeouts' => {'implicit' => 1,
|
369
|
-
'pageLoad' => 59,
|
370
|
-
'script' => 29},
|
371
|
-
'sauce:options' => {'build' => 'TEMP BUILD: 11'})
|
190
|
+
describe '#accessors' do
|
191
|
+
it 'parses w3c values' do
|
192
|
+
proxy = Selenium::WebDriver::Proxy.new(ssl: 'foo')
|
193
|
+
timeouts = {implicit: 1,
|
194
|
+
page_load: 59,
|
195
|
+
script: 29}
|
196
|
+
|
197
|
+
expect { @options = Options.new }.to have_deprecated_options_init
|
198
|
+
|
199
|
+
@options.browser_name = 'firefox'
|
200
|
+
@options.browser_version = '7'
|
201
|
+
@options.platform_name = 'macOS 10.14'
|
202
|
+
@options.accept_insecure_certs = true
|
203
|
+
@options.page_load_strategy = 'eager'
|
204
|
+
@options.proxy = proxy
|
205
|
+
@options.set_window_rect = true
|
206
|
+
@options.unhandled_prompt_behavior = 'accept'
|
207
|
+
@options.strict_file_interactability = true
|
208
|
+
@options.timeouts = timeouts
|
209
|
+
|
210
|
+
expect(@options.browser_name).to eq 'firefox'
|
211
|
+
expect(@options.browser_version).to eq '7'
|
212
|
+
expect(@options.platform_name).to eq 'macOS 10.14'
|
213
|
+
expect(@options.accept_insecure_certs).to eq true
|
214
|
+
expect(@options.page_load_strategy).to eq 'eager'
|
215
|
+
expect(@options.proxy).to eq proxy
|
216
|
+
expect(@options.set_window_rect).to eq true
|
217
|
+
expect(@options.unhandled_prompt_behavior).to eq 'accept'
|
218
|
+
expect(@options.strict_file_interactability).to eq true
|
219
|
+
expect(@options.timeouts).to eq timeouts
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'parses Sauce values' do
|
223
|
+
custom_data = {foo: 'foo',
|
224
|
+
bar: 'bar'}
|
225
|
+
prerun = {executable: 'http://url.to/your/executable.exe',
|
226
|
+
args: ['--silent', '-a', '-q'],
|
227
|
+
background: false,
|
228
|
+
timeout: 120}
|
229
|
+
tags = %w[foo bar foobar]
|
230
|
+
|
231
|
+
expect { @options = Options.new }.to have_deprecated_options_init
|
232
|
+
|
233
|
+
@options.avoid_proxy = true
|
234
|
+
@options.build = 'Sample Build Name'
|
235
|
+
@options.capture_performance = true
|
236
|
+
@options.chromedriver_version = '71'
|
237
|
+
@options.command_timeout = 2
|
238
|
+
@options.custom_data = custom_data
|
239
|
+
@options.extended_debugging = true
|
240
|
+
@options.idle_timeout = 3
|
241
|
+
@options.iedriver_version = '3.141.0'
|
242
|
+
@options.max_duration = 300
|
243
|
+
@options.name = 'Sample Test Name'
|
244
|
+
@options.parent_tunnel = 'Mommy'
|
245
|
+
@options.prerun = prerun
|
246
|
+
@options.priority = 0
|
247
|
+
@options.public = 'team'
|
248
|
+
@options.record_logs = false
|
249
|
+
@options.record_screenshots = false
|
250
|
+
@options.record_video = false
|
251
|
+
@options.screen_resolution = '10x10'
|
252
|
+
@options.selenium_version = '3.141.59'
|
253
|
+
@options.tags = tags
|
254
|
+
@options.time_zone = 'San Francisco'
|
255
|
+
@options.tunnel_identifier = 'tunnelname'
|
256
|
+
@options.video_upload_on_pass = false
|
257
|
+
|
258
|
+
expect(@options.avoid_proxy).to eq true
|
259
|
+
expect(@options.build).to eq 'Sample Build Name'
|
260
|
+
expect(@options.capture_performance).to eq true
|
261
|
+
expect(@options.chromedriver_version).to eq '71'
|
262
|
+
expect(@options.command_timeout).to eq 2
|
263
|
+
expect(@options.custom_data).to eq custom_data
|
264
|
+
expect(@options.extended_debugging).to eq true
|
265
|
+
expect(@options.idle_timeout).to eq 3
|
266
|
+
expect(@options.iedriver_version).to eq '3.141.0'
|
267
|
+
expect(@options.max_duration).to eq 300
|
268
|
+
expect(@options.name).to eq 'Sample Test Name'
|
269
|
+
expect(@options.parent_tunnel).to eq 'Mommy'
|
270
|
+
expect(@options.prerun).to eq prerun
|
271
|
+
expect(@options.priority).to eq 0
|
272
|
+
expect(@options.public).to eq 'team'
|
273
|
+
expect(@options.record_logs).to eq false
|
274
|
+
expect(@options.record_screenshots).to eq false
|
275
|
+
expect(@options.record_video).to eq false
|
276
|
+
expect(@options.screen_resolution).to eq '10x10'
|
277
|
+
expect(@options.selenium_version).to eq '3.141.59'
|
278
|
+
expect(@options.tags).to eq tags
|
279
|
+
expect(@options.time_zone).to eq 'San Francisco'
|
280
|
+
expect(@options.tunnel_identifier).to eq 'tunnelname'
|
281
|
+
expect(@options.video_upload_on_pass).to eq false
|
282
|
+
end
|
372
283
|
end
|
373
284
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
'recordScreenshots' => false,
|
435
|
-
'recordVideo' => false,
|
436
|
-
'screenResolution' => '10x10',
|
437
|
-
'seleniumVersion' => '3.141.59',
|
438
|
-
'tags' => %w[foo bar foobar],
|
439
|
-
'timeZone' => 'San Francisco',
|
440
|
-
'tunnelIdentifier' => 'tunnelname',
|
441
|
-
'videoUploadOnPass' => false})
|
285
|
+
describe '#merge_capabilities' do
|
286
|
+
it 'loads options from configuration' do
|
287
|
+
timeouts = {implicit: 1,
|
288
|
+
page_load: 59,
|
289
|
+
script: 29}
|
290
|
+
custom_data = {foo: 'foo',
|
291
|
+
bar: 'bar'}
|
292
|
+
prerun = {executable: 'http://url.to/your/executable.exe',
|
293
|
+
args: ['--silent', '-a', '-q'],
|
294
|
+
background: false,
|
295
|
+
timeout: 120}
|
296
|
+
tags = %w[foo bar foobar]
|
297
|
+
|
298
|
+
expect { @options = Options.new }.to have_deprecated_options_init
|
299
|
+
yaml = YAML.load_file('spec/deprecated_options.yml')
|
300
|
+
@options.merge_capabilities(yaml['example_values'])
|
301
|
+
|
302
|
+
expect(@options.browser_name).to eq 'firefox'
|
303
|
+
expect(@options.browser_version).to eq '123'
|
304
|
+
expect(@options.platform_name).to eq 'Mac'
|
305
|
+
expect(@options.accept_insecure_certs).to eq true
|
306
|
+
expect(@options.page_load_strategy).to eq 'eager'
|
307
|
+
expect(@options.set_window_rect).to eq true
|
308
|
+
expect(@options.unhandled_prompt_behavior).to eq 'accept'
|
309
|
+
expect(@options.strict_file_interactability).to eq true
|
310
|
+
expect(@options.timeouts).to eq timeouts
|
311
|
+
expect(@options.avoid_proxy).to eq true
|
312
|
+
expect(@options.build).to eq 'Sample Build Name'
|
313
|
+
expect(@options.capture_performance).to eq true
|
314
|
+
expect(@options.chromedriver_version).to eq '71'
|
315
|
+
expect(@options.command_timeout).to eq 2
|
316
|
+
expect(@options.custom_data).to eq custom_data
|
317
|
+
expect(@options.extended_debugging).to eq true
|
318
|
+
expect(@options.idle_timeout).to eq 3
|
319
|
+
expect(@options.iedriver_version).to eq '3.141.0'
|
320
|
+
expect(@options.max_duration).to eq 300
|
321
|
+
expect(@options.name).to eq 'Sample Test Name'
|
322
|
+
expect(@options.parent_tunnel).to eq 'Mommy'
|
323
|
+
expect(@options.prerun).to eq prerun
|
324
|
+
expect(@options.priority).to eq 0
|
325
|
+
expect(@options.public).to eq 'team'
|
326
|
+
expect(@options.record_logs).to eq false
|
327
|
+
expect(@options.record_screenshots).to eq false
|
328
|
+
expect(@options.record_video).to eq false
|
329
|
+
expect(@options.screen_resolution).to eq '10x10'
|
330
|
+
expect(@options.selenium_version).to eq '3.141.59'
|
331
|
+
expect(@options.tags).to eq tags
|
332
|
+
expect(@options.time_zone).to eq 'San Francisco'
|
333
|
+
expect(@options.tunnel_identifier).to eq 'tunnelname'
|
334
|
+
expect(@options.video_upload_on_pass).to eq false
|
335
|
+
end
|
336
|
+
|
337
|
+
it 'raises exception if value not recognized' do
|
338
|
+
expect { @options = Options.new }.to have_deprecated_options_init
|
339
|
+
|
340
|
+
yaml = YAML.load_file('spec/deprecated_options.yml')
|
341
|
+
|
342
|
+
msg = 'foo is not a valid parameter for Options class'
|
343
|
+
expect { @options.merge_capabilities(yaml['invalid_option']) }.to raise_exception(ArgumentError, msg)
|
344
|
+
end
|
442
345
|
end
|
443
346
|
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
347
|
+
describe '#capabilities' do
|
348
|
+
it 'correctly generates capabilities for w3c values' do
|
349
|
+
proxy = Selenium::WebDriver::Proxy.new(ssl: 'foo')
|
350
|
+
timeouts = {implicit: 1,
|
351
|
+
page_load: 59,
|
352
|
+
script: 29}
|
353
|
+
|
354
|
+
ClimateControl.modify(**BUILD_ENV) do
|
355
|
+
# expect {
|
356
|
+
@options = Options.new(browser_name: 'firefox',
|
357
|
+
platform_name: 'Mac',
|
358
|
+
accept_insecure_certs: true,
|
359
|
+
page_load_strategy: 'eager',
|
360
|
+
proxy: proxy,
|
361
|
+
set_window_rect: true,
|
362
|
+
unhandled_prompt_behavior: 'accept',
|
363
|
+
strict_file_interactability: true,
|
364
|
+
timeouts: timeouts)
|
365
|
+
# }.to have_deprecated_options_init
|
366
|
+
end
|
367
|
+
|
368
|
+
ClimateControl.modify(**SAUCE_ACCESS) do
|
369
|
+
expect {
|
370
|
+
@capabilities = @options.capabilities
|
371
|
+
}.to have_deprecated_timeouts
|
372
|
+
end
|
373
|
+
|
374
|
+
expect(@capabilities).to eq('browserName' => 'firefox',
|
375
|
+
'browserVersion' => 'latest',
|
376
|
+
'platformName' => 'Mac',
|
377
|
+
'acceptInsecureCerts' => true,
|
378
|
+
'pageLoadStrategy' => 'eager',
|
379
|
+
'proxy' => {'proxyType' => 'manual', 'sslProxy' => 'foo'},
|
380
|
+
'setWindowRect' => true,
|
381
|
+
'unhandledPromptBehavior' => 'accept',
|
382
|
+
'strictFileInteractability' => true,
|
383
|
+
'timeouts' => {'implicit' => 1,
|
384
|
+
'pageLoad' => 59,
|
385
|
+
'script' => 29},
|
386
|
+
'sauce:options' => {'build' => 'TEMP BUILD: 11',
|
387
|
+
'username' => 'foo',
|
388
|
+
'accessKey' => '123'})
|
389
|
+
end
|
390
|
+
|
391
|
+
it 'correctly generates capabilities for sauce values' do
|
392
|
+
custom_data = {foo: 'foo',
|
393
|
+
bar: 'bar'}
|
394
|
+
prerun = {executable: 'http://url.to/your/executable.exe',
|
395
|
+
args: ['--silent', '-a', '-q'],
|
396
|
+
background: false,
|
397
|
+
timeout: 120}
|
398
|
+
tags = %w[foo bar foobar]
|
399
|
+
sauce_options = {avoid_proxy: true,
|
400
|
+
build: 'Sample Build Name',
|
401
|
+
capture_performance: true,
|
402
|
+
chromedriver_version: '71',
|
403
|
+
command_timeout: 2,
|
404
|
+
custom_data: custom_data,
|
405
|
+
extended_debugging: true,
|
406
|
+
idle_timeout: 3,
|
407
|
+
iedriver_version: '3.141.0',
|
408
|
+
max_duration: 300,
|
409
|
+
name: 'Sample Test Name',
|
410
|
+
parent_tunnel: 'Mommy',
|
411
|
+
prerun: prerun,
|
412
|
+
priority: 0,
|
413
|
+
public: 'team',
|
414
|
+
record_logs: false,
|
415
|
+
record_screenshots: false,
|
416
|
+
record_video: false,
|
417
|
+
screen_resolution: '10x10',
|
418
|
+
selenium_version: '3.141.59',
|
419
|
+
tags: tags,
|
420
|
+
time_zone: 'San Francisco',
|
421
|
+
tunnel_identifier: 'tunnelname',
|
422
|
+
video_upload_on_pass: false}
|
423
|
+
|
424
|
+
ClimateControl.modify(**BUILD_ENV) do
|
425
|
+
expect { @options = Options.new(**sauce_options) }.to have_deprecated_options_init
|
426
|
+
end
|
427
|
+
|
428
|
+
prerun_caps = {'executable' => 'http://url.to/your/executable.exe',
|
429
|
+
'args' => ['--silent', '-a', '-q'],
|
430
|
+
'background' => false,
|
431
|
+
'timeout' => 120}
|
432
|
+
|
433
|
+
ClimateControl.modify(**SAUCE_ACCESS) do
|
434
|
+
@capabilities = @options.capabilities
|
435
|
+
end
|
436
|
+
|
437
|
+
expect(@capabilities).to eq('browserName' => 'chrome',
|
438
|
+
'browserVersion' => 'latest',
|
439
|
+
'platformName' => 'Windows 10',
|
440
|
+
'sauce:options' => {'build' => 'Sample Build Name',
|
441
|
+
'avoidProxy' => true,
|
442
|
+
'capturePerformance' => true,
|
443
|
+
'chromedriverVersion' => '71',
|
444
|
+
'commandTimeout' => 2,
|
445
|
+
'customData' => {'foo' => 'foo',
|
446
|
+
'bar' => 'bar'},
|
447
|
+
'extendedDebugging' => true,
|
448
|
+
'idleTimeout' => 3,
|
449
|
+
'iedriverVersion' => '3.141.0',
|
450
|
+
'maxDuration' => 300,
|
451
|
+
'name' => 'Sample Test Name',
|
452
|
+
'parentTunnel' => 'Mommy',
|
453
|
+
'prerun' => prerun_caps,
|
454
|
+
'priority' => 0,
|
455
|
+
'public' => 'team',
|
456
|
+
'recordLogs' => false,
|
457
|
+
'recordScreenshots' => false,
|
458
|
+
'recordVideo' => false,
|
459
|
+
'screenResolution' => '10x10',
|
460
|
+
'seleniumVersion' => '3.141.59',
|
461
|
+
'tags' => %w[foo bar foobar],
|
462
|
+
'timeZone' => 'San Francisco',
|
463
|
+
'tunnelIdentifier' => 'tunnelname',
|
464
|
+
'username' => 'foo',
|
465
|
+
'accessKey' => '123',
|
466
|
+
'videoUploadOnPass' => false})
|
467
|
+
end
|
468
|
+
|
469
|
+
it 'correctly generates capabilities for selenium object values' do
|
470
|
+
caps = Selenium::WebDriver::Remote::Capabilities.chrome(accept_insecure_certs: true,
|
471
|
+
page_load_strategy: 'eager')
|
472
|
+
browser_opts = Selenium::WebDriver::Chrome::Options.new(args: ['--foo'])
|
473
|
+
|
474
|
+
ClimateControl.modify(**BUILD_ENV) do
|
475
|
+
expect { @options = Options.new(selenium_options: [caps, browser_opts]) }.to have_deprecated_options_init
|
476
|
+
end
|
477
|
+
|
478
|
+
expected_caps = {'browserName' => 'chrome',
|
479
|
+
'browserVersion' => 'latest',
|
480
|
+
'platformName' => 'Windows 10',
|
481
|
+
'acceptInsecureCerts' => true,
|
482
|
+
'pageLoadStrategy' => 'eager',
|
483
|
+
'sauce:options' => {'build' => 'TEMP BUILD: 11',
|
484
|
+
'username' => 'foo',
|
485
|
+
'accessKey' => '123'},
|
486
|
+
'goog:chromeOptions' => {'args' => ['--foo']}}
|
487
|
+
|
488
|
+
ClimateControl.modify(**SAUCE_ACCESS) do
|
489
|
+
expect(@options.capabilities).to eq expected_caps
|
490
|
+
end
|
491
|
+
end
|
469
492
|
end
|
470
493
|
end
|
471
494
|
end
|