sauce 3.5.6 → 3.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/parallel_tests/cli_patch.rb +1 -0
- data/lib/parallel_tests/saucecucumber/runner.rb +4 -0
- data/lib/parallel_tests/saucerspec/runner.rb +4 -0
- data/lib/sauce.rb +1 -0
- data/lib/sauce/capybara.rb +4 -0
- data/lib/sauce/config.rb +15 -2
- data/lib/sauce/logging.rb +57 -0
- data/lib/sauce/parallel/test_broker.rb +1 -0
- data/lib/sauce/parallel/test_group.rb +3 -1
- data/lib/sauce/rspec/rspec.rb +16 -3
- data/lib/sauce/rspec/rspec_one_support.rb +5 -2
- data/lib/sauce/selenium.rb +17 -5
- data/lib/sauce/utilities.rb +1 -1
- data/lib/sauce/utilities/connect.rb +22 -2
- data/lib/sauce/utilities/rails_server.rb +7 -2
- data/lib/sauce/version.rb +1 -1
- data/spec/integration/connect/spec/start_tunnel_spec.rb +1 -1
- data/spec/integration/connect/spec/with_capybara_spec.rb +4 -4
- data/spec/integration/rspec/spec/tagging/selenium_tagging_spec.rb +1 -1
- data/spec/sauce/file_detector_spec.rb +1 -0
- data/spec/sauce/selenium_spec.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf1ac30663f0230515af484aa14d2de9a51e0dba
|
|
4
|
+
data.tar.gz: ec92ecb4788c3e81988536e62b6bd3f3048fbc20
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e138b92a567eb111d1e72ed556b1329c190a796f349f5a685be7833031b8ed31d789f6d504008b2474d48f65981f39859c07c338038431839c2b9ed4f57a149
|
|
7
|
+
data.tar.gz: 4cb17bcd1da62503ef940270b0b13820cfed7f039d573fea72878e6af2b21000ea158db970cc68b3fea34b60799d220f159df982ce3a8dd6b2b1ccf6d52caf82
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "parallel_tests/cucumber/runner"
|
|
2
|
+
require "sauce/logging"
|
|
2
3
|
|
|
3
4
|
module ParallelTests
|
|
4
5
|
module Saucecucumber
|
|
@@ -16,6 +17,9 @@ module ParallelTests
|
|
|
16
17
|
cucumber_opts(options[:test_options]),
|
|
17
18
|
*sanitized_test_files
|
|
18
19
|
].compact.join(" ")
|
|
20
|
+
Sauce.logger.debug "Starting parallel process #{process_number} of #{num_processes}"
|
|
21
|
+
Sauce.logger.debug " #{cmd}"
|
|
22
|
+
Sauce.logger.debug " #{our_options}"
|
|
19
23
|
execute_command(cmd, process_number, num_processes, options)
|
|
20
24
|
end
|
|
21
25
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "yaml"
|
|
2
2
|
require "parallel_tests/rspec/runner"
|
|
3
|
+
require "sauce/logging"
|
|
3
4
|
|
|
4
5
|
module ParallelTests
|
|
5
6
|
module Saucerspec
|
|
@@ -13,6 +14,9 @@ module ParallelTests
|
|
|
13
14
|
env = Sauce::TestBroker.next_environment(test_files)
|
|
14
15
|
env << " #{rspec_1_color}" if version == 1
|
|
15
16
|
our_options.merge!(:env => env)
|
|
17
|
+
Sauce.logger.debug "Starting parallel process #{process_number} of #{num_processes}"
|
|
18
|
+
Sauce.logger.debug " #{cmd}"
|
|
19
|
+
Sauce.logger.debug " #{our_options}"
|
|
16
20
|
execute_command(cmd, process_number, num_processes, our_options)
|
|
17
21
|
end
|
|
18
22
|
|
data/lib/sauce.rb
CHANGED
data/lib/sauce/capybara.rb
CHANGED
|
@@ -2,6 +2,7 @@ require 'capybara'
|
|
|
2
2
|
require 'sauce/config'
|
|
3
3
|
require 'sauce/selenium'
|
|
4
4
|
require 'sauce/version'
|
|
5
|
+
require 'sauce/logging'
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
$sauce_tunnel = nil
|
|
@@ -85,6 +86,7 @@ module Sauce
|
|
|
85
86
|
# Try to get a driver from the driver pool
|
|
86
87
|
@browser = rspec_browser
|
|
87
88
|
unless @browser
|
|
89
|
+
Sauce.logger.debug "Capybara creating new Selenium driver."
|
|
88
90
|
@browser = Sauce::Selenium2.new
|
|
89
91
|
at_exit do
|
|
90
92
|
finish!
|
|
@@ -97,6 +99,7 @@ module Sauce
|
|
|
97
99
|
# Returns the rspec created browser if it exists
|
|
98
100
|
def rspec_browser
|
|
99
101
|
if browser = Sauce.driver_pool[Thread.current.object_id]
|
|
102
|
+
Sauce.logger.debug "Using browser from driver_pool (browser.session_id)."
|
|
100
103
|
@using_rspec_browser = true
|
|
101
104
|
else
|
|
102
105
|
@using_rspec_browser = false
|
|
@@ -115,6 +118,7 @@ module Sauce
|
|
|
115
118
|
end
|
|
116
119
|
|
|
117
120
|
def finish!
|
|
121
|
+
Sauce.logger.debug "Capybara integration called #finish!"
|
|
118
122
|
@browser.quit if existing_browser?
|
|
119
123
|
@browser = nil
|
|
120
124
|
|
data/lib/sauce/config.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
require 'yaml'
|
|
3
3
|
require 'uri'
|
|
4
|
+
require 'sauce/logging'
|
|
4
5
|
|
|
5
6
|
module Sauce
|
|
6
7
|
def self.config
|
|
@@ -67,11 +68,15 @@ module Sauce
|
|
|
67
68
|
sauce-advisor single-window user-extensions-url firefox-profile-url
|
|
68
69
|
max-duration idle-timeout build custom-data tunnel-identifier
|
|
69
70
|
selenium-version command-timeout prerun prerun-args screen-resolution
|
|
70
|
-
disable-popup-handler avoid-proxy public name iedriver-version parent-tunnel
|
|
71
|
+
disable-popup-handler avoid-proxy public name iedriver-version parent-tunnel
|
|
72
|
+
time-zone device-orientation record-logs webdriver-remote-quiet-exceptions
|
|
73
|
+
iedriver-version
|
|
74
|
+
}
|
|
71
75
|
|
|
72
76
|
def self.get_application_port
|
|
73
77
|
port_index = ENV["TEST_ENV_NUMBER"].to_i
|
|
74
|
-
|
|
78
|
+
port_to_use = POTENTIAL_PORTS[port_index]
|
|
79
|
+
return port_to_use
|
|
75
80
|
end
|
|
76
81
|
|
|
77
82
|
def self.called_from_integrations?
|
|
@@ -79,6 +84,7 @@ module Sauce
|
|
|
79
84
|
end
|
|
80
85
|
|
|
81
86
|
def self.called_from_integrations
|
|
87
|
+
Sauce.logger.debug "Sauce config accessed from an integration"
|
|
82
88
|
@called_from_integrations = true
|
|
83
89
|
end
|
|
84
90
|
|
|
@@ -150,6 +156,7 @@ module Sauce
|
|
|
150
156
|
end
|
|
151
157
|
|
|
152
158
|
def whitelist capability
|
|
159
|
+
Sauce.logger.info "Whitelisting #{capability}"
|
|
153
160
|
cap = capability.to_s
|
|
154
161
|
wl = whitelisted_capabilities || Set.new
|
|
155
162
|
@whitelisted_capabilities = wl.add cap
|
|
@@ -291,7 +298,11 @@ module Sauce
|
|
|
291
298
|
end
|
|
292
299
|
|
|
293
300
|
def run_post_job_hooks(job_id, platform, job_name, job_success)
|
|
301
|
+
Sauce.logger.debug "Running post job hook for #{job_id}"
|
|
302
|
+
Sauce.logger.debug " - Job name #{job_name}"
|
|
303
|
+
Sauce.logger.debug " - Successful? #{job_success}"
|
|
294
304
|
@opts[:after_job_hooks].each do |key, hook|
|
|
305
|
+
Sauce.logger.debug "Running #{hook}"
|
|
295
306
|
hook.call job_id, platform, job_name, job_success
|
|
296
307
|
end
|
|
297
308
|
end
|
|
@@ -330,6 +341,7 @@ module Sauce
|
|
|
330
341
|
def load_options_from_heroku
|
|
331
342
|
@@heroku_environment ||= begin
|
|
332
343
|
if File.exists?(File.expand_path('~/.heroku'))
|
|
344
|
+
Sauce.logger.debug "Heroku config found."
|
|
333
345
|
heroku_app = ENV['SAUCE_HEROKU_APP']
|
|
334
346
|
cmd = "heroku config #{heroku_app ? "--app #{heroku_app}": ''}"
|
|
335
347
|
cmd += "--shell 2>/dev/null"
|
|
@@ -363,6 +375,7 @@ module Sauce
|
|
|
363
375
|
|
|
364
376
|
paths.each do |path|
|
|
365
377
|
if File.exist? path
|
|
378
|
+
Sauce.debug.info "Loading Sauce config from yaml file at #{path}"
|
|
366
379
|
conf = YAML.load_file(path)
|
|
367
380
|
return conf.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
|
368
381
|
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require "logger"
|
|
2
|
+
|
|
3
|
+
module Sauce
|
|
4
|
+
def self.logger=(logger)
|
|
5
|
+
@logger = logger
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# Returns the set logger or, if none is set, a default logger
|
|
9
|
+
def self.logger
|
|
10
|
+
@logger ||= default_logger
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
# Creates a default logger when the user hasn't set one.
|
|
16
|
+
# Default logger with be STDOUT _unless_ the `SAUCE_LOGFILE` environment var
|
|
17
|
+
# has been set, in which case that file will be appended to, until it is
|
|
18
|
+
# 10240 bytes, when it will be rotated. This will happen 10 times.
|
|
19
|
+
#
|
|
20
|
+
# The default logging level is WARN, but can be set with the
|
|
21
|
+
# environment var SAUCE_LOGLEVEL
|
|
22
|
+
def self.default_logger
|
|
23
|
+
log = ::Logger.new(*default_logger_arguments)
|
|
24
|
+
log.level = default_logging_level
|
|
25
|
+
return log
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.default_logger_arguments
|
|
29
|
+
logfile = ENV["SAUCE_LOGFILE"]
|
|
30
|
+
if logfile
|
|
31
|
+
|
|
32
|
+
unless ENV["TEST_ENV_NUMBER"].nil?
|
|
33
|
+
logfile = "#{logfile}#{ENV["TEST_ENV_NUMBER"]}"
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
log = File.open logfile, File::WRONLY | File::APPEND | File::CREAT
|
|
37
|
+
return [log, 10, 10240]
|
|
38
|
+
else
|
|
39
|
+
return [STDOUT]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.default_logging_level
|
|
44
|
+
case ENV.fetch("SAUCE_LOGLEVEL", "").downcase
|
|
45
|
+
when 'error'
|
|
46
|
+
Logger::ERROR
|
|
47
|
+
when 'warn'
|
|
48
|
+
Logger::WARN
|
|
49
|
+
when 'info'
|
|
50
|
+
Logger::INFO
|
|
51
|
+
when 'debug'
|
|
52
|
+
Logger::DEBUG
|
|
53
|
+
else
|
|
54
|
+
Logger::WARN
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "sauce/logging"
|
|
2
|
+
|
|
1
3
|
module Sauce
|
|
2
4
|
class TestGroup
|
|
3
5
|
def initialize(platforms)
|
|
@@ -16,7 +18,7 @@ module Sauce
|
|
|
16
18
|
}
|
|
17
19
|
caps.merge!({:caps => platform[3]}) if platform[3]
|
|
18
20
|
caps
|
|
19
|
-
rescue NoMethodError
|
|
21
|
+
rescue NoMethodError
|
|
20
22
|
puts "I don't have any config"
|
|
21
23
|
end
|
|
22
24
|
end
|
data/lib/sauce/rspec/rspec.rb
CHANGED
|
@@ -34,12 +34,15 @@ begin
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def self.start_tools_for_sauce_tag
|
|
37
|
+
Sauce.logger.debug "Starting Tooling for 'sauce' tagged tests"
|
|
37
38
|
config = Sauce::Config.new
|
|
38
39
|
if config[:start_tunnel]
|
|
40
|
+
Sauce.logger.debug " - Sauce Connect"
|
|
39
41
|
Sauce::Utilities::Connect.start_from_config(config)
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
unless self.server
|
|
45
|
+
Sauce.logger.debug " - Rails Server"
|
|
43
46
|
self.server= Sauce::Utilities::RailsServer.start_if_required(config)
|
|
44
47
|
end
|
|
45
48
|
end
|
|
@@ -53,12 +56,18 @@ begin
|
|
|
53
56
|
running_selenium_specs = files_to_run.any? {|file| file =~ /spec\/selenium\//}
|
|
54
57
|
need_tunnel = running_selenium_specs && config[:application_host]
|
|
55
58
|
|
|
59
|
+
if running_selenium_specs
|
|
60
|
+
Sauce.logger.debug "Starting Tooling for Selenium directory tests"
|
|
61
|
+
end
|
|
62
|
+
|
|
56
63
|
if need_tunnel && config[:start_tunnel]
|
|
64
|
+
Sauce.logger.debug " - Sauce Connect"
|
|
57
65
|
Sauce::Utilities::Connect.start_from_config(config)
|
|
58
66
|
end
|
|
59
67
|
|
|
60
68
|
if running_selenium_specs
|
|
61
69
|
unless self.server
|
|
70
|
+
Sauce.logger.debug " - Rails Server"
|
|
62
71
|
self.server= Sauce::Utilities::RailsServer.start_if_required(config)
|
|
63
72
|
end
|
|
64
73
|
end
|
|
@@ -118,6 +127,7 @@ begin
|
|
|
118
127
|
end
|
|
119
128
|
|
|
120
129
|
def self.included(othermod)
|
|
130
|
+
Sauce.logger.debug "Sauce RSpec module was included by #{othermod.name}"
|
|
121
131
|
othermod.around do |the_test|
|
|
122
132
|
config = Sauce::Config.new
|
|
123
133
|
description = the_test.metadata[:full_description]
|
|
@@ -125,6 +135,7 @@ begin
|
|
|
125
135
|
exceptions = {}
|
|
126
136
|
test_each config.caps_for_location(file), description do |selenium, caps|
|
|
127
137
|
|
|
138
|
+
Sauce.logger.debug "Running RSpec test for #{file} with #{caps}."
|
|
128
139
|
example = SeleniumExampleGroup.current_example.call(self)
|
|
129
140
|
example.instance_variable_set(:@exception, nil)
|
|
130
141
|
|
|
@@ -133,6 +144,7 @@ begin
|
|
|
133
144
|
example.metadata[:sauce_public_link] = SauceWhisk.public_link(@selenium.session_id)
|
|
134
145
|
|
|
135
146
|
begin
|
|
147
|
+
Sauce.logger.debug "About to initiate test #{description}"
|
|
136
148
|
the_test.run
|
|
137
149
|
success = example.exception.nil?
|
|
138
150
|
ensure
|
|
@@ -147,8 +159,8 @@ begin
|
|
|
147
159
|
platform = {:os => os, :browser => browser, :version => version}
|
|
148
160
|
config.run_post_job_hooks(@selenium.session_id, platform, description, success)
|
|
149
161
|
rescue Exception => e
|
|
150
|
-
|
|
151
|
-
|
|
162
|
+
Sauce.logger.error "Error running post job hooks"
|
|
163
|
+
Sauce.logger.error e
|
|
152
164
|
end
|
|
153
165
|
Sauce.driver_pool.delete Thread.current.object_id
|
|
154
166
|
end
|
|
@@ -179,8 +191,9 @@ begin
|
|
|
179
191
|
end
|
|
180
192
|
end
|
|
181
193
|
rescue LoadError, TypeError
|
|
194
|
+
Sauce.logger.debug "Failed to require #{__FILE__} - Likely RSpec 2+ isn't present."
|
|
182
195
|
# User doesn't have RSpec 2.x installed
|
|
183
196
|
rescue => e
|
|
184
|
-
|
|
197
|
+
Sauce.logger.debug "Exception caught when including #{__FILE__}: #{e.to_s}"
|
|
185
198
|
exit 1
|
|
186
199
|
end
|
|
@@ -3,6 +3,9 @@ require "sauce_whisk"
|
|
|
3
3
|
|
|
4
4
|
begin
|
|
5
5
|
require 'spec'
|
|
6
|
+
# any gem could export a require as 'spec' so we must explicitly check
|
|
7
|
+
# to see if the expected rspec 1 class has loaded.
|
|
8
|
+
raise LoadError unless defined?(Spec::Example::ExampleGroup)
|
|
6
9
|
module Sauce
|
|
7
10
|
module RSpec
|
|
8
11
|
class SeleniumExampleGroup < Spec::Example::ExampleGroup
|
|
@@ -41,7 +44,7 @@ begin
|
|
|
41
44
|
@selenium = Sauce::Selenium2.new({:os => os, :browser => browser,
|
|
42
45
|
:browser_version => version,
|
|
43
46
|
:job_name => description})
|
|
44
|
-
|
|
47
|
+
|
|
45
48
|
begin
|
|
46
49
|
success = super(*args)
|
|
47
50
|
SauceWhisk::Jobs.change_status @selenium.session_id, success
|
|
@@ -63,4 +66,4 @@ rescue LoadError
|
|
|
63
66
|
rescue => e
|
|
64
67
|
STDERR.puts "Exception occured: #{e.to_s}"
|
|
65
68
|
exit 1
|
|
66
|
-
end
|
|
69
|
+
end
|
data/lib/sauce/selenium.rb
CHANGED
|
@@ -28,12 +28,18 @@ module Selenium
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
module Sauce
|
|
32
|
+
class << self
|
|
33
|
+
attr_accessor :webdriver_method
|
|
34
|
+
end
|
|
35
|
+
@webdriver_method = lambda { |*args| ::Selenium::WebDriver.for *args }
|
|
36
|
+
end
|
|
31
37
|
|
|
32
38
|
module Sauce
|
|
33
39
|
class Selenium2
|
|
34
40
|
extend Forwardable
|
|
35
41
|
|
|
36
|
-
attr_reader :config, :driver
|
|
42
|
+
attr_reader :config, :driver, :watir, :raw_driver
|
|
37
43
|
|
|
38
44
|
def_delegator :@driver, :execute_script
|
|
39
45
|
|
|
@@ -50,17 +56,21 @@ module Sauce
|
|
|
50
56
|
http_client = ::Selenium::WebDriver::Remote::Http::Persistent.new
|
|
51
57
|
http_client.timeout = 300 # Browser launch can take a while
|
|
52
58
|
|
|
53
|
-
@driver =
|
|
59
|
+
@driver = Sauce.webdriver_method.call(:remote,
|
|
54
60
|
:url => "http://#{@config.username}:#{@config.access_key}@#{@config.host}:#{@config.port}/wd/hub",
|
|
55
61
|
:desired_capabilities => @config.to_desired_capabilities,
|
|
56
62
|
:http_client => http_client)
|
|
57
63
|
http_client.timeout = 90 # Once the browser is up, commands should time out reasonably
|
|
58
64
|
|
|
59
|
-
@
|
|
65
|
+
@watir = defined?(Watir::Browser) && @driver.is_a?(Watir::Browser)
|
|
66
|
+
@raw_driver = watir ? @driver.driver : @driver
|
|
67
|
+
|
|
68
|
+
raw_driver.file_detector = lambda do |args|
|
|
60
69
|
file_path = args.first.to_s
|
|
61
70
|
File.exist?(file_path) ? file_path : false
|
|
62
71
|
end
|
|
63
72
|
|
|
73
|
+
Sauce.logger.debug "Thread #{Thread.current.object_id} created driver #{raw_driver.session_id}"
|
|
64
74
|
Sauce::Selenium2.used_at_least_once
|
|
65
75
|
end
|
|
66
76
|
|
|
@@ -69,15 +79,17 @@ module Sauce
|
|
|
69
79
|
end
|
|
70
80
|
|
|
71
81
|
def session_id
|
|
72
|
-
|
|
82
|
+
raw_driver.send(:bridge).session_id
|
|
73
83
|
end
|
|
74
84
|
|
|
75
85
|
def current_url
|
|
76
|
-
|
|
86
|
+
raw_driver.current_url
|
|
77
87
|
end
|
|
78
88
|
|
|
79
89
|
def stop
|
|
90
|
+
Sauce.logger.debug "Thread #{Thread.current.object_id} quitting driver #{@driver.session_id}"
|
|
80
91
|
@driver.quit
|
|
92
|
+
Sauce.logger.debug "Thread #{Thread.current.object_id} has quit driver #{@driver.session_id}"
|
|
81
93
|
end
|
|
82
94
|
end
|
|
83
95
|
end
|
data/lib/sauce/utilities.rb
CHANGED
|
@@ -1,36 +1,56 @@
|
|
|
1
1
|
module Sauce
|
|
2
2
|
module Utilities
|
|
3
3
|
class Connect
|
|
4
|
+
class TunnelNeverStarted < StandardError
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
TIMEOUT = 90 # Magic Numbers!
|
|
8
|
+
|
|
4
9
|
def self.start_from_config(config)
|
|
5
10
|
self.start(:host => config[:application_host], :port => config[:application_port], :quiet => true)
|
|
6
11
|
end
|
|
7
12
|
|
|
8
13
|
def self.start(options={})
|
|
9
14
|
begin
|
|
15
|
+
Sauce.logger.debug "Requiring Sauce Connect gem."
|
|
10
16
|
require "sauce/connect"
|
|
11
17
|
rescue LoadError => e
|
|
12
18
|
STDERR.puts 'Please install the `sauce-connect` gem if you intend on using Sauce Connect with your tests!'
|
|
13
19
|
exit(1)
|
|
14
20
|
end
|
|
15
21
|
|
|
22
|
+
options[:timeout] = TIMEOUT unless options[:timeout]
|
|
16
23
|
if ParallelTests.first_process?
|
|
24
|
+
Sauce.logger.debug "#{Thread.current.object_id} - First parallel process attempting to start Sauce Connect."
|
|
17
25
|
unless @tunnel
|
|
18
26
|
@tunnel = Sauce::Connect.new options
|
|
19
27
|
@tunnel.connect
|
|
20
28
|
@tunnel.wait_until_ready
|
|
29
|
+
else
|
|
30
|
+
Sauce.logger.warn "#{Thread.current.object_id} - Tunnel already existed somehow."
|
|
21
31
|
end
|
|
22
32
|
@tunnel
|
|
23
33
|
else
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
Sauce.logger.debug "#{Thread.current.object_id} - Waiting for a Sauce Connect tunnel to be ready."
|
|
35
|
+
timeout_after = Time.now + options[:timeout]
|
|
36
|
+
# Ensure first process has a change to start up
|
|
37
|
+
sleep 5
|
|
38
|
+
readyfile_found = File.exist? "sauce_connect.ready"
|
|
39
|
+
until (Time.now > timeout_after) || readyfile_found
|
|
40
|
+
readyfile_found = File.exist? "sauce_connect.ready"
|
|
41
|
+
sleep 1
|
|
26
42
|
end
|
|
43
|
+
|
|
44
|
+
raise(TunnelNeverStarted, "Sauce Connect was not started within #{TIMEOUT} seconds") unless readyfile_found
|
|
27
45
|
end
|
|
28
46
|
end
|
|
29
47
|
|
|
30
48
|
def self.close
|
|
31
49
|
if @tunnel
|
|
32
50
|
if ParallelTests.first_process?
|
|
51
|
+
Sauce.logger.debug "#{Thread.current.object_id} - First parallel process waiting for other processes before closing Sauce Connect."
|
|
33
52
|
ParallelTests.wait_for_other_processes_to_finish
|
|
53
|
+
Sauce.logger.debug "#{Thread.current.object_id} - All other parallel processes closed - Closing Sauce Connect tunnel #{@tunnel}."
|
|
34
54
|
@tunnel.disconnect
|
|
35
55
|
@tunnel = nil
|
|
36
56
|
end
|
|
@@ -8,6 +8,8 @@ module Sauce
|
|
|
8
8
|
|
|
9
9
|
def self.start_if_required(config)
|
|
10
10
|
if config[:start_local_application] && self.is_rails_app?
|
|
11
|
+
Sauce.logger.debug "App is a Rails app and config[:start_local_application] was trueish."
|
|
12
|
+
Sauce.logger.info "#{Thread.current.object_id} - Starting Rails app server."
|
|
11
13
|
server = new
|
|
12
14
|
server.start
|
|
13
15
|
|
|
@@ -75,19 +77,22 @@ module Sauce
|
|
|
75
77
|
wait_for_server_on_port(@port)
|
|
76
78
|
|
|
77
79
|
at_exit do
|
|
80
|
+
Sauce.logger.debug "#{Thread.current.object_id} - At exit hook called in Sauce::Utilities::RailsServer."
|
|
81
|
+
Sauce.logger.info "Stopping Rails App Server."
|
|
78
82
|
@server.stop(3, "INT")
|
|
79
83
|
RailsServer.server_pool.delete Thread.current.object_id
|
|
80
84
|
end
|
|
81
|
-
|
|
85
|
+
Sauce.logger.info "Rails server running!"
|
|
82
86
|
|
|
83
87
|
RailsServer.server_pool[Thread.current.object_id] = @server
|
|
84
88
|
end
|
|
85
89
|
|
|
86
90
|
def stop
|
|
91
|
+
Sauce.logger.debug "#{Thread.current.object_id} - Stopping Rails app server with #stop method."
|
|
87
92
|
begin
|
|
88
93
|
@server.stop(3, "INT")
|
|
89
94
|
rescue
|
|
90
|
-
|
|
95
|
+
Sauce.logger.error "#{Thread.current.object_id} - Rails server could not be killed. Did it fail to start?"
|
|
91
96
|
end
|
|
92
97
|
end
|
|
93
98
|
end
|
data/lib/sauce/version.rb
CHANGED
|
@@ -2,9 +2,9 @@ require "spec_helper"
|
|
|
2
2
|
|
|
3
3
|
describe "Capybara" do
|
|
4
4
|
describe "Without :sauce tagging", :js => true, :type => :feature do
|
|
5
|
-
it "should connect using the port", :js => true do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end
|
|
5
|
+
# it "should connect using the port", :js => true do
|
|
6
|
+
# visit "/"
|
|
7
|
+
# expect(page).to have_content "Hello Sauce!"
|
|
8
|
+
# end
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -4,6 +4,7 @@ describe Sauce::Selenium2 do
|
|
|
4
4
|
describe "#file_detector" do
|
|
5
5
|
it "should return the path of files when they exist" do
|
|
6
6
|
Selenium::WebDriver::Remote::Bridge.any_instance.stub(:create_session).and_return({})
|
|
7
|
+
Selenium::WebDriver::Remote::Bridge.any_instance.stub(:session_id).and_return("FSDSDFSDF")
|
|
7
8
|
|
|
8
9
|
path = __FILE__
|
|
9
10
|
|
data/spec/sauce/selenium_spec.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.5.
|
|
4
|
+
version: 3.5.7
|
|
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: 2015-
|
|
17
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
|
18
18
|
dependencies:
|
|
19
19
|
- !ruby/object:Gem::Dependency
|
|
20
20
|
name: rspec
|
|
@@ -267,6 +267,7 @@ files:
|
|
|
267
267
|
- lib/sauce/driver_pool.rb
|
|
268
268
|
- lib/sauce/heroku.rb
|
|
269
269
|
- lib/sauce/job.rb
|
|
270
|
+
- lib/sauce/logging.rb
|
|
270
271
|
- lib/sauce/parallel.rb
|
|
271
272
|
- lib/sauce/parallel/test_broker.rb
|
|
272
273
|
- lib/sauce/parallel/test_group.rb
|
|
@@ -344,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
344
345
|
version: '0'
|
|
345
346
|
requirements: []
|
|
346
347
|
rubyforge_project:
|
|
347
|
-
rubygems_version: 2.
|
|
348
|
+
rubygems_version: 2.4.8
|
|
348
349
|
signing_key:
|
|
349
350
|
specification_version: 4
|
|
350
351
|
summary: A Ruby helper for running tests in Sauce Labs
|