sauce 3.4.9 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/sauce.rb +1 -0
- data/lib/sauce/config.rb +17 -5
- data/lib/sauce/parallel/test_group.rb +3 -1
- data/lib/sauce/rspec.rb +8 -5
- data/lib/sauce/test_base.rb +21 -0
- data/lib/sauce/version.rb +2 -2
- data/lib/tasks/parallel_testing.rb +2 -1
- data/spec/sauce/config/config_spec.rb +56 -28
- data/spec/sauce/config/environment_config_spec.rb +2 -2
- data/spec/sauce/config/perfile_browser_spec.rb +12 -12
- data/spec/sauce/tasks_spec.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmRhMDYwMjkzNTI2ZWM2NDUxMDBkN2I0YTQ5YzVjMTJmODVkMzBlMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDQ3NTNlMGUzOTc5Nzg3Yjk2MWI1NjYyYTM3MGQ3MjMyMDFmNWZhYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzU0ZjlhMDM3Y2E2NDRhMGU4NmFhYmVjZDM0M2UyNGVkYTBkNGExZWVhYzZh
|
10
|
+
NTNmNzM3YzZhOTQyNmJkYjBlZjExMjU4NWVmMWI2OTU0N2Y4ZjU3NDM5Y2I0
|
11
|
+
OGY2NTQ2NTkxOGNhMmRhYTMyMmY1NjJjYzYwNTk5Y2QwNjBjNzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGY0MjQ4ZjkwYmJjYmExNzZmNmMxNGEwY2NjZDgwMGM3ZjA4MzczODkzMjgw
|
14
|
+
MGM4NzNlNTk0ZjMxMjg4Y2Q3MjYzMmFlMzEwM2E2OTAyYWY4YWRkYmQ3M2Jj
|
15
|
+
ZjI2MDNhMzZjMTUwNjQ0MzAzNTM3NWZhYmExNTkxMmJhYjYzYjY=
|
data/lib/sauce.rb
CHANGED
data/lib/sauce/config.rb
CHANGED
@@ -142,6 +142,16 @@ module Sauce
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
+
def whitelisted_capabilities
|
146
|
+
@whitelisted_capabilities ||= Set.new
|
147
|
+
end
|
148
|
+
|
149
|
+
def whitelist capability
|
150
|
+
cap = capability.to_s
|
151
|
+
wl = whitelisted_capabilities || Set.new
|
152
|
+
@whitelisted_capabilities = wl.add cap
|
153
|
+
end
|
154
|
+
|
145
155
|
def to_browser_string
|
146
156
|
browser_options = {
|
147
157
|
'username' => @opts[:username],
|
@@ -168,7 +178,9 @@ module Sauce
|
|
168
178
|
:client_version => client_version
|
169
179
|
}
|
170
180
|
|
171
|
-
|
181
|
+
allowed_options = whitelisted_capabilities + SAUCE_OPTIONS
|
182
|
+
|
183
|
+
allowed_options.each do |opt|
|
172
184
|
[opt, opt.gsub("-", "_")].map(&:to_sym).each do |sym|
|
173
185
|
if @opts.include? sym
|
174
186
|
desired_capabilities[opt.to_sym] = @opts[sym]
|
@@ -193,7 +205,7 @@ module Sauce
|
|
193
205
|
return [[os, browser, browser_version]]
|
194
206
|
end
|
195
207
|
|
196
|
-
def
|
208
|
+
def caps_for_location(file, linenumber=nil)
|
197
209
|
Sauce::Config.called_from_integrations
|
198
210
|
perfile_browsers = @opts[:perfile_browsers]
|
199
211
|
|
@@ -205,7 +217,7 @@ module Sauce
|
|
205
217
|
else
|
206
218
|
platforms = perfile_browsers[file]
|
207
219
|
end
|
208
|
-
platforms.map { |p| [p['os'], p['browser'], p['version']] }
|
220
|
+
platforms.map { |p| [p['os'], p['browser'], p['version'], (p['caps'] || {})] }
|
209
221
|
else
|
210
222
|
browsers
|
211
223
|
end
|
@@ -347,7 +359,7 @@ module Sauce
|
|
347
359
|
]
|
348
360
|
|
349
361
|
paths.each do |path|
|
350
|
-
if File.
|
362
|
+
if File.exist? path
|
351
363
|
conf = YAML.load_file(path)
|
352
364
|
return conf.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
353
365
|
end
|
@@ -385,7 +397,7 @@ module Sauce
|
|
385
397
|
|
386
398
|
if env_browsers
|
387
399
|
browsers = JSON.parse(env_browsers)
|
388
|
-
opts[:browsers] = browsers.map { |x| [x['os'], x['browser'], x['version']] }
|
400
|
+
opts[:browsers] = browsers.map { |x| [x['os'], x['browser'], x['version'], x['caps']] }
|
389
401
|
end
|
390
402
|
|
391
403
|
if hash.include? 'SAUCE_PERFILE_BROWSERS'
|
@@ -9,11 +9,13 @@ module Sauce
|
|
9
9
|
platform = @platforms[@index]
|
10
10
|
@index += 1
|
11
11
|
begin
|
12
|
-
{
|
12
|
+
caps ={
|
13
13
|
'os' => platform[0],
|
14
14
|
'browser' => platform[1],
|
15
15
|
'version' => platform[2]
|
16
16
|
}
|
17
|
+
caps.merge!({:caps => platform[3]}) if platform[3]
|
18
|
+
caps
|
17
19
|
rescue NoMethodError => e
|
18
20
|
puts "I don't have any config"
|
19
21
|
end
|
data/lib/sauce/rspec.rb
CHANGED
@@ -149,6 +149,7 @@ begin
|
|
149
149
|
end
|
150
150
|
|
151
151
|
module SeleniumExampleGroup
|
152
|
+
include Sauce::TestBase
|
152
153
|
attr_reader :selenium
|
153
154
|
alias_method :s, :selenium
|
154
155
|
|
@@ -184,13 +185,12 @@ begin
|
|
184
185
|
description = the_test.metadata[:full_description]
|
185
186
|
file = the_test.metadata[:file_path]
|
186
187
|
exceptions = {}
|
187
|
-
config.
|
188
|
+
test_each config.caps_for_location(file), description do |selenium, caps|
|
189
|
+
|
188
190
|
example = SeleniumExampleGroup.current_example.call(self)
|
189
191
|
example.instance_variable_set(:@exception, nil)
|
190
|
-
|
191
|
-
|
192
|
-
:browser_version => version,
|
193
|
-
:job_name => description})
|
192
|
+
|
193
|
+
@selenium = selenium
|
194
194
|
Sauce.driver_pool[Thread.current.object_id] = @selenium
|
195
195
|
example.metadata[:sauce_public_link] = SauceWhisk.public_link(@selenium.session_id)
|
196
196
|
|
@@ -200,6 +200,9 @@ begin
|
|
200
200
|
ensure
|
201
201
|
@selenium.stop
|
202
202
|
begin
|
203
|
+
os = caps[:os]
|
204
|
+
browser = caps[:browser]
|
205
|
+
version = caps[:version]
|
203
206
|
unless success
|
204
207
|
exceptions["#{os} - #{browser} #{version}"] = example.exception
|
205
208
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Sauce
|
2
|
+
module TestBase
|
3
|
+
|
4
|
+
# Run a block with every platform
|
5
|
+
def test_each(platforms, description)
|
6
|
+
platforms.each do |platform|
|
7
|
+
capabilities = {
|
8
|
+
:os => platform[0],
|
9
|
+
:browser => platform[1],
|
10
|
+
:version => platform[2],
|
11
|
+
:job_name => description
|
12
|
+
}
|
13
|
+
|
14
|
+
capabilities.merge! platform[3] if platform[3]
|
15
|
+
selenium = Sauce::Selenium2.new(capabilities)
|
16
|
+
|
17
|
+
yield selenium, capabilities
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/sauce/version.rb
CHANGED
@@ -2,6 +2,7 @@ require "sauce/parallel/test_broker"
|
|
2
2
|
require "parallel_tests"
|
3
3
|
require "parallel_tests/tasks"
|
4
4
|
require "parallel_tests/cli_patch"
|
5
|
+
require "shellwords"
|
5
6
|
|
6
7
|
namespace :sauce do
|
7
8
|
desc "Run specs in parallel on Sauce Labs"
|
@@ -141,7 +142,7 @@ def parse_task_args(test_tool=:rspec, args)
|
|
141
142
|
end
|
142
143
|
|
143
144
|
return_args.push *(parallel_options.split(' ')) if parallel_options
|
144
|
-
return_args.
|
145
|
+
return_args.concat files.split
|
145
146
|
|
146
147
|
return return_args
|
147
148
|
end
|
@@ -255,46 +255,72 @@ describe Sauce::Config do
|
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
|
-
|
258
|
+
context 'with unusual options' do
|
259
259
|
let(:config) {Sauce::Config.new}
|
260
260
|
|
261
|
-
|
262
|
-
config
|
261
|
+
it 'should ignore them by default' do
|
262
|
+
config[:new_option] = 'caramel'
|
263
|
+
config.to_desired_capabilities[:new_option].should be_nil
|
263
264
|
end
|
264
265
|
|
265
|
-
it
|
266
|
-
config
|
266
|
+
it 'should include them when configured with exceptions' do
|
267
|
+
config[:new_option] = 'elderflower'
|
268
|
+
config.whitelist :new_option
|
269
|
+
config.to_desired_capabilities[:new_option].should include 'elderflower'
|
267
270
|
end
|
268
271
|
|
269
|
-
it
|
270
|
-
config
|
271
|
-
config
|
272
|
+
it 'should allow multiple exceptions' do
|
273
|
+
config[:new_option] = 'elderflower'
|
274
|
+
config[:another_option] = 'mint'
|
275
|
+
config.whitelist :new_option
|
276
|
+
config.whitelist :another_option
|
277
|
+
|
278
|
+
config.to_desired_capabilities[:new_option].should include 'elderflower'
|
279
|
+
config.to_desired_capabilities[:another_option].should include 'mint'
|
280
|
+
config.to_desired_capabilities[:not_an_option].should be_nil
|
272
281
|
end
|
282
|
+
end
|
283
|
+
end
|
273
284
|
|
274
|
-
|
275
|
-
|
276
|
-
config.tools.should_not include "Capybara"
|
277
|
-
end
|
285
|
+
describe "#tools" do
|
286
|
+
let(:config) {Sauce::Config.new}
|
278
287
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
end
|
288
|
+
before :each do
|
289
|
+
config.stub(:is_defined?).and_call_original
|
290
|
+
end
|
283
291
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
end
|
292
|
+
it "should include rspec if present" do
|
293
|
+
config.tools.should include "Rspec"
|
294
|
+
end
|
288
295
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
296
|
+
it "should include capybara" do
|
297
|
+
config.stub(:is_defined?).with("Capybara") {true}
|
298
|
+
config.tools.should include "Capybara"
|
299
|
+
end
|
293
300
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
301
|
+
it "should not include capybara when absent" do
|
302
|
+
config.stub(:is_defined?).with("Capybara") {false}
|
303
|
+
config.tools.should_not include "Capybara"
|
304
|
+
end
|
305
|
+
|
306
|
+
it "should not include cucumber when not present" do
|
307
|
+
config.stub(:is_defined?).with("Cucumber") {false}
|
308
|
+
config.tools.should_not include "Cucumber"
|
309
|
+
end
|
310
|
+
|
311
|
+
it "should include cucumber when present" do
|
312
|
+
config.stub(:is_defined?).with("Cucumber") {true}
|
313
|
+
config.tools.should include "Cucumber"
|
314
|
+
end
|
315
|
+
|
316
|
+
it "should include test::unit if present" do
|
317
|
+
config.stub(:is_defined?).with("Test","Unit") {true}
|
318
|
+
config.tools.should include "Test::Unit"
|
319
|
+
end
|
320
|
+
|
321
|
+
it "should not include test::unit if absent" do
|
322
|
+
config.stub(:is_defined?).with("Test", "Unit") {false}
|
323
|
+
config.tools.should_not include "Test::Unit"
|
298
324
|
end
|
299
325
|
end
|
300
326
|
|
@@ -316,6 +342,8 @@ describe Sauce::Config do
|
|
316
342
|
c.browser_version.should == 'BROWSER_VERSION2'
|
317
343
|
end
|
318
344
|
end
|
345
|
+
|
346
|
+
describe "#"
|
319
347
|
end
|
320
348
|
|
321
349
|
describe Sauce do
|
@@ -97,8 +97,8 @@ describe "Sauce::Config" do
|
|
97
97
|
it "should extract the browsers" do
|
98
98
|
opts = test_config.send(:extract_options_from_hash, browsers)
|
99
99
|
opts[:browsers].should eq([
|
100
|
-
["os1", "ie1", "version1"],
|
101
|
-
["os2", "ie2", "version2"]
|
100
|
+
["os1", "ie1", "version1", nil],
|
101
|
+
["os2", "ie2", "version2", nil]
|
102
102
|
])
|
103
103
|
end
|
104
104
|
end
|
@@ -24,17 +24,17 @@ describe "Sauce::Config" do
|
|
24
24
|
filename = "./features/duckduck.feature"
|
25
25
|
fn = 14
|
26
26
|
|
27
|
-
Sauce::Config.new.
|
27
|
+
Sauce::Config.new.caps_for_location(filename, fn).should eq expected_browsers
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should return the browsers for the requested location" do
|
31
31
|
expected_browsers = [
|
32
|
-
["Linux", "Chrome", "nil"],
|
33
|
-
["Mac", "Safari", "5"]
|
32
|
+
["Linux", "Chrome", "nil", {}],
|
33
|
+
["Mac", "Safari", "5", {}]
|
34
34
|
]
|
35
35
|
|
36
36
|
browser_hash = expected_browsers.map { |a|
|
37
|
-
{"os" => a[0], "browser" => a[1], "version" => a[2]}
|
37
|
+
{"os" => a[0], "browser" => a[1], "version" => a[2], "caps" => a[3]}
|
38
38
|
}
|
39
39
|
|
40
40
|
env_hash = {
|
@@ -49,13 +49,13 @@ describe "Sauce::Config" do
|
|
49
49
|
filename = "./features/duckduck.feature"
|
50
50
|
fn = 14
|
51
51
|
|
52
|
-
Sauce::Config.new.
|
52
|
+
Sauce::Config.new.caps_for_location(filename, fn).should eq expected_browsers
|
53
53
|
end
|
54
54
|
|
55
55
|
it "returns the line number location if present" do
|
56
56
|
expected_browsers = [
|
57
|
-
["Linux", "Chrome", "nil"],
|
58
|
-
["Mac", "Safari", "5"]
|
57
|
+
["Linux", "Chrome", "nil", {}],
|
58
|
+
["Mac", "Safari", "5", {}]
|
59
59
|
]
|
60
60
|
|
61
61
|
browser_hash = expected_browsers.map { |a|
|
@@ -74,13 +74,13 @@ describe "Sauce::Config" do
|
|
74
74
|
filename = "./features/duckduck.feature"
|
75
75
|
fn = 11
|
76
76
|
|
77
|
-
Sauce::Config.new.
|
77
|
+
Sauce::Config.new.caps_for_location(filename, fn).should eq expected_browsers
|
78
78
|
end
|
79
79
|
|
80
|
-
|
80
|
+
it "ignores line number if it can't find it" do
|
81
81
|
expected_browsers = [
|
82
|
-
["Linux", "Chrome", "nil"],
|
83
|
-
["Mac", "Safari", "5"]
|
82
|
+
["Linux", "Chrome", "nil", {}],
|
83
|
+
["Mac", "Safari", "5", {}]
|
84
84
|
]
|
85
85
|
|
86
86
|
browser_hash = expected_browsers.map { |a|
|
@@ -99,7 +99,7 @@ describe "Sauce::Config" do
|
|
99
99
|
filename = "./features/duckduck.feature"
|
100
100
|
fn = 6
|
101
101
|
|
102
|
-
Sauce::Config.new.
|
102
|
+
Sauce::Config.new.caps_for_location(filename, fn).should eq expected_browsers
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
data/spec/sauce/tasks_spec.rb
CHANGED
@@ -103,7 +103,7 @@ describe 'parse_task_args' do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'defaults to not being present for cucumber' do
|
106
|
-
actual_args = parse_task_args(:
|
106
|
+
actual_args = parse_task_args(:cucumber, {}).join ' '
|
107
107
|
actual_args.should_not include '-o'
|
108
108
|
end
|
109
109
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sauce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Lacey
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2014-
|
17
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rspec
|
@@ -218,14 +218,14 @@ dependencies:
|
|
218
218
|
requirements:
|
219
219
|
- - '='
|
220
220
|
- !ruby/object:Gem::Version
|
221
|
-
version: 0.
|
221
|
+
version: 1.0.6
|
222
222
|
type: :runtime
|
223
223
|
prerelease: false
|
224
224
|
version_requirements: !ruby/object:Gem::Requirement
|
225
225
|
requirements:
|
226
226
|
- - '='
|
227
227
|
- !ruby/object:Gem::Version
|
228
|
-
version: 0.
|
228
|
+
version: 1.0.6
|
229
229
|
- !ruby/object:Gem::Dependency
|
230
230
|
name: sauce_whisk
|
231
231
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,6 +268,7 @@ files:
|
|
268
268
|
- lib/sauce/raketasks.rb
|
269
269
|
- lib/sauce/rspec.rb
|
270
270
|
- lib/sauce/selenium.rb
|
271
|
+
- lib/sauce/test_base.rb
|
271
272
|
- lib/sauce/test_unit.rb
|
272
273
|
- lib/sauce/utilities.rb
|
273
274
|
- lib/sauce/utilities/connect.rb
|