sauce 0.13.2 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sauce.rb +25 -0
- data/lib/sauce/config.rb +2 -0
- data/lib/sauce/integrations.rb +25 -14
- data/lib/sauce/raketasks.rb +6 -3
- data/lib/sauce/selenium.rb +2 -3
- data/lib/sauce/utilities.rb +1 -1
- data/sauce.gemspec +124 -0
- data/test/integrations/test_rails2.rb +2 -1
- data/test/test_config.rb +6 -0
- metadata +8 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.14.0
|
data/lib/sauce.rb
CHANGED
@@ -7,3 +7,28 @@ require 'sauce/config'
|
|
7
7
|
require 'sauce/selenium'
|
8
8
|
require 'sauce/integrations'
|
9
9
|
require 'sauce/connect'
|
10
|
+
|
11
|
+
module Sauce
|
12
|
+
@@cached_sessions = {}
|
13
|
+
|
14
|
+
def self.cached_session(opts)
|
15
|
+
@@cached_sessions[opts] or new_session(opts)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def self.new_session(opts)
|
21
|
+
session = nil
|
22
|
+
if Sauce::Config.new.local?
|
23
|
+
session = ::Selenium::Client::Driver.new(opts)
|
24
|
+
else
|
25
|
+
session = Sauce::Selenium.new(opts)
|
26
|
+
end
|
27
|
+
at_exit do
|
28
|
+
session.stop
|
29
|
+
end
|
30
|
+
session.start
|
31
|
+
@@cached_sessions[opts] = session
|
32
|
+
return session
|
33
|
+
end
|
34
|
+
end
|
data/lib/sauce/config.rb
CHANGED
data/lib/sauce/integrations.rb
CHANGED
@@ -232,29 +232,40 @@ if defined?(ActiveSupport::TestCase)
|
|
232
232
|
unless my_name =~ /^default_test/
|
233
233
|
config = Sauce::Config.new
|
234
234
|
config.browsers.each do |os, browser, version|
|
235
|
-
if config.
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
235
|
+
if config.single_session?
|
236
|
+
if config.local?
|
237
|
+
@browser = Sauce.cached_session(:host => "127.0.0.1", :port => 4444, :browser => "*" +
|
238
|
+
browser, :url => "http://127.0.0.1:#{config.local_application_port}/")
|
239
|
+
else
|
240
|
+
@browser = Sauce.cached_session({:os => os, :browser => browser, :browser_version => version,
|
241
|
+
:job_name => "#{Rails.root.split[1].to_s} test suite"})
|
242
|
+
end
|
243
|
+
super(*args, &blk)
|
240
244
|
else
|
241
|
-
|
242
|
-
:
|
245
|
+
if config.local?
|
246
|
+
@browser = ::Selenium::Client::Driver.new(:host => "127.0.0.1",
|
247
|
+
:port => 4444,
|
248
|
+
:browser => "*" + browser,
|
249
|
+
:url => "http://127.0.0.1:#{config.local_application_port}/")
|
250
|
+
else
|
251
|
+
@browser = Sauce::Selenium.new({:os => os, :browser => browser, :browser_version => version,
|
252
|
+
:job_name => "#{my_name}"})
|
253
|
+
end
|
254
|
+
@browser.start
|
255
|
+
super(*args, &blk)
|
256
|
+
@browser.stop
|
243
257
|
end
|
244
|
-
@browser.start
|
245
|
-
super(*args, &blk)
|
246
|
-
@browser.stop
|
247
258
|
end
|
248
259
|
end
|
249
260
|
end
|
250
|
-
|
251
|
-
# Placeholder so test/unit ignores test cases without any tests.
|
252
|
-
def default_test
|
253
|
-
end
|
254
261
|
end
|
255
262
|
|
256
263
|
class RailsTestCase < ::ActiveSupport::TestCase
|
257
264
|
include SeleniumForTestUnit
|
265
|
+
|
266
|
+
# Placeholder so test/unit ignores test cases without any tests.
|
267
|
+
def default_test
|
268
|
+
end
|
258
269
|
end
|
259
270
|
end
|
260
271
|
end
|
data/lib/sauce/raketasks.rb
CHANGED
@@ -34,7 +34,8 @@ if defined?(Spec::Rake::SpecTask)
|
|
34
34
|
desc "" # Hide it from rake -T
|
35
35
|
Spec::Rake::SpecTask.new :runtests do |t|
|
36
36
|
t.spec_opts = ['--options', "\"#{Rails.root.join('spec', 'spec.opts')}\""]
|
37
|
-
|
37
|
+
spec_glob = ENV["SAUCE_SPEC_GLOB"] || "spec/selenium/**/*_spec.rb"
|
38
|
+
t.spec_files = FileList[spec_glob]
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
@@ -70,7 +71,8 @@ if defined?(RSpec::Core::RakeTask)
|
|
70
71
|
|
71
72
|
desc "" # Hide it from rake -T
|
72
73
|
RSpec::Core::RakeTask.new :runtests do |t|
|
73
|
-
|
74
|
+
spec_glob = ENV["SAUCE_SPEC_GLOB"] || "spec/selenium/**/*_spec.rb"
|
75
|
+
t.pattern = spec_glob
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
@@ -98,7 +100,8 @@ namespace :test do
|
|
98
100
|
|
99
101
|
Rake::TestTask.new(:runtests) do |t|
|
100
102
|
t.libs << "test"
|
101
|
-
|
103
|
+
test_glob = ENV["SAUCE_TEST_GLOB"] || "test/selenium/**/*_test.rb"
|
104
|
+
t.pattern = test_glob
|
102
105
|
t.verbose = true
|
103
106
|
end
|
104
107
|
# Hide it from rake -T
|
data/lib/sauce/selenium.rb
CHANGED
@@ -4,9 +4,8 @@ module Sauce
|
|
4
4
|
class Selenium < Selenium::Client::Driver
|
5
5
|
def initialize(opts={})
|
6
6
|
@config = Sauce::Config.new(opts)
|
7
|
-
opts.merge
|
8
|
-
:browser => @config.to_browser_string, :url => @config.browser_url})
|
9
|
-
super(opts)
|
7
|
+
super(opts.merge({:host => @config.host, :port => @config.port,
|
8
|
+
:browser => @config.to_browser_string, :url => @config.browser_url}))
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
data/lib/sauce/utilities.rb
CHANGED
@@ -50,7 +50,7 @@ module Sauce
|
|
50
50
|
def with_rails_server
|
51
51
|
STDERR.puts "Starting Rails server on port 3001..."
|
52
52
|
if File.exists?('script/server')
|
53
|
-
server = IO.popen("ruby script/server
|
53
|
+
server = IO.popen("ruby script/server -e test --port 3001 --daemon")
|
54
54
|
elsif File.exists?('script/rails')
|
55
55
|
server = IO.popen("script/rails server -p 3001 -e test")
|
56
56
|
end
|
data/sauce.gemspec
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sauce}
|
8
|
+
s.version = "0.14.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Sean Grove", "Eric Allen", "Steven Hazel"]
|
12
|
+
s.date = %q{2011-01-24}
|
13
|
+
s.default_executable = %q{sauce}
|
14
|
+
s.description = %q{A Ruby interface to Sauce Labs' services. Start/stop tunnels, retrieve Selenium logs, access video replays, etc.}
|
15
|
+
s.email = %q{help@saucelabs.com}
|
16
|
+
s.executables = ["sauce"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.markdown"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
"LICENSE",
|
24
|
+
"README.markdown",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bin/sauce",
|
28
|
+
"examples/helper.rb",
|
29
|
+
"examples/other_spec.rb",
|
30
|
+
"examples/saucelabs_spec.rb",
|
31
|
+
"examples/test_saucelabs.rb",
|
32
|
+
"examples/test_saucelabs2.rb",
|
33
|
+
"generators/sauce/sauce_generator.rb",
|
34
|
+
"generators/sauce/templates/sauce.rake",
|
35
|
+
"lib/generators/sauce_generator.rb",
|
36
|
+
"lib/generators/templates/sauce.rake",
|
37
|
+
"lib/sauce.rb",
|
38
|
+
"lib/sauce/client.rb",
|
39
|
+
"lib/sauce/config.rb",
|
40
|
+
"lib/sauce/connect.rb",
|
41
|
+
"lib/sauce/gateway_ext.rb",
|
42
|
+
"lib/sauce/heroku.rb",
|
43
|
+
"lib/sauce/integrations.rb",
|
44
|
+
"lib/sauce/job.rb",
|
45
|
+
"lib/sauce/raketasks.rb",
|
46
|
+
"lib/sauce/selenium.rb",
|
47
|
+
"lib/sauce/tunnel.rb",
|
48
|
+
"lib/sauce/utilities.rb",
|
49
|
+
"sauce.gemspec",
|
50
|
+
"support/sauce_connect",
|
51
|
+
"support/selenium-server.jar",
|
52
|
+
"support/simplejson/LICENSE.txt",
|
53
|
+
"support/simplejson/__init__.py",
|
54
|
+
"support/simplejson/decoder.py",
|
55
|
+
"support/simplejson/encoder.py",
|
56
|
+
"support/simplejson/ordered_dict.py",
|
57
|
+
"support/simplejson/scanner.py",
|
58
|
+
"support/simplejson/tool.py",
|
59
|
+
"test/api/test_jobs.rb",
|
60
|
+
"test/api/test_tunnels.rb",
|
61
|
+
"test/helper.rb",
|
62
|
+
"test/test_config.rb",
|
63
|
+
"test/test_connect.rb",
|
64
|
+
"test/test_selenium.rb"
|
65
|
+
]
|
66
|
+
s.homepage = %q{http://github.com/saucelabs/sauce}
|
67
|
+
s.require_paths = ["lib"]
|
68
|
+
s.rubygems_version = %q{1.4.2}
|
69
|
+
s.summary = %q{Ruby access to Sauce Labs' features}
|
70
|
+
s.test_files = [
|
71
|
+
"examples/helper.rb",
|
72
|
+
"examples/other_spec.rb",
|
73
|
+
"examples/saucelabs_spec.rb",
|
74
|
+
"examples/test_saucelabs.rb",
|
75
|
+
"examples/test_saucelabs2.rb",
|
76
|
+
"test/api/test_jobs.rb",
|
77
|
+
"test/api/test_tunnels.rb",
|
78
|
+
"test/helper.rb",
|
79
|
+
"test/integrations/test_rails2.rb",
|
80
|
+
"test/test_config.rb",
|
81
|
+
"test/test_connect.rb",
|
82
|
+
"test/test_selenium.rb"
|
83
|
+
]
|
84
|
+
|
85
|
+
if s.respond_to? :specification_version then
|
86
|
+
s.specification_version = 3
|
87
|
+
|
88
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
89
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
90
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
|
91
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
92
|
+
s.add_runtime_dependency(%q<net-ssh>, [">= 0"])
|
93
|
+
s.add_runtime_dependency(%q<net-ssh-gateway>, [">= 0"])
|
94
|
+
s.add_runtime_dependency(%q<selenium-webdriver>, [">= 0.1.2"])
|
95
|
+
s.add_runtime_dependency(%q<childprocess>, [">= 0.1.6"])
|
96
|
+
s.add_runtime_dependency(%q<json>, [">= 1.2.0"])
|
97
|
+
s.add_runtime_dependency(%q<cmdparse>, [">= 2.0.2"])
|
98
|
+
s.add_runtime_dependency(%q<highline>, [">= 1.5.0"])
|
99
|
+
else
|
100
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
101
|
+
s.add_dependency(%q<jeweler>, [">= 1.4.0"])
|
102
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
103
|
+
s.add_dependency(%q<net-ssh>, [">= 0"])
|
104
|
+
s.add_dependency(%q<net-ssh-gateway>, [">= 0"])
|
105
|
+
s.add_dependency(%q<selenium-webdriver>, [">= 0.1.2"])
|
106
|
+
s.add_dependency(%q<childprocess>, [">= 0.1.6"])
|
107
|
+
s.add_dependency(%q<json>, [">= 1.2.0"])
|
108
|
+
s.add_dependency(%q<cmdparse>, [">= 2.0.2"])
|
109
|
+
s.add_dependency(%q<highline>, [">= 1.5.0"])
|
110
|
+
end
|
111
|
+
else
|
112
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
113
|
+
s.add_dependency(%q<jeweler>, [">= 1.4.0"])
|
114
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
115
|
+
s.add_dependency(%q<net-ssh>, [">= 0"])
|
116
|
+
s.add_dependency(%q<net-ssh-gateway>, [">= 0"])
|
117
|
+
s.add_dependency(%q<selenium-webdriver>, [">= 0.1.2"])
|
118
|
+
s.add_dependency(%q<childprocess>, [">= 0.1.6"])
|
119
|
+
s.add_dependency(%q<json>, [">= 1.2.0"])
|
120
|
+
s.add_dependency(%q<cmdparse>, [">= 2.0.2"])
|
121
|
+
s.add_dependency(%q<highline>, [">= 1.5.0"])
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
data/test/test_config.rb
CHANGED
@@ -44,6 +44,12 @@ class TestConfig < Test::Unit::TestCase
|
|
44
44
|
|
45
45
|
assert_equal [["A", "B", "C"]], config.browsers
|
46
46
|
end
|
47
|
+
|
48
|
+
should "Let you set and query boolean flags" do
|
49
|
+
config = Sauce::Config.new
|
50
|
+
config.foo = true
|
51
|
+
assert config.foo?
|
52
|
+
end
|
47
53
|
end
|
48
54
|
|
49
55
|
context "The Sauce.config method" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sauce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 39
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 14
|
9
|
+
- 0
|
10
|
+
version: 0.14.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Grove
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-01-
|
20
|
+
date: 2011-01-24 00:00:00 -08:00
|
21
21
|
default_executable: sauce
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- lib/sauce/selenium.rb
|
210
210
|
- lib/sauce/tunnel.rb
|
211
211
|
- lib/sauce/utilities.rb
|
212
|
+
- sauce.gemspec
|
212
213
|
- support/sauce_connect
|
213
214
|
- support/selenium-server.jar
|
214
215
|
- support/simplejson/LICENSE.txt
|
@@ -255,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
256
|
requirements: []
|
256
257
|
|
257
258
|
rubyforge_project:
|
258
|
-
rubygems_version: 1.
|
259
|
+
rubygems_version: 1.4.2
|
259
260
|
signing_key:
|
260
261
|
specification_version: 3
|
261
262
|
summary: Ruby access to Sauce Labs' features
|