saucelabs-adapter 0.8.24 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -168,6 +168,11 @@ Resources
168
168
  NOTABLE CHANGES
169
169
  ===============
170
170
 
171
+ 0.9.0
172
+ -----
173
+ - Added support for :sauce_connect_tunnel tunnel method, which uses 'sauce connect'
174
+ from the 'sauce' gem. This also introduces a dependency on the sauce gem.
175
+
171
176
  0.8.7
172
177
  -----
173
178
  - No longer exits when the tunnel status is 'deploying'
data/Rakefile CHANGED
@@ -37,6 +37,7 @@ begin
37
37
  gem.add_dependency 'net-ssh-gateway', '>= 1.0.1'
38
38
  gem.add_dependency 'selenium-client', '>= 1.2.17'
39
39
  gem.add_dependency 'lsof', '>= 0.3.0'
40
+ gem.add_dependency 'sauce', '>= 0.12.9'
40
41
  # gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
41
42
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
42
43
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.24
1
+ 0.9.0
@@ -42,15 +42,17 @@ saucelabs: &saucelabs
42
42
  saucelabs_browser_version: "3."
43
43
  saucelabs_max_duration_seconds: 1800
44
44
  # Selenium RC browser connects to and tests the app at this URL:
45
- application_address: "testhost.com" # this will be ovewritten if tunnel_method == :saucetunnel
45
+ # application_address: "localhost" # this will be overwritten if tunnel_method == :saucetunnel or :sauceconnecttunnel
46
46
  application_port: 4000
47
+ tunnel_to_localhost_port: 4000
47
48
 
48
49
  # App host can actually be a tunnel that tunnels from <application_address>:<application_port> to localhost:<tunnel_to_localhost_port>
49
- # There are 3 kinds of tunnels:
50
+ # There are 4 kinds of tunnels:
50
51
  #
51
- tunnel_method: :saucetunnel
52
- tunnel_to_localhost_port: 4000 # Warning: application_port and tunnel_to_localhost_port must be identical if you are using Webrat
53
- tunnel_startup_timeout: 240
52
+ tunnel_method: :sauceconnecttunnel # this is the new preferred 'sauce connect' tunnel method from the 'sauce' gem
53
+ #
54
+ # tunnel_method: :saucetunnel # NOTE: this is the 'old' deprecated sauce tunnel method
55
+ # tunnel_startup_timeout: 240
54
56
  #
55
57
  # tunnel_method: :sshtunnel # WARNING: if other projects use the same port on the same machine at the same time, you can get intermittent errors.
56
58
  # application_address: proxy.mycompany.com
@@ -64,7 +66,7 @@ saucelabs: &saucelabs
64
66
  saucelabs_jsunit: &saucelabs_jsunit
65
67
  <<: *saucelabs
66
68
  # We are using the Jetty server for Saucelabs JsUnit selenium testing.
67
- localhost_app_server_port: "8080"
69
+ tunnel_to_localhost_port: "8080"
68
70
 
69
71
  saucelabs_jsunit_firefox:
70
72
  <<: *saucelabs_jsunit
@@ -1,5 +1,6 @@
1
1
  require 'saucelabs_adapter/utilities'
2
2
  require 'saucelabs_adapter/tunnel'
3
+ require 'saucelabs_adapter/tunnels/sauce_connect_tunnel'
3
4
  require 'saucelabs_adapter/tunnels/sauce_tunnel'
4
5
  require 'saucelabs_adapter/tunnels/ssh_tunnel'
5
6
  require 'saucelabs_adapter/tunnels/other_tunnel'
@@ -29,7 +29,7 @@ if defined?(Spec::Runner)
29
29
  else
30
30
  puts "[saucelabs-adapter] Starting browser session" if ENV['SAUCELABS_ADAPTER_DEBUG']
31
31
  @browser = selenium_config.create_driver
32
- @browser.start_new_browser_session
32
+ @browser.start_new_browser_session :trustAllSSLCertificates => false
33
33
  end
34
34
  end
35
35
 
@@ -46,9 +46,10 @@ module SaucelabsAdapter
46
46
  end
47
47
 
48
48
  def application_address
49
- if start_tunnel? && @configuration['tunnel_method'].to_sym == :saucetunnel
50
- # We are using Sauce Labs and Sauce Tunnel.
51
- # We need to use a masquerade hostname on the EC2 end of the tunnel that will be unique within the scope of
49
+ if start_tunnel? &&
50
+ [:sauceconnecttunnel, :saucetunnel].include?(@configuration['tunnel_method'].to_sym)
51
+ # We are using Sauce Labs and Sauce Connect Tunnel or Sauce Tunnel.
52
+ # We need to use a masquerade hostname on the EC2/Sauce end of the tunnel that will be unique within the scope of
52
53
  # this account (e.g. pivotallabs). Therefore we mint a fairly unique hostname here.
53
54
  hostname = Socket.gethostname.split(".").first
54
55
  "#{hostname}-#{Process.pid}.com"
@@ -60,11 +61,15 @@ module SaucelabsAdapter
60
61
 
61
62
  # Takes a Webrat::Configuration object and configures it by calling methods on it
62
63
  def configure_webrat(webrat_configuration_object)
64
+ # NOTE: application_port_for_selenium requires version > 0.7.3 of webrat
65
+ # Prior versions only have application_address, and don't have a concept of
66
+ # starting a rails server at one port, and hitting it at selenium via another
63
67
  {
64
68
  'selenium_server_address' => :selenium_server_address,
65
69
  'selenium_server_port' => :selenium_server_port,
66
70
  'selenium_browser_key' => :selenium_browser_key,
67
71
  'application_address' => :application_address,
72
+ 'application_port_for_selenium' => :tunnel_to_localhost_port,
68
73
  'application_port' => :application_port
69
74
  }.each do |webrat_configuration_method, our_accessor|
70
75
  webrat_configuration_object.send("#{webrat_configuration_method}=", self.send(our_accessor).to_s)
@@ -145,12 +150,15 @@ module SaucelabsAdapter
145
150
  :saucelabs_max_duration_seconds ],
146
151
  :when => "when selenium_server_address is saucelabs.com")
147
152
  if tunnel_method
148
- errors << require_attributes([:tunnel_to_localhost_port ], :when => "if tunnel_method is set")
149
153
  case tunnel_method.to_sym
150
154
  when nil, ""
151
155
  when :saucetunnel
156
+ errors << require_attributes([:tunnel_to_localhost_port ], :when => "if tunnel_method is :saucetunnel")
157
+ when :sauceconnecttunnel
158
+ errors << require_attributes([:tunnel_to_localhost_port ], :when => "if tunnel_method is :sauceconnecttunnel")
152
159
  when :othertunnel
153
160
  errors << require_attributes([:application_address], :when => "when tunnel_method is :othertunnel")
161
+ errors << require_attributes([:tunnel_to_localhost_port ], :when => "if tunnel_method is :othertunnel")
154
162
  when :sshtunnel
155
163
  errors << require_attributes([:application_address], :when => "when tunnel_method is :sshtunnel")
156
164
  errors << require_attributes([:tunnel_password, :tunnel_keyfile],
@@ -17,7 +17,7 @@ if defined?(ActiveSupport::TestCase) && ActiveSupport::TestCase.respond_to?(:set
17
17
  else
18
18
  puts "[saucelabs-adapter] Starting browser session"
19
19
  @browser = selenium_config.create_driver
20
- @browser.start_new_browser_session
20
+ @browser.start_new_browser_session :trustAllSSLCertificates => false
21
21
  end
22
22
  end
23
23
 
@@ -5,6 +5,7 @@ module SaucelabsAdapter
5
5
  def self.factory(selenium_config)
6
6
  tunnels = {
7
7
  :saucetunnel => SauceTunnel,
8
+ :sauceconnecttunnel => SauceConnectTunnel,
8
9
  :sshtunnel => SshTunnel,
9
10
  :othertunnel => OtherTunnel
10
11
  }
@@ -0,0 +1,37 @@
1
+ require 'sauce'
2
+
3
+ module SaucelabsAdapter
4
+ class SauceConnectTunnel < Tunnel
5
+
6
+ include Utilities
7
+
8
+ def start_tunnel
9
+ say "Setting up sauce connect tunnel from Saucelabs..."
10
+ # sauce connect --user=<saucelabs_username> --api-key=<saucelabs_access_key> --host=localhost --port=8080 --domain='<local hostname>-<pid>.com'
11
+ # --logfile=/tmp/sauce_connect.log --debug-ssh
12
+
13
+ sauce_connect_args = {
14
+ :user => @se_config.saucelabs_username,
15
+ :'api-key' => @se_config.saucelabs_access_key,
16
+ :host => 'localhost',
17
+ :port => @se_config.application_port,
18
+ :tunnel_port => @se_config.tunnel_to_localhost_port,
19
+ :domain => @se_config.application_address,
20
+ :logfile => '/tmp/sauce_connect.log',
21
+ :'debug-ssh' => true
22
+ }
23
+
24
+ say "Setting up sauce connect tunnel from Saucelabs: #{sauce_connect_args.inspect}"
25
+ @sauce_tunnel = Sauce::Connect.new(sauce_connect_args)
26
+ say "Waiting for sauce connect tunnel to be ready..."
27
+ @sauce_tunnel.wait_until_ready
28
+ sleep 2
29
+ say "Sauce connect tunnel ready."
30
+ end
31
+
32
+ def shutdown
33
+ say "Shutdown for Sauce Connect Tunnel..."
34
+ @sauce_tunnel.disconnect
35
+ end
36
+ end
37
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucelabs-adapter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 8
9
- - 24
10
- version: 0.8.24
8
+ - 9
9
+ - 0
10
+ version: 0.9.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Felkins, Chad Woolley, Sam Pierson, Nate Clark
@@ -15,14 +15,110 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-19 00:00:00 -07:00
18
+ date: 2011-01-20 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  type: :runtime
23
23
  prerelease: false
24
- name: rest-client
24
+ name: activesupport
25
25
  version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 2
33
+ - 3
34
+ - 0
35
+ version: 2.3.0
36
+ requirement: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ type: :runtime
39
+ prerelease: false
40
+ name: sauce
41
+ version_requirements: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: 61
47
+ segments:
48
+ - 0
49
+ - 12
50
+ - 9
51
+ version: 0.12.9
52
+ requirement: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ type: :development
55
+ prerelease: false
56
+ name: rspec
57
+ version_requirements: &id003 !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - "="
61
+ - !ruby/object:Gem::Version
62
+ hash: 27
63
+ segments:
64
+ - 1
65
+ - 3
66
+ - 0
67
+ version: 1.3.0
68
+ requirement: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ type: :development
71
+ prerelease: false
72
+ name: rake
73
+ version_requirements: &id004 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - "="
77
+ - !ruby/object:Gem::Version
78
+ hash: 49
79
+ segments:
80
+ - 0
81
+ - 8
82
+ - 7
83
+ version: 0.8.7
84
+ requirement: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ type: :development
87
+ prerelease: false
88
+ name: json
89
+ version_requirements: &id005 !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ hash: 1
95
+ segments:
96
+ - 1
97
+ - 4
98
+ - 3
99
+ version: 1.4.3
100
+ requirement: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ type: :development
103
+ prerelease: false
104
+ name: jeweler
105
+ version_requirements: &id006 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - "="
109
+ - !ruby/object:Gem::Version
110
+ hash: 7
111
+ segments:
112
+ - 1
113
+ - 5
114
+ - 2
115
+ version: 1.5.2
116
+ requirement: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ type: :runtime
119
+ prerelease: false
120
+ name: rest-client
121
+ version_requirements: &id007 !ruby/object:Gem::Requirement
26
122
  none: false
27
123
  requirements:
28
124
  - - ">="
@@ -33,12 +129,12 @@ dependencies:
33
129
  - 5
34
130
  - 0
35
131
  version: 1.5.0
36
- requirement: *id001
132
+ requirement: *id007
37
133
  - !ruby/object:Gem::Dependency
38
134
  type: :runtime
39
135
  prerelease: false
40
136
  name: net-ssh
41
- version_requirements: &id002 !ruby/object:Gem::Requirement
137
+ version_requirements: &id008 !ruby/object:Gem::Requirement
42
138
  none: false
43
139
  requirements:
44
140
  - - ">="
@@ -49,12 +145,12 @@ dependencies:
49
145
  - 0
50
146
  - 12
51
147
  version: 2.0.12
52
- requirement: *id002
148
+ requirement: *id008
53
149
  - !ruby/object:Gem::Dependency
54
150
  type: :runtime
55
151
  prerelease: false
56
152
  name: net-ssh-gateway
57
- version_requirements: &id003 !ruby/object:Gem::Requirement
153
+ version_requirements: &id009 !ruby/object:Gem::Requirement
58
154
  none: false
59
155
  requirements:
60
156
  - - ">="
@@ -65,12 +161,12 @@ dependencies:
65
161
  - 0
66
162
  - 1
67
163
  version: 1.0.1
68
- requirement: *id003
164
+ requirement: *id009
69
165
  - !ruby/object:Gem::Dependency
70
166
  type: :runtime
71
167
  prerelease: false
72
168
  name: selenium-client
73
- version_requirements: &id004 !ruby/object:Gem::Requirement
169
+ version_requirements: &id010 !ruby/object:Gem::Requirement
74
170
  none: false
75
171
  requirements:
76
172
  - - ">="
@@ -81,12 +177,12 @@ dependencies:
81
177
  - 2
82
178
  - 17
83
179
  version: 1.2.17
84
- requirement: *id004
180
+ requirement: *id010
85
181
  - !ruby/object:Gem::Dependency
86
182
  type: :runtime
87
183
  prerelease: false
88
184
  name: lsof
89
- version_requirements: &id005 !ruby/object:Gem::Requirement
185
+ version_requirements: &id011 !ruby/object:Gem::Requirement
90
186
  none: false
91
187
  requirements:
92
188
  - - ">="
@@ -97,7 +193,23 @@ dependencies:
97
193
  - 3
98
194
  - 0
99
195
  version: 0.3.0
100
- requirement: *id005
196
+ requirement: *id011
197
+ - !ruby/object:Gem::Dependency
198
+ type: :runtime
199
+ prerelease: false
200
+ name: sauce
201
+ version_requirements: &id012 !ruby/object:Gem::Requirement
202
+ none: false
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ hash: 61
207
+ segments:
208
+ - 0
209
+ - 12
210
+ - 9
211
+ version: 0.12.9
212
+ requirement: *id012
101
213
  description: "This gem augments Test::Unit and Polonium/Webrat to run Selenium tests in the cloud. "
102
214
  email: pair+kelly+sam@pivotallabs.com
103
215
  executables: []
@@ -127,6 +239,7 @@ files:
127
239
  - lib/saucelabs_adapter/test_unit_adapter.rb
128
240
  - lib/saucelabs_adapter/tunnel.rb
129
241
  - lib/saucelabs_adapter/tunnels/other_tunnel.rb
242
+ - lib/saucelabs_adapter/tunnels/sauce_connect_tunnel.rb
130
243
  - lib/saucelabs_adapter/tunnels/sauce_tunnel.rb
131
244
  - lib/saucelabs_adapter/tunnels/ssh_tunnel.rb
132
245
  - lib/saucelabs_adapter/utilities.rb
@@ -145,8 +258,8 @@ homepage: http://github.com/pivotal/saucelabs-adapter
145
258
  licenses: []
146
259
 
147
260
  post_install_message:
148
- rdoc_options:
149
- - --charset=UTF-8
261
+ rdoc_options: []
262
+
150
263
  require_paths:
151
264
  - lib
152
265
  required_ruby_version: !ruby/object:Gem::Requirement