sauce 0.8.0 → 0.9.0

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 CHANGED
@@ -31,6 +31,12 @@ Rake::TestTask.new(:test) do |test|
31
31
  test.verbose = true
32
32
  end
33
33
 
34
+ Rake::TestTask.new(:examples) do |test|
35
+ test.libs << 'lib' << 'examples'
36
+ test.pattern = 'examples/test_*.rb'
37
+ test.verbose = true
38
+ end
39
+
34
40
  begin
35
41
  require 'rcov/rcovtask'
36
42
  Rcov::RcovTask.new do |test|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0
1
+ 0.9.0
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ require 'sauce'
6
+
7
+ Sauce.config do |config|
8
+ config.browsers = [
9
+ ["Linux", "firefox", "3.6."],
10
+ #["Windows 2003", "safariproxy", "5."]
11
+ ]
12
+ config.browser_url = "http://saucelabs.com"
13
+
14
+ #config.application_host = "localhost"
15
+ #config.application_port = "4444"
16
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(File.expand_path(File.dirname(__FILE__))), "test", "helper")
1
+ require File.join(File.dirname(__FILE__), "helper")
2
2
 
3
3
  describe "The login form", :type => :selenium do
4
4
  it "exists" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(File.expand_path(File.dirname(__FILE__))), "test", "helper")
1
+ require File.join(File.dirname(__FILE__), "helper")
2
2
 
3
3
  describe "The Sauce website", :type => :selenium do
4
4
  it "works" do
@@ -0,0 +1,13 @@
1
+ require File.join(File.dirname(__FILE__), "helper")
2
+
3
+ class TestSaucelabs < Sauce::TestCase
4
+ def test_basic_functionality
5
+ selenium.open "/"
6
+ assert page.is_text_present("Sauce Labs")
7
+ end
8
+
9
+ def test_pricing_page
10
+ selenium.open "/pricing"
11
+ assert page.is_text_present("$")
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ require File.join(File.dirname(__FILE__), "helper")
2
+
3
+ class TestSaucelabs2 < Sauce::TestCase
4
+ def test_basic_functionality_two
5
+ selenium.open "/"
6
+ assert page.is_text_present("Sauce Labs")
7
+ end
8
+ end
9
+
@@ -47,3 +47,66 @@ begin
47
47
  rescue LoadError
48
48
  # User doesn't have RSpec installed
49
49
  end
50
+
51
+ begin
52
+ require 'test/unit'
53
+ module Sauce
54
+ class TestCase < Test::Unit::TestCase
55
+ attr_reader :selenium
56
+
57
+ alias_method :page, :selenium
58
+ alias_method :s, :selenium
59
+
60
+ def run(*args, &blk)
61
+ unless name =~ /^default_test/
62
+ config = Sauce::Config.new
63
+ config.browsers.each do |os, browser, version|
64
+ @selenium = Sauce::Selenium.new({:os => os, :browser => browser, :browser_version => version,
65
+ :job_name => "#{name}"})
66
+ @selenium.start
67
+ super(*args, &blk)
68
+ @selenium.stop
69
+ end
70
+ end
71
+ end
72
+
73
+ # Placeholder so test/unit ignores test cases without any tests.
74
+ def default_test
75
+ end
76
+
77
+ def self.ensure_tunnel_running
78
+ unless defined?(@tunnel)
79
+ end
80
+ end
81
+ end
82
+ end
83
+ require 'test/unit/ui/console/testrunner'
84
+ class Test::Unit::UI::Console::TestRunner
85
+ def attach_to_mediator_with_sauce_tunnel
86
+ @mediator.add_listener(Test::Unit::UI::TestRunnerMediator::STARTED, &method(:start_tunnel))
87
+ @mediator.add_listener(Test::Unit::UI::TestRunnerMediator::FINISHED, &method(:stop_tunnel))
88
+ attach_to_mediator_without_sauce_tunnel
89
+ end
90
+
91
+ alias_method :attach_to_mediator_without_sauce_tunnel, :attach_to_mediator
92
+ alias_method :attach_to_mediator, :attach_to_mediator_with_sauce_tunnel
93
+
94
+ private
95
+
96
+ def start_tunnel(msg)
97
+ config = Sauce::Config.new
98
+ if config.application_host
99
+ @sauce_tunnel = Sauce::Connect.new(:host => config.application_host, :port => config.application_port || 80)
100
+ @sauce_tunnel.wait_until_ready
101
+ end
102
+ end
103
+
104
+ def stop_tunnel(msg)
105
+ if defined? @sauce_tunnel
106
+ @sauce_tunnel.disconnect
107
+ end
108
+ end
109
+ end
110
+ rescue LoadError
111
+ # User doesn't have Test::Unit installed
112
+ end
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: 63
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 8
8
+ - 9
9
9
  - 0
10
- version: 0.8.0
10
+ version: 0.9.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Grove
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-26 00:00:00 -07:00
19
+ date: 2010-10-27 00:00:00 -07:00
20
20
  default_executable: sauce
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -140,6 +140,11 @@ files:
140
140
  - Rakefile
141
141
  - VERSION
142
142
  - bin/sauce
143
+ - examples/helper.rb
144
+ - examples/other_spec.rb
145
+ - examples/saucelabs_spec.rb
146
+ - examples/test_saucelabs.rb
147
+ - examples/test_saucelabs2.rb
143
148
  - lib/sauce.rb
144
149
  - lib/sauce/client.rb
145
150
  - lib/sauce/config.rb
@@ -150,8 +155,6 @@ files:
150
155
  - lib/sauce/job.rb
151
156
  - lib/sauce/selenium.rb
152
157
  - lib/sauce/tunnel.rb
153
- - spec/other_spec.rb
154
- - spec/saucelabs_spec.rb
155
158
  - support/sauce_connect
156
159
  - support/simplejson/LICENSE.txt
157
160
  - support/simplejson/__init__.py
@@ -201,11 +204,14 @@ signing_key:
201
204
  specification_version: 3
202
205
  summary: Ruby access to Sauce Labs' features
203
206
  test_files:
204
- - spec/other_spec.rb
205
- - spec/saucelabs_spec.rb
206
207
  - test/helper.rb
207
208
  - test/test_config.rb
208
209
  - test/test_connect.rb
209
210
  - test/test_jobs.rb
210
211
  - test/test_selenium.rb
211
212
  - test/test_tunnels.rb
213
+ - examples/helper.rb
214
+ - examples/other_spec.rb
215
+ - examples/saucelabs_spec.rb
216
+ - examples/test_saucelabs.rb
217
+ - examples/test_saucelabs2.rb