sauce 0.17.3 → 0.17.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sauce/capybara.rb +16 -4
- data/lib/sauce/config.rb +1 -1
- data/sauce.gemspec +1 -1
- metadata +3 -3
data/lib/sauce/capybara.rb
CHANGED
@@ -5,10 +5,15 @@ module Sauce
|
|
5
5
|
class Driver < ::Capybara::Driver::Selenium
|
6
6
|
def browser
|
7
7
|
unless @browser
|
8
|
+
puts "[Connecting to Sauce OnDemand...]"
|
8
9
|
config = Sauce::Config.new
|
9
|
-
@
|
10
|
+
@domain = "#{rand(10000)}.test"
|
11
|
+
@sauce_tunnel = Sauce::Connect.new(:host => "127.0.0.1",
|
12
|
+
:port => rack_server.port,
|
13
|
+
:domain => @domain,
|
14
|
+
:quiet => true)
|
10
15
|
@sauce_tunnel.wait_until_ready
|
11
|
-
@browser = Sauce::Selenium2.new(:name => "Capybara")
|
16
|
+
@browser = Sauce::Selenium2.new(:name => "Capybara", :browser_url => "http://#{@domain}")
|
12
17
|
at_exit do
|
13
18
|
@browser.quit
|
14
19
|
@sauce_tunnel.disconnect
|
@@ -23,8 +28,7 @@ module Sauce
|
|
23
28
|
if path =~ /^http/
|
24
29
|
path
|
25
30
|
else
|
26
|
-
|
27
|
-
config.browser_url + path.to_s
|
31
|
+
"http://#{@domain}#{path}"
|
28
32
|
end
|
29
33
|
end
|
30
34
|
end
|
@@ -34,3 +38,11 @@ end
|
|
34
38
|
Capybara.register_driver :sauce do |app|
|
35
39
|
Sauce::Capybara::Driver.new(app)
|
36
40
|
end
|
41
|
+
|
42
|
+
# Switch Cucumber stories tagged with @selenium to use sauce
|
43
|
+
begin
|
44
|
+
Before("@selenium") do
|
45
|
+
Capybara.current_driver = :sauce
|
46
|
+
end
|
47
|
+
rescue NoMethodError
|
48
|
+
end
|
data/lib/sauce/config.rb
CHANGED
@@ -88,7 +88,7 @@ module Sauce
|
|
88
88
|
def to_desired_capabilities
|
89
89
|
{
|
90
90
|
:browserName => BROWSERS[browser] || browser,
|
91
|
-
:
|
91
|
+
:version => browser_version,
|
92
92
|
:platform => PLATFORMS[os] || os,
|
93
93
|
:name => @opts[:job_name]
|
94
94
|
}.update(@opts.reject {|k, v| [:browser, :browser_version, :os, :job_name].include? k})
|
data/sauce.gemspec
CHANGED
metadata
CHANGED