sauce 0.13.1 → 0.13.2
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.
- data/Rakefile +13 -0
- data/VERSION +1 -1
- data/lib/sauce/config.rb +4 -0
- data/lib/sauce/integrations.rb +13 -8
- data/test/{test_jobs.rb → api/test_jobs.rb} +0 -0
- data/test/{test_tunnels.rb → api/test_tunnels.rb} +0 -0
- data/test/integrations/test_rails2.rb +19 -0
- data/test/test_config.rb +18 -7
- data/test/test_selenium.rb +3 -2
- metadata +9 -7
data/Rakefile
CHANGED
@@ -34,6 +34,19 @@ Rake::TestTask.new(:test) do |test|
|
|
34
34
|
test.verbose = true
|
35
35
|
end
|
36
36
|
|
37
|
+
namespace :test do
|
38
|
+
Rake::TestTask.new(:api) do |test|
|
39
|
+
test.libs << 'lib' << 'test'
|
40
|
+
test.pattern = 'test/api/test_*.rb'
|
41
|
+
test.verbose = true
|
42
|
+
end
|
43
|
+
Rake::TestTask.new(:integrations) do |test|
|
44
|
+
test.libs << 'lib' << 'test'
|
45
|
+
test.pattern = 'test/integrations/test_*.rb'
|
46
|
+
test.verbose = true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
37
50
|
Rake::TestTask.new(:examples) do |test|
|
38
51
|
test.libs << 'lib' << 'examples'
|
39
52
|
test.pattern = 'examples/test_*.rb'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.13.
|
1
|
+
0.13.2
|
data/lib/sauce/config.rb
CHANGED
@@ -26,6 +26,10 @@ module Sauce
|
|
26
26
|
:local_application_port => "3001"
|
27
27
|
}
|
28
28
|
|
29
|
+
ENVIRONMENT_VARIABLES = %w{SAUCE_HOST SAUCE_PORT SAUCE_BROWSER_URL SAUCE_USERNAME
|
30
|
+
SAUCE_ACCESS_KEY SAUCE_OS SAUCE_BROWSER SAUCE_BROWSER_VERSION SAUCE_JOB_NAME
|
31
|
+
SAUCE_FIREFOX_PROFILE_URL SAUCE_USER_EXTENSIONS_URL}
|
32
|
+
|
29
33
|
def initialize(opts={})
|
30
34
|
@opts = {}
|
31
35
|
if opts != false
|
data/lib/sauce/integrations.rb
CHANGED
@@ -216,11 +216,12 @@ end
|
|
216
216
|
|
217
217
|
if defined?(ActiveSupport::TestCase)
|
218
218
|
module Sauce
|
219
|
-
|
220
|
-
attr_reader :
|
219
|
+
module SeleniumForTestUnit
|
220
|
+
attr_reader :browser
|
221
221
|
|
222
|
-
alias_method :page, :
|
223
|
-
alias_method :s, :
|
222
|
+
alias_method :page, :browser
|
223
|
+
alias_method :s, :browser
|
224
|
+
alias_method :selenium, :browser
|
224
225
|
|
225
226
|
def run(*args, &blk)
|
226
227
|
if self.respond_to? :name
|
@@ -232,17 +233,17 @@ if defined?(ActiveSupport::TestCase)
|
|
232
233
|
config = Sauce::Config.new
|
233
234
|
config.browsers.each do |os, browser, version|
|
234
235
|
if config.local?
|
235
|
-
@
|
236
|
+
@browser = ::Selenium::Client::Driver.new(:host => "127.0.0.1",
|
236
237
|
:port => 4444,
|
237
238
|
:browser => "*" + browser,
|
238
239
|
:url => "http://127.0.0.1:#{config.local_application_port}/")
|
239
240
|
else
|
240
|
-
@
|
241
|
+
@browser = Sauce::Selenium.new({:os => os, :browser => browser, :browser_version => version,
|
241
242
|
:job_name => "#{my_name}"})
|
242
243
|
end
|
243
|
-
@
|
244
|
+
@browser.start
|
244
245
|
super(*args, &blk)
|
245
|
-
@
|
246
|
+
@browser.stop
|
246
247
|
end
|
247
248
|
end
|
248
249
|
end
|
@@ -251,5 +252,9 @@ if defined?(ActiveSupport::TestCase)
|
|
251
252
|
def default_test
|
252
253
|
end
|
253
254
|
end
|
255
|
+
|
256
|
+
class RailsTestCase < ::ActiveSupport::TestCase
|
257
|
+
include SeleniumForTestUnit
|
258
|
+
end
|
254
259
|
end
|
255
260
|
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
class TestRails2Integration < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
@dir = File.join(Dir.tmpdir, "sauce_gem_test_#{rand(100000)}")
|
8
|
+
Dir.mkdir(@dir)
|
9
|
+
Dir.chdir(@dir)
|
10
|
+
puts @dir
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_foo
|
14
|
+
end
|
15
|
+
|
16
|
+
def teardown
|
17
|
+
FileUtils.remove_dir(@dir)
|
18
|
+
end
|
19
|
+
end
|
data/test/test_config.rb
CHANGED
@@ -3,14 +3,25 @@ require 'helper'
|
|
3
3
|
class TestConfig < Test::Unit::TestCase
|
4
4
|
context "A new Config" do
|
5
5
|
should "Generate a reasonable browser string from the environment" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
preserved_env = {}
|
7
|
+
Sauce::Config::ENVIRONMENT_VARIABLES.each do |key|
|
8
|
+
preserved_env[key] = ENV[key] if ENV[key]
|
9
|
+
end
|
10
|
+
begin
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
ENV['SAUCE_USERNAME'] = "test_user"
|
13
|
+
ENV['SAUCE_ACCESS_KEY'] = "test_access"
|
14
|
+
ENV['SAUCE_OS'] = "Linux"
|
15
|
+
ENV['SAUCE_BROWSER'] = "firefox"
|
16
|
+
ENV['SAUCE_BROWSER_VERSION'] = "3."
|
17
|
+
|
18
|
+
config = Sauce::Config.new
|
19
|
+
assert_equal "{\"name\":\"Unnamed Ruby job\",\"access-key\":\"test_access\",\"os\":\"Linux\",\"username\":\"test_user\",\"browser-version\":\"3.\",\"browser\":\"firefox\"}", config.to_browser_string
|
20
|
+
ensure
|
21
|
+
Sauce::Config::ENVIRONMENT_VARIABLES.each do |key|
|
22
|
+
ENV[key] = preserved_env[key] if preserved_env[key]
|
23
|
+
end
|
24
|
+
end
|
14
25
|
end
|
15
26
|
|
16
27
|
should "Generate a browser string from parameters" do
|
data/test/test_selenium.rb
CHANGED
@@ -4,8 +4,9 @@ class TestSelenium < Test::Unit::TestCase
|
|
4
4
|
context "The Sauce Selenium driver" do
|
5
5
|
should "Connect successfully using credentials from the environment" do
|
6
6
|
assert ENV['SAUCE_USERNAME'], "You haven't configured a Sauce OnDemand username. Please set $SAUCE_USERNAME"
|
7
|
-
assert ENV['
|
8
|
-
selenium = Sauce::Selenium.new(
|
7
|
+
assert ENV['SAUCE_ACCESS_KEY'], "You haven't configured a Sauce OnDemand access key. Please set $SAUCE_ACCESS_KEY"
|
8
|
+
selenium = Sauce::Selenium.new(:job_name => "Sauce gem test suite: test_selenium.rb",
|
9
|
+
:browser_url => "http://www.google.com/")
|
9
10
|
selenium.start
|
10
11
|
selenium.open "/"
|
11
12
|
selenium.stop
|
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:
|
4
|
+
hash: 47
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 13
|
9
|
-
-
|
10
|
-
version: 0.13.
|
9
|
+
- 2
|
10
|
+
version: 0.13.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Grove
|
@@ -218,12 +218,13 @@ files:
|
|
218
218
|
- support/simplejson/ordered_dict.py
|
219
219
|
- support/simplejson/scanner.py
|
220
220
|
- support/simplejson/tool.py
|
221
|
+
- test/api/test_jobs.rb
|
222
|
+
- test/api/test_tunnels.rb
|
221
223
|
- test/helper.rb
|
222
224
|
- test/test_config.rb
|
223
225
|
- test/test_connect.rb
|
224
|
-
- test/test_jobs.rb
|
225
226
|
- test/test_selenium.rb
|
226
|
-
- test/
|
227
|
+
- test/integrations/test_rails2.rb
|
227
228
|
has_rdoc: true
|
228
229
|
homepage: http://github.com/saucelabs/sauce
|
229
230
|
licenses: []
|
@@ -264,9 +265,10 @@ test_files:
|
|
264
265
|
- examples/saucelabs_spec.rb
|
265
266
|
- examples/test_saucelabs.rb
|
266
267
|
- examples/test_saucelabs2.rb
|
268
|
+
- test/api/test_jobs.rb
|
269
|
+
- test/api/test_tunnels.rb
|
267
270
|
- test/helper.rb
|
271
|
+
- test/integrations/test_rails2.rb
|
268
272
|
- test/test_config.rb
|
269
273
|
- test/test_connect.rb
|
270
|
-
- test/test_jobs.rb
|
271
274
|
- test/test_selenium.rb
|
272
|
-
- test/test_tunnels.rb
|