sauce 3.0.4 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/parallel_tests/saucecucumber/runner.rb +2 -1
- data/lib/sauce.rb +2 -1
- data/lib/sauce/config.rb +22 -4
- data/lib/sauce/{integrations.rb → rspec.rb} +6 -111
- data/lib/sauce/test_unit.rb +111 -0
- data/lib/sauce/utilities.rb +8 -0
- data/lib/sauce/version.rb +1 -1
- data/spec/integration/rspec/spec/integration_spec.rb +1 -4
- data/spec/integration/rspec/spec/selenium/selenium_directory_spec.rb +2 -28
- data/spec/integration/rspec/spec/spec_helper.rb +38 -1
- data/spec/integration/rspec/spec/tagging/selenium_tagging_spec.rb +1 -16
- data/spec/sauce/config/browser_spec.rb +73 -0
- data/spec/sauce/cucumber_spec.rb +3 -5
- data/spec/sauce/jasmine_spec.rb +1 -1
- data/spec/sauce/selenium_spec.rb +2 -2
- data/spec/sauce/utilities/rake_spec.rb +1 -5
- data/spec/sauce/utilities/utilities_spec.rb +2 -3
- data/spec/spec_helper.rb +3 -0
- metadata +24 -8
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGZjNmJlNmRmY2NiYWNjYmRlOWNjN2Y0ZDhmYTg4MmFhMWJlNzJhMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTA3Y2FmYjU1ZjJiNTkxNThmNGYzMjAwNzM3YTFmNDVkYTVlNzIyMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmNhNDRmNjc5NDg2MTQ1MTYxNmU0Y2UyZGZlYmVlMDMwZjg4NTIzOGNkZWQx
|
10
|
+
MDQwNDNlZjAwN2QwOTM1MjFiOGM0NmRlNzI0ODkwNmY4NzYwN2Q0MDlhZmI1
|
11
|
+
ZjFmOTQ2ZGU3MjZkODQ4NzI5MWM0MzlhM2ZiOTE2ZjkzMmI1MzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzIwYmZlOWYxZTRhNzNiY2NkZWI0MDZlNmI5ZjQ4MTQ0YzljMjFmMmMyMmQ5
|
14
|
+
YjIzY2I0NmY1NmI3NmFiNjZjZWI1ZjYxMzdhMzgzYzQyZjZjMjZjMGNiYmNl
|
15
|
+
NjgyNGU0ZmQ0MTM3NDE1MmEwNTY4Nzg3MDM2ZTQ0ZDQ4ODc3N2I=
|
@@ -10,7 +10,6 @@ module ParallelTests
|
|
10
10
|
env = Sauce::TestBroker.next_environment(test_files)
|
11
11
|
env.merge!({"AUTOTEST" => "1"}) if $stdout.tty? # display color when we are in a terminal
|
12
12
|
options.merge!({:env => env})
|
13
|
-
runtime_logging = " --format ParallelTests::Cucumber::RuntimeLogger --out #{runtime_log}"
|
14
13
|
cmd = [
|
15
14
|
executable,
|
16
15
|
(runtime_logging if File.directory?(File.dirname(runtime_log))),
|
@@ -20,6 +19,8 @@ module ParallelTests
|
|
20
19
|
execute_command(cmd, process_number, num_processes, options)
|
21
20
|
end
|
22
21
|
|
22
|
+
|
23
|
+
|
23
24
|
def self.tests_in_groups(tests, num_groups, options={})
|
24
25
|
originals = (options[:group_by] == :steps) ? Grouper.by_steps(find_tests(tests, options), num_groups, options) : super
|
25
26
|
all_tests = originals.flatten * Sauce::TestBroker.test_platforms.length
|
data/lib/sauce.rb
CHANGED
@@ -5,7 +5,8 @@ require 'sauce/job'
|
|
5
5
|
require 'sauce/client'
|
6
6
|
require 'sauce/config'
|
7
7
|
require 'sauce/selenium'
|
8
|
-
require 'sauce/
|
8
|
+
require 'sauce/rspec'
|
9
|
+
require 'sauce/test_unit'
|
9
10
|
require 'tasks/parallel_testing'
|
10
11
|
require 'parallel_tests/saucerspec/runner'
|
11
12
|
require 'parallel_tests/saucecucumber/runner'
|
data/lib/sauce/config.rb
CHANGED
@@ -159,18 +159,18 @@ module Sauce
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def browser
|
162
|
-
if
|
162
|
+
if single_browser_set?
|
163
163
|
return @undefaulted_opts[:browser]
|
164
164
|
end
|
165
165
|
if !ENV["TEST_ENV_NUMBER"] && @opts[:browsers]
|
166
166
|
@opts[:browsers][0][1]
|
167
167
|
else
|
168
|
-
|
168
|
+
raise StandardError, no_browser_message
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
172
|
def os
|
173
|
-
if
|
173
|
+
if single_browser_set?
|
174
174
|
return @undefaulted_opts[:os]
|
175
175
|
end
|
176
176
|
if !ENV["TEST_ENV_NUMBER"] && @opts[:browsers]
|
@@ -181,7 +181,7 @@ module Sauce
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def browser_version
|
184
|
-
if
|
184
|
+
if single_browser_set?
|
185
185
|
return @undefaulted_opts[:browser_version]
|
186
186
|
end
|
187
187
|
if !ENV["TEST_ENV_NUMBER"] && @opts[:browsers]
|
@@ -326,5 +326,23 @@ module Sauce
|
|
326
326
|
|
327
327
|
return opts.delete_if {|key, value| value.nil?}
|
328
328
|
end
|
329
|
+
|
330
|
+
private
|
331
|
+
|
332
|
+
def single_browser_set?
|
333
|
+
@undefaulted_opts[:browser] || @undefaulted_opts[:os] || @undefaulted_opts[:version]
|
334
|
+
end
|
335
|
+
|
336
|
+
def no_browser_message
|
337
|
+
<<-MESSAGE
|
338
|
+
No browser has been configured.
|
339
|
+
|
340
|
+
It seems you're trying to run your tests in parallel, but haven't configured your specs/tests to use the Sauce integration.
|
341
|
+
|
342
|
+
To fix this, add :sauce => true to your specs or make your tests subclasses of Sauce::TestCase or Sauce::RailsTestCase.
|
343
|
+
|
344
|
+
For more details check the gem readme at https://github.com/DylanLacey/sauce_ruby/blob/master/README.markdown
|
345
|
+
MESSAGE
|
346
|
+
end
|
329
347
|
end
|
330
348
|
end
|
@@ -66,9 +66,13 @@ begin
|
|
66
66
|
module RSpec
|
67
67
|
module SeleniumExampleGroup
|
68
68
|
attr_reader :selenium
|
69
|
-
alias_method :page, :selenium
|
70
69
|
alias_method :s, :selenium
|
71
70
|
|
71
|
+
def page
|
72
|
+
warn Sauce::Utilities.page_deprecation_message
|
73
|
+
@selenium
|
74
|
+
end
|
75
|
+
|
72
76
|
def self.included(othermod)
|
73
77
|
othermod.around do |the_test|
|
74
78
|
config = Sauce::Config.new
|
@@ -147,113 +151,4 @@ rescue LoadError, TypeError
|
|
147
151
|
# User doesn't have RSpec 2.x installed
|
148
152
|
rescue => e
|
149
153
|
STDERR.puts "Exception caught: #{e.to_s}"
|
150
|
-
end
|
151
|
-
|
152
|
-
module Sauce
|
153
|
-
module SeleniumForTestUnit
|
154
|
-
attr_reader :browser
|
155
|
-
|
156
|
-
alias_method :page, :browser
|
157
|
-
alias_method :s, :browser
|
158
|
-
alias_method :selenium, :browser
|
159
|
-
|
160
|
-
def run(*args, &blk)
|
161
|
-
if self.respond_to? :name
|
162
|
-
my_name = self.name
|
163
|
-
else
|
164
|
-
my_name = self.__name__
|
165
|
-
end
|
166
|
-
unless my_name =~ /^default_test/
|
167
|
-
config = Sauce::Config.new
|
168
|
-
if config[:application_host]
|
169
|
-
unless ENV['TEST_ENV_NUMBER'].to_i > 1
|
170
|
-
Sauce::Connect.ensure_connected(:host => config[:application_host], :port => config[:application_port] || 80)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
unless defined?(@@server)
|
175
|
-
unless ENV['TEST_ENV_NUMBER'].to_i > 1
|
176
|
-
if config[:start_local_application] &&
|
177
|
-
Sauce::Utilities::RailsServer.is_rails_app?
|
178
|
-
@@server = Sauce::Utilities::RailsServer.new
|
179
|
-
@@server.start
|
180
|
-
at_exit do
|
181
|
-
@@server.stop
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
config[:browsers].each do |os, browser, version|
|
188
|
-
options = self.class.sauce_config
|
189
|
-
options.merge!({:os => os, :browser => browser,
|
190
|
-
:browser_version => version,
|
191
|
-
:job_name => my_name.to_s})
|
192
|
-
@browser = Sauce::Selenium2.new(options)
|
193
|
-
Sauce.driver_pool[Thread.current.object_id] = @browser
|
194
|
-
|
195
|
-
super(*args, &blk)
|
196
|
-
|
197
|
-
SauceWhisk::Jobs.change_status @browser.session_id, passed?
|
198
|
-
@browser.stop
|
199
|
-
Sauce.driver_pool.delete Thread.current.object_id
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
module Sauce
|
207
|
-
module SeleniumForTestUnitClassMethods
|
208
|
-
def selenium_flags=(options)
|
209
|
-
@selenium_flags = options
|
210
|
-
end
|
211
|
-
|
212
|
-
def selenium_flags
|
213
|
-
return @selenium_flags
|
214
|
-
end
|
215
|
-
|
216
|
-
def sauce_config=(config)
|
217
|
-
@sauce_config = config
|
218
|
-
end
|
219
|
-
|
220
|
-
def sauce_config
|
221
|
-
@sauce_config || {}
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
if defined?(ActiveSupport::TestCase)
|
227
|
-
module Sauce
|
228
|
-
class RailsTestCase < ::ActiveSupport::TestCase
|
229
|
-
include SeleniumForTestUnit
|
230
|
-
extend SeleniumForTestUnitClassMethods
|
231
|
-
|
232
|
-
# Placeholder so test/unit ignores test cases without any tests.
|
233
|
-
def default_test
|
234
|
-
end
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
begin
|
240
|
-
if Object.const_defined? "Test"
|
241
|
-
if Test.const_defined? "Unit"
|
242
|
-
require 'test/unit/testcase'
|
243
|
-
module Sauce
|
244
|
-
class TestCase < Test::Unit::TestCase
|
245
|
-
include SeleniumForTestUnit
|
246
|
-
extend SeleniumForTestUnitClassMethods
|
247
|
-
|
248
|
-
# Placeholder so test/unit ignores test cases without any tests.
|
249
|
-
def default_test
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
255
|
-
rescue LoadError
|
256
|
-
# User doesn't have Test::Unit installed
|
257
|
-
rescue => e
|
258
|
-
STDERR.puts "Exception caught: #{e.to_s}"
|
259
|
-
end
|
154
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'sauce/utilities'
|
2
|
+
require "sauce_whisk"
|
3
|
+
|
4
|
+
module Sauce
|
5
|
+
module SeleniumForTestUnit
|
6
|
+
attr_reader :browser
|
7
|
+
|
8
|
+
alias_method :page, :browser
|
9
|
+
alias_method :s, :browser
|
10
|
+
alias_method :selenium, :browser
|
11
|
+
|
12
|
+
def run(*args, &blk)
|
13
|
+
if self.respond_to? :name
|
14
|
+
my_name = self.name
|
15
|
+
else
|
16
|
+
my_name = self.__name__
|
17
|
+
end
|
18
|
+
unless my_name =~ /^default_test/
|
19
|
+
config = Sauce::Config.new
|
20
|
+
if config[:application_host]
|
21
|
+
unless ENV['TEST_ENV_NUMBER'].to_i > 1
|
22
|
+
Sauce::Connect.ensure_connected(:host => config[:application_host], :port => config[:application_port] || 80)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
unless defined?(@@server)
|
27
|
+
unless ENV['TEST_ENV_NUMBER'].to_i > 1
|
28
|
+
if config[:start_local_application] &&
|
29
|
+
Sauce::Utilities::RailsServer.is_rails_app?
|
30
|
+
@@server = Sauce::Utilities::RailsServer.new
|
31
|
+
@@server.start
|
32
|
+
at_exit do
|
33
|
+
@@server.stop
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
config[:browsers].each do |os, browser, version|
|
40
|
+
options = self.class.sauce_config
|
41
|
+
options.merge!({:os => os, :browser => browser,
|
42
|
+
:browser_version => version,
|
43
|
+
:job_name => my_name.to_s})
|
44
|
+
@browser = Sauce::Selenium2.new(options)
|
45
|
+
Sauce.driver_pool[Thread.current.object_id] = @browser
|
46
|
+
|
47
|
+
super(*args, &blk)
|
48
|
+
|
49
|
+
SauceWhisk::Jobs.change_status @browser.session_id, passed?
|
50
|
+
@browser.stop
|
51
|
+
Sauce.driver_pool.delete Thread.current.object_id
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
module Sauce
|
59
|
+
module SeleniumForTestUnitClassMethods
|
60
|
+
def selenium_flags=(options)
|
61
|
+
@selenium_flags = options
|
62
|
+
end
|
63
|
+
|
64
|
+
def selenium_flags
|
65
|
+
return @selenium_flags
|
66
|
+
end
|
67
|
+
|
68
|
+
def sauce_config=(config)
|
69
|
+
@sauce_config = config
|
70
|
+
end
|
71
|
+
|
72
|
+
def sauce_config
|
73
|
+
@sauce_config || {}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if defined?(ActiveSupport::TestCase)
|
79
|
+
module Sauce
|
80
|
+
class RailsTestCase < ::ActiveSupport::TestCase
|
81
|
+
include SeleniumForTestUnit
|
82
|
+
extend SeleniumForTestUnitClassMethods
|
83
|
+
|
84
|
+
# Placeholder so test/unit ignores test cases without any tests.
|
85
|
+
def default_test
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
begin
|
92
|
+
if Object.const_defined? "Test"
|
93
|
+
if Test.const_defined? "Unit"
|
94
|
+
require 'test/unit/testcase'
|
95
|
+
module Sauce
|
96
|
+
class TestCase < Test::Unit::TestCase
|
97
|
+
include SeleniumForTestUnit
|
98
|
+
extend SeleniumForTestUnitClassMethods
|
99
|
+
|
100
|
+
# Placeholder so test/unit ignores test cases without any tests.
|
101
|
+
def default_test
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
rescue LoadError
|
108
|
+
# User doesn't have Test::Unit installed
|
109
|
+
rescue => e
|
110
|
+
STDERR.puts "Exception caught: #{e.to_s}"
|
111
|
+
end
|
data/lib/sauce/utilities.rb
CHANGED
@@ -32,6 +32,14 @@ module Sauce
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
def self.page_deprecation_message
|
36
|
+
return <<-MESSAGE
|
37
|
+
[DEPRECATED] Using the #page method is deprecated for RSpec tests without Capybara. Please use the #s or #selenium method instead.
|
38
|
+
If you are using Capybara and are seeing this message, check the Capybara README for information on how to include the Capybara DSL in your tests.
|
39
|
+
MESSAGE
|
40
|
+
end
|
41
|
+
|
42
|
+
|
35
43
|
class Connect
|
36
44
|
def self.start(options={})
|
37
45
|
begin
|
data/lib/sauce/version.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "Sauce::Config", :sauce => true do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
4
|
it "should have rspec in its tool set", :sauce => true do
|
8
5
|
capabilities = Sauce.get_config.to_desired_capabilities
|
9
6
|
capabilities[:client_version].should include "Rspec"
|
@@ -13,4 +10,4 @@ describe "Sauce::Config", :sauce => true do
|
|
13
10
|
capabilities = Sauce.get_config.to_desired_capabilities
|
14
11
|
capabilities[:client_version].should_not include "Test::Unit"
|
15
12
|
end
|
16
|
-
end
|
13
|
+
end
|
@@ -12,35 +12,9 @@ Sauce.config do |c|
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "Specs in the Selenium Directory" do
|
15
|
-
|
16
|
-
before :all do
|
17
|
-
$EXECUTIONS = 0
|
18
|
-
end
|
19
|
-
|
20
|
-
after :all do
|
21
|
-
$EXECUTIONS.should be 2
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should get run on every defined browser" do
|
25
|
-
$EXECUTIONS += 1
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should be using Sauce Connect" do
|
29
|
-
Sauce::Utilities::Connect.instance_variable_get(:@tunnel).should_not be_nil
|
30
|
-
end
|
15
|
+
it_behaves_like "an integrated spec"
|
31
16
|
end
|
32
17
|
|
33
18
|
describe "Specs in the Selenium Directory with the sauce tag", :sauce => true do
|
34
|
-
|
35
|
-
before :all do
|
36
|
-
$EXECUTIONS = 0
|
37
|
-
end
|
38
|
-
|
39
|
-
after :all do
|
40
|
-
$EXECUTIONS.should be 2
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should get run on every defined browser" do
|
44
|
-
$EXECUTIONS += 1
|
45
|
-
end
|
19
|
+
it_behaves_like "an integrated spec"
|
46
20
|
end
|
@@ -1,3 +1,40 @@
|
|
1
1
|
require "rspec"
|
2
2
|
require "capybara/rspec"
|
3
|
-
require "sauce"
|
3
|
+
require "sauce"
|
4
|
+
|
5
|
+
def page_deprecation_warning
|
6
|
+
return <<-MESSAGE
|
7
|
+
[DEPRECATED] Using the #page method is deprecated for RSpec tests without Capybara. Please use the #s or #selenium method instead.
|
8
|
+
If you are using Capybara and are seeing this message, check the Capybara README for information on how to include the Capybara DSL in your tests.
|
9
|
+
MESSAGE
|
10
|
+
end
|
11
|
+
|
12
|
+
shared_examples_for "an integrated spec" do
|
13
|
+
|
14
|
+
before :all do
|
15
|
+
$TAGGED_EXECUTIONS = 0
|
16
|
+
end
|
17
|
+
|
18
|
+
after :all do
|
19
|
+
$TAGGED_EXECUTIONS.should eq 2
|
20
|
+
end
|
21
|
+
|
22
|
+
context "When calling the #page method" do
|
23
|
+
it "should get access to the Webdriver object" do
|
24
|
+
page.should be_a_kind_of Sauce::Selenium2
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should output a deprecation message" do
|
28
|
+
self.should_receive(:warn).with(page_deprecation_warning).and_call_original
|
29
|
+
page
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should be using Sauce Connect" do
|
34
|
+
Sauce::Utilities::Connect.instance_variable_get(:@tunnel).should_not be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should get run on every defined browser" do
|
38
|
+
$TAGGED_EXECUTIONS += 1
|
39
|
+
end
|
40
|
+
end
|
@@ -11,22 +11,7 @@ Sauce.config do |c|
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "Specs with the @sauce tag", :sauce => true do
|
14
|
-
|
15
|
-
before :all do
|
16
|
-
$TAGGED_EXECUTIONS = 0
|
17
|
-
end
|
18
|
-
|
19
|
-
after :all do
|
20
|
-
$TAGGED_EXECUTIONS.should eq 2
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should get run on every defined browser" do
|
24
|
-
$TAGGED_EXECUTIONS += 1
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should be using Sauce Connect" do
|
28
|
-
Sauce::Utilities::Connect.instance_variable_get(:@tunnel).should_not be_nil
|
29
|
-
end
|
14
|
+
it_behaves_like "an integrated spec"
|
30
15
|
end
|
31
16
|
|
32
17
|
describe "Specs without the @sauce tag" do
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Sauce::Config" do
|
4
|
+
describe "#browser" do
|
5
|
+
|
6
|
+
after :all do
|
7
|
+
ENV["TEST_ENV_NUMBER"] = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when @opts[:browser] is not nil" do
|
11
|
+
it "returns @opts[:browser]" do
|
12
|
+
Sauce.clear_config
|
13
|
+
|
14
|
+
Sauce.config do |c|
|
15
|
+
c[:browser] = "Opera"
|
16
|
+
end
|
17
|
+
|
18
|
+
Sauce::Config.new.browser.should eq "Opera"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "defaults version to blank for Chrome" do
|
22
|
+
Sauce.clear_config
|
23
|
+
|
24
|
+
Sauce.config do |c|
|
25
|
+
c[:browser] = "Chrome"
|
26
|
+
c[:os] = "Windows"
|
27
|
+
end
|
28
|
+
|
29
|
+
Sauce::Config.new.browser_version.should eq nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when @opts[:browser] is nil" do
|
34
|
+
context "and this is not parallel test" do
|
35
|
+
it "defaults to the first row of :browsers" do
|
36
|
+
Sauce.clear_config
|
37
|
+
|
38
|
+
ENV["TEST_ENV_NUMBER"] = nil
|
39
|
+
|
40
|
+
Sauce.config do |c|
|
41
|
+
c[:browsers] = [["Windows", "Opera", 10]]
|
42
|
+
end
|
43
|
+
|
44
|
+
Sauce::Config.new.browser.should eq "Opera"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "and this is *not* a parallel test" do
|
49
|
+
it "should return the value set for :browser" do
|
50
|
+
ENV["TEST_ENV_NUMBER"] = "2"
|
51
|
+
|
52
|
+
Sauce.clear_config
|
53
|
+
|
54
|
+
expect {
|
55
|
+
Sauce::Config.new.browser.should_raise
|
56
|
+
}.to raise_exception(StandardError, no_browser_message)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def no_browser_message
|
64
|
+
<<-MESSAGE
|
65
|
+
No browser has been configured.
|
66
|
+
|
67
|
+
It seems you're trying to run your tests in parallel, but haven't configured your specs/tests to use the Sauce integration.
|
68
|
+
|
69
|
+
To fix this, add :sauce => true to your specs or make your tests subclasses of Sauce::TestCase or Sauce::RailsTestCase.
|
70
|
+
|
71
|
+
For more details check the gem readme at https://github.com/DylanLacey/sauce_ruby/blob/master/README.markdown
|
72
|
+
MESSAGE
|
73
|
+
end
|
data/spec/sauce/cucumber_spec.rb
CHANGED
@@ -10,7 +10,7 @@ module Sauce::Capybara
|
|
10
10
|
include Sauce::Cucumber::SpecHelper
|
11
11
|
|
12
12
|
before :each do
|
13
|
-
Sauce::Utilities::Connect.stub
|
13
|
+
Sauce::Utilities::Connect.stub(:start) {}
|
14
14
|
end
|
15
15
|
|
16
16
|
describe '#use_sauce_driver' do
|
@@ -60,7 +60,7 @@ module Sauce::Capybara
|
|
60
60
|
context 'Around hook' do
|
61
61
|
let(:session_id) { 'deadbeef' }
|
62
62
|
let(:driver) do
|
63
|
-
driver =
|
63
|
+
driver = double('Sauce::Selenium2 Driver')
|
64
64
|
driver.stub_chain(:browser, :quit)
|
65
65
|
driver.stub_chain(:browser, :session_id).and_return(session_id)
|
66
66
|
driver
|
@@ -126,8 +126,6 @@ module Sauce::Capybara
|
|
126
126
|
end
|
127
127
|
|
128
128
|
before :each do
|
129
|
-
Sauce::Utilities::Connect.rspec_reset
|
130
|
-
|
131
129
|
Sauce.config do |c|
|
132
130
|
c[:start_tunnel] = true
|
133
131
|
end
|
@@ -135,7 +133,7 @@ module Sauce::Capybara
|
|
135
133
|
end
|
136
134
|
|
137
135
|
after :all do
|
138
|
-
Sauce::Utilities::Connect.stub
|
136
|
+
Sauce::Utilities::Connect.stub(:start) {}
|
139
137
|
end
|
140
138
|
|
141
139
|
it 'should have set up a tunnel' do
|
data/spec/sauce/jasmine_spec.rb
CHANGED
data/spec/sauce/selenium_spec.rb
CHANGED
@@ -36,7 +36,7 @@ describe Sauce::Selenium2 do
|
|
36
36
|
describe '#session_id' do
|
37
37
|
it 'should query the driver for the session_id' do
|
38
38
|
expected = 101
|
39
|
-
bridge =
|
39
|
+
bridge = double('bridge')
|
40
40
|
bridge.should_receive(:session_id).and_return(expected)
|
41
41
|
@client.driver.should_receive(:bridge).and_return(bridge)
|
42
42
|
@client.session_id.should == expected
|
@@ -46,7 +46,7 @@ describe Sauce::Selenium2 do
|
|
46
46
|
describe '#method_missing' do
|
47
47
|
it 'should pass #navigate#to onto the driver' do
|
48
48
|
url = 'http://example.com'
|
49
|
-
navigator =
|
49
|
+
navigator = double('navigator')
|
50
50
|
navigator.should_receive(:to).with(url).and_return(true)
|
51
51
|
@client.driver.should_receive(:navigate).and_return(navigator)
|
52
52
|
|
@@ -3,10 +3,6 @@ require "spec_helper"
|
|
3
3
|
describe Sauce::Utilities::Rake do
|
4
4
|
|
5
5
|
describe "#create_sauce_helper" do
|
6
|
-
after :all do
|
7
|
-
Object.rspec_reset
|
8
|
-
end
|
9
|
-
|
10
6
|
context "with Capybara" do
|
11
7
|
before :all do
|
12
8
|
Object.stub(:const_defined?).with("Capybara").and_return true
|
@@ -46,4 +42,4 @@ Sauce.config do |config|
|
|
46
42
|
end
|
47
43
|
ENDFILE
|
48
44
|
end
|
49
|
-
end
|
45
|
+
end
|
@@ -29,11 +29,10 @@ describe "Sauce::Utilities::Connect" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should connect the new tunnel" do
|
32
|
-
Sauce::Connect.rspec_reset
|
33
32
|
@mock_tunnel.should_receive(:connect).with().and_return(true)
|
34
33
|
@mock_tunnel.should_receive(:wait_until_ready).and_return(true)
|
35
34
|
|
36
|
-
Sauce::Connect.stub
|
35
|
+
Sauce::Connect.stub(:new).with(anything).and_return @mock_tunnel
|
37
36
|
|
38
37
|
Sauce::Utilities::Connect.start
|
39
38
|
end
|
@@ -84,4 +83,4 @@ describe "Sauce::Utilities::Connect" do
|
|
84
83
|
Sauce::Utilities::Connect.close
|
85
84
|
end
|
86
85
|
end
|
87
|
-
end
|
86
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Lacey
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-
|
16
|
+
date: 2013-07-10 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: capybara
|
@@ -35,14 +35,28 @@ dependencies:
|
|
35
35
|
requirements:
|
36
36
|
- - ~>
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
38
|
+
version: 2.14.0
|
39
39
|
type: :development
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 2.14.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: simplecov
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
type: :development
|
54
|
+
prerelease: false
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
46
60
|
- !ruby/object:Gem::Dependency
|
47
61
|
name: net-http-persistent
|
48
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,14 +189,14 @@ dependencies:
|
|
175
189
|
requirements:
|
176
190
|
- - '='
|
177
191
|
- !ruby/object:Gem::Version
|
178
|
-
version: 0.
|
192
|
+
version: 0.15.0
|
179
193
|
type: :runtime
|
180
194
|
prerelease: false
|
181
195
|
version_requirements: !ruby/object:Gem::Requirement
|
182
196
|
requirements:
|
183
197
|
- - '='
|
184
198
|
- !ruby/object:Gem::Version
|
185
|
-
version: 0.
|
199
|
+
version: 0.15.0
|
186
200
|
- !ruby/object:Gem::Dependency
|
187
201
|
name: sauce_whisk
|
188
202
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,13 +229,14 @@ files:
|
|
215
229
|
- lib/sauce/config.rb
|
216
230
|
- lib/sauce/driver_pool.rb
|
217
231
|
- lib/sauce/heroku.rb
|
218
|
-
- lib/sauce/integrations.rb
|
219
232
|
- lib/sauce/job.rb
|
220
233
|
- lib/sauce/parallel/test_broker.rb
|
221
234
|
- lib/sauce/parallel/test_group.rb
|
222
235
|
- lib/sauce/parallel.rb
|
223
236
|
- lib/sauce/raketasks.rb
|
237
|
+
- lib/sauce/rspec.rb
|
224
238
|
- lib/sauce/selenium.rb
|
239
|
+
- lib/sauce/test_unit.rb
|
225
240
|
- lib/sauce/utilities/rake.rb
|
226
241
|
- lib/sauce/utilities.rb
|
227
242
|
- lib/sauce/version.rb
|
@@ -240,6 +255,7 @@ files:
|
|
240
255
|
- spec/integration/testunit/test/integration_test.rb
|
241
256
|
- spec/parallel_tests/sauce_rspec_runner_spec.rb
|
242
257
|
- spec/sauce/capybara_spec.rb
|
258
|
+
- spec/sauce/config/browser_spec.rb
|
243
259
|
- spec/sauce/config/config_spec.rb
|
244
260
|
- spec/sauce/config/default_browsers_spec.rb
|
245
261
|
- spec/sauce/config/environment_config_spec.rb
|
@@ -291,6 +307,7 @@ test_files:
|
|
291
307
|
- spec/integration/testunit/test/integration_test.rb
|
292
308
|
- spec/parallel_tests/sauce_rspec_runner_spec.rb
|
293
309
|
- spec/sauce/capybara_spec.rb
|
310
|
+
- spec/sauce/config/browser_spec.rb
|
294
311
|
- spec/sauce/config/config_spec.rb
|
295
312
|
- spec/sauce/config/default_browsers_spec.rb
|
296
313
|
- spec/sauce/config/environment_config_spec.rb
|
@@ -304,4 +321,3 @@ test_files:
|
|
304
321
|
- spec/sauce/utilities/utilities_spec.rb
|
305
322
|
- spec/sauce_helper.rb
|
306
323
|
- spec/spec_helper.rb
|
307
|
-
has_rdoc:
|