sauce 2.3.2 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/sauce +2 -2
- data/lib/sauce/capybara.rb +16 -5
- data/lib/sauce/config.rb +1 -1
- data/lib/sauce/parallel.rb +16 -0
- data/spec/sauce/capybara_spec.rb +42 -0
- data/spec/sauce/config_spec.rb +9 -7
- data/spec/spec_helper.rb +8 -0
- metadata +7 -22
data/bin/sauce
CHANGED
@@ -46,7 +46,7 @@ class ConfigureCommand < CmdParse::Command
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
configure = ConfigureCommand.new('configure', false)
|
49
|
-
configure.short_desc = "Configure Sauce
|
49
|
+
configure.short_desc = "Configure Sauce Labs credentials"
|
50
50
|
configure.set_execution_block do |args|
|
51
51
|
if args.length < 2
|
52
52
|
puts configure.usage
|
@@ -65,7 +65,7 @@ cmd.add_command(configure)
|
|
65
65
|
|
66
66
|
#create
|
67
67
|
create = CmdParse::Command.new('create', false)
|
68
|
-
create.short_desc = "Create a new Sauce
|
68
|
+
create.short_desc = "Create a new Sauce Labs account"
|
69
69
|
create.set_execution_block do |args|
|
70
70
|
puts "Let's create a new account!"
|
71
71
|
username = ask("Username: ")
|
data/lib/sauce/capybara.rb
CHANGED
@@ -60,14 +60,25 @@ module Sauce
|
|
60
60
|
alias :base_within_frame :within_frame
|
61
61
|
alias :base_within_window :within_window
|
62
62
|
alias :base_find_window :find_window
|
63
|
-
alias :base_body :body
|
64
|
-
alias :base_source :source
|
65
63
|
alias :base_execute_script :execute_script
|
66
64
|
alias :base_evaluate_script :evaluate_script
|
67
65
|
|
68
|
-
[:find, :visit, :current_url, :reset!,
|
69
|
-
|
70
|
-
|
66
|
+
@methods_to_retry = [ :find, :visit, :current_url, :reset!,
|
67
|
+
:within_frame, :within_window, :find_window, :source,
|
68
|
+
:execute_script, :evaluate_script
|
69
|
+
]
|
70
|
+
|
71
|
+
if Gem::Version.new(::Capybara::VERSION) < Gem::Version.new(2)
|
72
|
+
alias :base_body :body
|
73
|
+
alias :base_source :source
|
74
|
+
|
75
|
+
@methods_to_retry + [:body, :source]
|
76
|
+
else
|
77
|
+
alias :base_html :html
|
78
|
+
@methods_to_retry + [:html]
|
79
|
+
end
|
80
|
+
|
81
|
+
@methods_to_retry.each do |method|
|
71
82
|
define_method(method) do |*args, &block|
|
72
83
|
handle_retry(method, *args, &block)
|
73
84
|
end
|
data/lib/sauce/config.rb
CHANGED
@@ -34,7 +34,7 @@ module Sauce
|
|
34
34
|
ENVIRONMENT_VARIABLES = %w{SAUCE_HOST SAUCE_PORT SAUCE_BROWSER_URL SAUCE_USERNAME
|
35
35
|
SAUCE_ACCESS_KEY SAUCE_OS SAUCE_BROWSER SAUCE_BROWSER_VERSION SAUCE_JOB_NAME
|
36
36
|
SAUCE_FIREFOX_PROFILE_URL SAUCE_USER_EXTENSIONS_URL
|
37
|
-
SAUCE_ONDEMAND_BROWSERS
|
37
|
+
SAUCE_ONDEMAND_BROWSERS SAUCE_USER_NAME SAUCE_API_KEY}
|
38
38
|
|
39
39
|
PLATFORMS = {
|
40
40
|
"Windows 2003" => "WINDOWS",
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'parallel_tests'
|
2
|
+
|
3
|
+
def start_tunnel_for_parallel_tests(c)
|
4
|
+
c[:start_tunnel] = ParallelTests.first_process?
|
5
|
+
if ParallelTests.first_process?
|
6
|
+
at_exit do
|
7
|
+
if ParallelTests.first_process?
|
8
|
+
ParallelTests.wait_for_other_processes_to_finish
|
9
|
+
end
|
10
|
+
end
|
11
|
+
else
|
12
|
+
while not File.exist? "sauce_connect.ready"
|
13
|
+
sleep 0.5
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/sauce/capybara_spec.rb
CHANGED
@@ -42,6 +42,48 @@ describe Sauce::Capybara do
|
|
42
42
|
let(:app) { double('Mock App for Driver') }
|
43
43
|
let(:driver) { Sauce::Capybara::Driver.new(app) }
|
44
44
|
|
45
|
+
describe "#body" do
|
46
|
+
context "With Capybara 1.x", :capybara_version => 1 do
|
47
|
+
it "should not exist in version 2" do
|
48
|
+
driver.should respond_to :base_body
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "With Capybara 2.x", :capybara_version => 2 do
|
53
|
+
it "should not exist" do
|
54
|
+
driver.should_not respond_to :base_body
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#source" do
|
60
|
+
context "With Capybara 1", :capybara_version => 1 do
|
61
|
+
it "should exist" do
|
62
|
+
driver.should respond_to :base_source
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "with Capybara 2.x", :capybara_version => 2 do
|
67
|
+
it "should not exist" do
|
68
|
+
driver.should_not respond_to :base_source
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#html" do
|
74
|
+
context "With Capybara 1.x", :capybara_version => 1 do
|
75
|
+
it "should not exist" do
|
76
|
+
driver.should_not respond_to :base_html
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context "With Capybara 2.x", :capybara_version => 2 do
|
81
|
+
it "should exist" do
|
82
|
+
driver.should respond_to :base_html
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
45
87
|
describe '#finish' do
|
46
88
|
let(:browser) { double('Sauce::Selenium2 mock') }
|
47
89
|
|
data/spec/sauce/config_spec.rb
CHANGED
@@ -104,12 +104,12 @@ describe Sauce::Config do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'should create a browser string from the environment set by the jenkins plugin' do
|
107
|
-
ENV['
|
108
|
-
ENV['
|
107
|
+
ENV['SAUCE_USERNAME'] = 'test_user'
|
108
|
+
ENV['SAUCE_ACCESS_KEY'] = 'test_access'
|
109
109
|
ENV['SAUCE_OS'] = 'Linux'
|
110
110
|
ENV['SAUCE_BROWSER'] = 'firefox'
|
111
111
|
ENV['SAUCE_BROWSER_VERSION'] = '3.'
|
112
|
-
ENV['
|
112
|
+
ENV['SAUCE_JOB_NAME'] = 'Named Ruby Job'
|
113
113
|
|
114
114
|
config = Sauce::Config.new
|
115
115
|
browser_data = JSON.parse(config.to_browser_string)
|
@@ -241,6 +241,12 @@ describe Sauce::Config do
|
|
241
241
|
end
|
242
242
|
|
243
243
|
describe Sauce do
|
244
|
+
|
245
|
+
# Ensure any doubles are removed to stop other tests choking
|
246
|
+
after :all do
|
247
|
+
Sauce.clear_config
|
248
|
+
end
|
249
|
+
|
244
250
|
describe '#get_config' do
|
245
251
|
context 'when #config has never been called' do
|
246
252
|
# See: <https://github.com/sauce-labs/sauce_ruby/issues/59>
|
@@ -250,10 +256,6 @@ describe Sauce do
|
|
250
256
|
Sauce.instance_variable_set(:@cfg, nil)
|
251
257
|
end
|
252
258
|
|
253
|
-
after :all do
|
254
|
-
|
255
|
-
end
|
256
|
-
|
257
259
|
it 'should return a newly created Sauce::Config' do
|
258
260
|
dummy_config = double('Sauce::Config')
|
259
261
|
Sauce::Config.should_receive(:new).and_return(dummy_config)
|
data/spec/spec_helper.rb
CHANGED
@@ -5,4 +5,12 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
|
5
5
|
end
|
6
6
|
|
7
7
|
require 'sauce'
|
8
|
+
require 'capybara'
|
8
9
|
|
10
|
+
RSpec.configure do |c|
|
11
|
+
if Gem::Version.new(Capybara::VERSION) < Gem::Version.new(2)
|
12
|
+
c.filter_run_excluding :capybara_version => 2
|
13
|
+
else
|
14
|
+
c.filter_run_excluding :capybara_version => 1
|
15
|
+
end
|
16
|
+
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: 2.3.
|
4
|
+
version: 2.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2013-
|
17
|
+
date: 2013-03-20 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: net-http-persistent
|
@@ -32,22 +32,6 @@ dependencies:
|
|
32
32
|
- - ! '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: capybara
|
37
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
|
-
requirements:
|
40
|
-
- - ~>
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 1.1.0
|
43
|
-
type: :runtime
|
44
|
-
prerelease: false
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
|
-
requirements:
|
48
|
-
- - ~>
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 1.1.0
|
51
35
|
- !ruby/object:Gem::Dependency
|
52
36
|
name: rest-client
|
53
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,8 +160,8 @@ dependencies:
|
|
176
160
|
- - ! '>='
|
177
161
|
- !ruby/object:Gem::Version
|
178
162
|
version: 1.5.0
|
179
|
-
description: A Ruby helper for running tests in Sauce
|
180
|
-
|
163
|
+
description: A Ruby helper for running tests in Sauce Labs' browser testing cloud
|
164
|
+
service
|
181
165
|
email: help@saucelabs.com
|
182
166
|
executables:
|
183
167
|
- sauce
|
@@ -191,6 +175,7 @@ files:
|
|
191
175
|
- lib/sauce/heroku.rb
|
192
176
|
- lib/sauce/integrations.rb
|
193
177
|
- lib/sauce/job.rb
|
178
|
+
- lib/sauce/parallel.rb
|
194
179
|
- lib/sauce/raketasks.rb
|
195
180
|
- lib/sauce/selenium.rb
|
196
181
|
- lib/sauce/utilities.rb
|
@@ -225,10 +210,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
210
|
version: '0'
|
226
211
|
requirements: []
|
227
212
|
rubyforge_project:
|
228
|
-
rubygems_version: 1.8.
|
213
|
+
rubygems_version: 1.8.25
|
229
214
|
signing_key:
|
230
215
|
specification_version: 3
|
231
|
-
summary: A Ruby helper for running tests in Sauce
|
216
|
+
summary: A Ruby helper for running tests in Sauce Labs
|
232
217
|
test_files:
|
233
218
|
- spec/cucumber_helper.rb
|
234
219
|
- spec/integration/connect_integration_spec.rb
|