sauce 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -6,11 +6,11 @@ gemspec
6
6
 
7
7
  group :test do
8
8
  gem 'cucumber'
9
- gem 'rspec', '~> 2.9'
9
+ gem 'rspec', '~> 2.12'
10
10
  gem 'capybara'
11
11
  gem 'jasmine'
12
12
  end
13
13
 
14
14
  group :development do
15
- gem 'ruby-debug'
15
+ gem 'debugger'
16
16
  end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2010 Sauce Labs Inc
1
+ Copyright (c) 2009-2012 Sauce Labs Inc
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/README.markdown CHANGED
@@ -1,11 +1,16 @@
1
- # Sauce OnDemand for Ruby
1
+ # Sauce for Ruby
2
2
 
3
3
  [![Build Status](https://buildhive.cloudbees.com/job/saucelabs/job/sauce_ruby/badge/icon)](https://buildhive.cloudbees.com/job/saucelabs/job/sauce_ruby/)
4
4
 
5
- Sauce OnDemand is a Selenium-based browser testing service offered by [Sauce
5
+ Sauce is a Selenium-based browser testing service offered by [Sauce
6
6
  Labs](https://www.saucelabs.com).
7
7
 
8
8
 
9
+ There is more information on **[the
10
+ wiki](https://github.com/saucelabs/sauce_ruby/wiki)**, so be sure to look there
11
+ for information too!
12
+
13
+
9
14
  ## Installation
10
15
 
11
16
  ```bash
@@ -20,71 +25,43 @@ The Sauce gem has been optimized to work most effectively with
20
25
  [Cucumber](https://www.cukes.info) and
21
26
  [Capybara](http://jnicklas.github.com/capybara/).
22
27
 
23
- You can read more about how to get started with [Cucumber and Capybara on this
24
- wiki
25
- page](https://github.com/saucelabs/sauce\_ruby/wiki/Cucumber-and-Capybara).
26
-
27
-
28
-
29
- ## Legacy Rails Integration
30
-
31
- You can use either RSpec or Test::Unit with Rails and Sauce OnDemand. To get started, run the generator:
32
-
33
- `script/generate sauce USERNAME ACCESS_KEY`
34
-
35
- The generator will take care of setting up your helpers with Sauce OnDemand
36
- configuration, which you can tweak inside the `Sauce.config` block if necessary.
37
-
38
- ### Example RSpec test for Rails
39
-
40
- Here's an example test for RSpec. Drop something like this in spec/selenium/example.rb. (Because of the way RSpec categorizes tests, the "spec/selenium" directory tree is required for the integration to work properly):
28
+ To get started with Sauce and Cucumber, install the appropriate gem:
41
29
 
42
- require "spec_helper"
43
-
44
- describe "my app" do
45
- it "should have a home page" do
46
- s.get 'http://localhost:3001/'
47
- assert s.page_source.include? 'Welcome aboard'
48
- end
49
- end
50
-
51
- Here's how you run RSpec tests with Sauce OnDemand using rake:
52
-
53
- `rake spec:selenium:sauce`
54
-
55
- ### Example Test::Unit test for Rails
56
-
57
- Here's an example test for Test::Unit. Drop something like this in test/selenium/example\_test.rb:
58
-
59
- require "test_helper"
30
+ ```bash
31
+ % gem install sauce-cucumber
32
+ ```
60
33
 
61
- class DemoTest < Sauce::RailsTestCase
62
- test "my app", do
63
- s.get 'http://localhost:3001/'
64
- assert s.page_source.include? 'Welcome aboard'
65
- end
66
- end
34
+ And then read more how to get started with [Cucumber and Capybara on this
35
+ wiki
36
+ page](https://github.com/saucelabs/sauce\_ruby/wiki/Cucumber-and-Capybara).
67
37
 
68
- Here's how you run Test::Unit tests with Sauce OnDemand using rake:
69
38
 
70
- `rake test:selenium:sauce`
71
39
 
72
40
 
73
- ### Contributing to the Gem
41
+ ## Contributing to the Gem
74
42
 
75
- * Fork the project.
76
- * Make your feature addition or bug fix.
77
- * Please add RSpec tests for your changes, as we don't create a new release of the gem unless all tests are passing.
78
- * Commit
79
- * Send a pull request. Bonus points for topic branches.
43
+ * Fork the GitHub project
44
+ * Create a branch to perform your work in, this will help make your pull
45
+ request more clear.
46
+ * Write some RSpec tests to demonstrate your desired capability or exhibit the
47
+ bug you're fixing.
48
+ * Make your feature addition or bug fix.
49
+ * Commit
50
+ * Send a pull request! :)
80
51
 
81
52
 
82
53
  ### Testing the Gem
83
54
 
84
55
  Running the full test suite will require [RVM](http://rvm.beginrescueend.com)
85
56
 
86
- * Set SAUCE_USERNAME and SAUCE_ACCESS_KEY in your environment to valid Sauce OnDemand credentials
87
- * bundle install
88
- * rake spec:unit # Will just run the unit tests
89
- * rake test # Will run *all* the tests and can be slow
57
+ * Set `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` in your environment to valid Sauce credentials **or** create an `ondemand.yml` in the following format:
58
+
59
+ access_key: <yourkeyhere>
60
+ username: <yourusernamehere>
90
61
 
62
+ * Invoke `bundle install` to install the gems necessary to work with the Sauce
63
+ gem
64
+ * Running `rake spec:unit` will run the [RSpec](https://github.com/rspec/rspec) unit tests
65
+ * If you'd like to run the *entire* test suit, `rake test` will run all the
66
+ integration tests, but requires the Sauce credentials to be set up properly
67
+ as these tests will run actual jobs on Sauce.
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'bundler'
3
3
  require 'rake/testtask'
4
4
  require 'rspec/core/rake_task'
5
+ require 'shellwords'
5
6
 
6
7
  Bundler::GemHelper.install_tasks
7
8
 
@@ -96,8 +96,7 @@ module Sauce
96
96
  block.call
97
97
 
98
98
  # Quit the driver to allow for the generation of a new session_id
99
- driver.browser.quit
100
- driver.instance_variable_set(:@browser, nil)
99
+ driver.finish!
101
100
 
102
101
  unless job.nil?
103
102
  job.passed = !scenario.failed?
@@ -13,5 +13,8 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "sauce-cucumber"
15
15
  gem.require_paths = ["lib"]
16
- gem.version = "#{Sauce::MAJOR_VERSION}.0"
16
+ gem.version = "#{Sauce::MAJOR_VERSION}.1"
17
+
18
+ gem.add_dependency('sauce', ">= #{Sauce::MAJOR_VERSION}.0")
19
+ gem.add_dependency('cucumber', '>= 1.2.0')
17
20
  end
@@ -13,5 +13,9 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "sauce-jasmine"
15
15
  gem.require_paths = ["lib"]
16
- gem.version = "#{Sauce::MAJOR_VERSION}.0"
16
+ gem.version = "#{Sauce::MAJOR_VERSION}.1"
17
+
18
+
19
+ gem.add_dependency('sauce', ">= #{Sauce::MAJOR_VERSION}.0")
20
+ gem.add_dependency('jasmine', '>= 1.2.0')
17
21
  end
@@ -75,12 +75,17 @@ module Sauce
75
75
 
76
76
  @browser = Sauce::Selenium2.new
77
77
  at_exit do
78
- @browser.quit if @browser
79
- $sauce_tunnel.disconnect if $sauce_tunnel
78
+ finish!
80
79
  end
81
80
  end
82
81
  @browser
83
82
  end
83
+
84
+ def finish!
85
+ @browser.quit if @browser
86
+ @browser = nil
87
+ $sauce_tunnel.disconnect if $sauce_tunnel
88
+ end
84
89
  end
85
90
  end
86
91
  end
data/lib/sauce/config.rb CHANGED
@@ -33,7 +33,8 @@ module Sauce
33
33
 
34
34
  ENVIRONMENT_VARIABLES = %w{SAUCE_HOST SAUCE_PORT SAUCE_BROWSER_URL SAUCE_USERNAME
35
35
  SAUCE_ACCESS_KEY SAUCE_OS SAUCE_BROWSER SAUCE_BROWSER_VERSION SAUCE_JOB_NAME
36
- SAUCE_FIREFOX_PROFILE_URL SAUCE_USER_EXTENSIONS_URL}
36
+ SAUCE_FIREFOX_PROFILE_URL SAUCE_USER_EXTENSIONS_URL
37
+ SAUCE_ONDEMAND_BROWSERS}
37
38
 
38
39
  PLATFORMS = {
39
40
  "Windows 2003" => "WINDOWS",
@@ -251,6 +252,11 @@ module Sauce
251
252
  opts['SAUCE_BROWSER_URL'] = "http://#{env['URL']}/"
252
253
  end
253
254
 
255
+ if env.include? 'SAUCE_ONDEMAND_BROWSERS'
256
+ browsers = JSON.parse(env['SAUCE_ONDEMAND_BROWSERS'])
257
+ opts[:browsers] = browsers.map { |x| [x['os'], x['browser'], x['browser-version']] }
258
+ end
259
+
254
260
  if env.include? 'SAUCE_BROWSERS'
255
261
  browsers = JSON.parse(env['SAUCE_BROWSERS'])
256
262
  opts[:browsers] = browsers.map { |x| [x['os'], x['browser'], x['version']] }
data/lib/sauce/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Sauce
3
- MAJOR_VERSION = '2.1'
3
+ MAJOR_VERSION = '2.2'
4
4
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
  require 'sauce/capybara'
3
3
 
4
4
  describe Sauce::Capybara do
@@ -37,6 +37,28 @@ describe Sauce::Capybara do
37
37
  end
38
38
 
39
39
  describe Sauce::Capybara::Driver do
40
+ let(:app) { double('Mock App for Driver') }
41
+ let(:driver) { Sauce::Capybara::Driver.new(app) }
42
+
43
+ describe '#finish' do
44
+ let(:browser) { double('Sauce::Selenium2 mock') }
45
+
46
+ before :each do
47
+ driver.instance_variable_set(:@browser, browser)
48
+ end
49
+
50
+ it 'should quit the @browser' do
51
+ browser.should_receive(:quit)
52
+ driver.finish!
53
+ end
54
+
55
+ it 'should nil out @browser' do
56
+ browser.stub(:quit)
57
+ driver.finish!
58
+ expect(driver.instance_variable_get(:@browser)).to be_nil
59
+ end
60
+ end
61
+
40
62
  describe '#browser' do
41
63
  before :each do
42
64
  # Stub out the selenium driver startup
@@ -49,70 +71,62 @@ describe Sauce::Capybara do
49
71
  c[:start_tunnel] = false
50
72
  end
51
73
 
52
- driver = Sauce::Capybara::Driver.new(nil)
53
74
  driver.browser
54
75
  end
55
76
  end
56
77
  end
57
- context 'with a mock app' do
58
- let(:app) { double('Mock App for Driver') }
59
-
60
- subject do
61
- Sauce::Capybara::Driver.new(app)
62
- end
63
78
 
64
- describe '#find' do
65
- let(:selector) { '#lol' }
79
+ describe '#find' do
80
+ let(:selector) { '#lol' }
66
81
 
67
- context 'with an environment override' do
68
- before :each do
69
- ENV['SAUCE_DISABLE_RETRY'] = '1'
70
- end
82
+ context 'with an environment override' do
83
+ before :each do
84
+ ENV['SAUCE_DISABLE_RETRY'] = '1'
85
+ end
71
86
 
72
- it 'should not retry and raise the error' do
73
- subject.should_receive(:base_find).with(selector).and_raise(Selenium::WebDriver::Error::UnknownError)
87
+ it 'should not retry and raise the error' do
88
+ driver.should_receive(:base_find).with(selector).and_raise(Selenium::WebDriver::Error::UnknownError)
74
89
 
75
90
  expect {
76
- subject.find(selector)
91
+ driver.find(selector)
77
92
  }.to raise_error(Selenium::WebDriver::Error::UnknownError)
78
- end
79
-
80
- after :each do
81
- ENV['SAUCE_DISABLE_RETRY'] = nil
82
- end
83
93
  end
84
94
 
85
- it 'should route through handle_retry' do
86
- subject.should_receive(:base_find).with(selector) # BLECH
87
- subject.find(selector)
95
+ after :each do
96
+ ENV['SAUCE_DISABLE_RETRY'] = nil
88
97
  end
98
+ end
89
99
 
90
- it 'should retry 3 times and then raise' do
91
- subject.should_receive(:base_find).with(selector).exactly(4).times.and_raise(Selenium::WebDriver::Error::UnknownError)
92
-
93
- expect {
94
- subject.find(selector)
95
- }.to raise_error(Selenium::WebDriver::Error::UnknownError)
96
- end
100
+ it 'should route through handle_retry' do
101
+ driver.should_receive(:base_find).with(selector) # BLECH
102
+ driver.find(selector)
97
103
  end
98
104
 
99
- describe '#visit' do
100
- it 'should route through #handle_retry' do
101
- path = '/lol'
102
- subject.should_receive(:base_visit).with(path)
103
- subject.visit(path)
104
- end
105
+ it 'should retry 3 times and then raise' do
106
+ driver.should_receive(:base_find).with(selector).exactly(4).times.and_raise(Selenium::WebDriver::Error::UnknownError)
107
+
108
+ expect {
109
+ driver.find(selector)
110
+ }.to raise_error(Selenium::WebDriver::Error::UnknownError)
105
111
  end
112
+ end
106
113
 
107
- describe '#current_url' do
108
- it 'should route through #handle_retry' do
109
- url = 'http://lol'
110
- subject.should_receive(:base_current_url).and_return(url)
111
- subject.current_url.should == url
112
- end
114
+ describe '#visit' do
115
+ it 'should route through #handle_retry' do
116
+ path = '/lol'
117
+ driver.should_receive(:base_visit).with(path)
118
+ driver.visit(path)
113
119
  end
120
+ end
114
121
 
122
+ describe '#current_url' do
123
+ it 'should route through #handle_retry' do
124
+ url = 'http://lol'
125
+ driver.should_receive(:base_current_url).and_return(url)
126
+ driver.current_url.should == url
127
+ end
115
128
  end
129
+
116
130
  end
117
131
 
118
132
  describe '#install_hooks' do
@@ -73,6 +73,19 @@ describe Sauce::Config do
73
73
  end
74
74
  end
75
75
 
76
+ it 'should create a browser string when running under the Jenkins plugin' do
77
+ browsers_string = "[{\"os\":\"LINUX\",\"browser\":\"opera\",\"url\":\"sauce-ondemand:?os=Linux&browser=opera&browser-version=12\",\"browser-version\":\"12\"}]"
78
+ browsers = JSON.parse(browsers_string)
79
+ ENV['SAUCE_ONDEMAND_BROWSERS'] = browsers_string
80
+
81
+ config = Sauce::Config.new
82
+ result = JSON.parse(config.to_browser_string)
83
+
84
+ result['os'].should == browsers.first['os']
85
+ result['browser'].should == browsers.first['browser']
86
+ result['browser-version'].should == browsers.first['browser-version']
87
+ end
88
+
76
89
  it 'should create a browser string from the environment' do
77
90
  ENV['SAUCE_USERNAME'] = "test_user"
78
91
  ENV['SAUCE_ACCESS_KEY'] = "test_access"
metadata CHANGED
@@ -1,185 +1,138 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sauce
3
- version: !ruby/object:Gem::Version
4
- hash: 11
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.0
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 1
9
- - 0
10
- version: 2.1.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Eric Allen
14
9
  - Sean Grove
15
10
  - Steven Hazel
16
11
  - R. Tyler Croy
17
- - "Santiago Suarez Ordo\xC3\xB1ez"
12
+ - Santiago Suarez Ordoñez
18
13
  autorequire:
19
14
  bindir: bin
20
15
  cert_chain: []
21
-
22
- date: 2012-08-15 00:00:00 Z
23
- dependencies:
24
- - !ruby/object:Gem::Dependency
25
- prerelease: false
26
- version_requirements: &id001 !ruby/object:Gem::Requirement
27
- none: false
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
- version: "0"
35
- requirement: *id001
16
+ date: 2012-11-23 00:00:00.000000000 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
36
19
  name: net-http-persistent
20
+ requirement: &18044360 !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirements:
23
+ - - ! '>='
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
37
26
  type: :runtime
38
- - !ruby/object:Gem::Dependency
39
27
  prerelease: false
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
49
- requirement: *id002
28
+ version_requirements: *18044360
29
+ - !ruby/object:Gem::Dependency
50
30
  name: capybara
31
+ requirement: &18059040 !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
51
37
  type: :runtime
52
- - !ruby/object:Gem::Dependency
53
38
  prerelease: false
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
63
- requirement: *id003
39
+ version_requirements: *18059040
40
+ - !ruby/object:Gem::Dependency
64
41
  name: rest-client
42
+ requirement: &18057940 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
65
48
  type: :runtime
66
- - !ruby/object:Gem::Dependency
67
49
  prerelease: false
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
77
- requirement: *id004
50
+ version_requirements: *18057940
51
+ - !ruby/object:Gem::Dependency
78
52
  name: net-ssh
53
+ requirement: &18056540 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
79
59
  type: :runtime
80
- - !ruby/object:Gem::Dependency
81
60
  prerelease: false
82
- version_requirements: &id005 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
- version: "0"
91
- requirement: *id005
61
+ version_requirements: *18056540
62
+ - !ruby/object:Gem::Dependency
92
63
  name: net-ssh-gateway
64
+ requirement: &18055200 !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
93
70
  type: :runtime
94
- - !ruby/object:Gem::Dependency
95
71
  prerelease: false
96
- version_requirements: &id006 !ruby/object:Gem::Requirement
72
+ version_requirements: *18055200
73
+ - !ruby/object:Gem::Dependency
74
+ name: selenium-webdriver
75
+ requirement: &18053940 !ruby/object:Gem::Requirement
97
76
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 31
102
- segments:
103
- - 0
104
- - 1
105
- - 2
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
106
80
  version: 0.1.2
107
- requirement: *id006
108
- name: selenium-webdriver
109
81
  type: :runtime
110
- - !ruby/object:Gem::Dependency
111
82
  prerelease: false
112
- version_requirements: &id007 !ruby/object:Gem::Requirement
83
+ version_requirements: *18053940
84
+ - !ruby/object:Gem::Dependency
85
+ name: childprocess
86
+ requirement: &18052240 !ruby/object:Gem::Requirement
113
87
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- hash: 23
118
- segments:
119
- - 0
120
- - 1
121
- - 6
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
122
91
  version: 0.1.6
123
- requirement: *id007
124
- name: childprocess
125
92
  type: :runtime
126
- - !ruby/object:Gem::Dependency
127
93
  prerelease: false
128
- version_requirements: &id008 !ruby/object:Gem::Requirement
94
+ version_requirements: *18052240
95
+ - !ruby/object:Gem::Dependency
96
+ name: json
97
+ requirement: &18066500 !ruby/object:Gem::Requirement
129
98
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 31
134
- segments:
135
- - 1
136
- - 2
137
- - 0
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
138
102
  version: 1.2.0
139
- requirement: *id008
140
- name: json
141
103
  type: :runtime
142
- - !ruby/object:Gem::Dependency
143
104
  prerelease: false
144
- version_requirements: &id009 !ruby/object:Gem::Requirement
105
+ version_requirements: *18066500
106
+ - !ruby/object:Gem::Dependency
107
+ name: cmdparse
108
+ requirement: &18063760 !ruby/object:Gem::Requirement
145
109
  none: false
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- hash: 11
150
- segments:
151
- - 2
152
- - 0
153
- - 2
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
154
113
  version: 2.0.2
155
- requirement: *id009
156
- name: cmdparse
157
114
  type: :runtime
158
- - !ruby/object:Gem::Dependency
159
115
  prerelease: false
160
- version_requirements: &id010 !ruby/object:Gem::Requirement
116
+ version_requirements: *18063760
117
+ - !ruby/object:Gem::Dependency
118
+ name: highline
119
+ requirement: &18061180 !ruby/object:Gem::Requirement
161
120
  none: false
162
- requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- hash: 3
166
- segments:
167
- - 1
168
- - 5
169
- - 0
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
170
124
  version: 1.5.0
171
- requirement: *id010
172
- name: highline
173
125
  type: :runtime
174
- description: A Ruby helper for running tests in Sauce OnDemand, Sauce Labs' browsers in the cloud service
126
+ prerelease: false
127
+ version_requirements: *18061180
128
+ description: A Ruby helper for running tests in Sauce OnDemand, Sauce Labs' browsers
129
+ in the cloud service
175
130
  email: help@saucelabs.com
176
- executables:
131
+ executables:
177
132
  - sauce
178
133
  extensions: []
179
-
180
134
  extra_rdoc_files: []
181
-
182
- files:
135
+ files:
183
136
  - .document
184
137
  - .gitignore
185
138
  - Gemfile
@@ -229,43 +182,34 @@ files:
229
182
  - spec/sauce/selenium_spec.rb
230
183
  - spec/spec_helper.rb
231
184
  - support/Sauce-Connect.jar
232
- - test/helper.rb
233
- - test/test_integrations.rb
234
- - test/test_testcase.rb
235
185
  homepage: http://github.com/saucelabs/sauce_ruby
236
186
  licenses: []
237
-
238
187
  post_install_message:
239
188
  rdoc_options: []
240
-
241
- require_paths:
189
+ require_paths:
242
190
  - lib
243
- required_ruby_version: !ruby/object:Gem::Requirement
191
+ required_ruby_version: !ruby/object:Gem::Requirement
244
192
  none: false
245
- requirements:
246
- - - ">="
247
- - !ruby/object:Gem::Version
248
- hash: 3
249
- segments:
193
+ requirements:
194
+ - - ! '>='
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ segments:
250
198
  - 0
251
- version: "0"
252
- required_rubygems_version: !ruby/object:Gem::Requirement
199
+ hash: 2117623043430577993
200
+ required_rubygems_version: !ruby/object:Gem::Requirement
253
201
  none: false
254
- requirements:
255
- - - ">="
256
- - !ruby/object:Gem::Version
257
- hash: 3
258
- segments:
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ segments:
259
207
  - 0
260
- version: "0"
208
+ hash: 2117623043430577993
261
209
  requirements: []
262
-
263
210
  rubyforge_project:
264
211
  rubygems_version: 1.8.10
265
212
  signing_key:
266
213
  specification_version: 3
267
214
  summary: A Ruby helper for running tests in Sauce OnDemand
268
- test_files:
269
- - test/test_testcase.rb
270
- - test/test_integrations.rb
271
- - test/helper.rb
215
+ test_files: []
data/test/helper.rb DELETED
@@ -1,35 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'net/telnet'
4
- require 'fileutils'
5
-
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
- $LOAD_PATH.unshift(File.dirname(__FILE__))
8
- require 'sauce'
9
-
10
- include Sauce::Utilities
11
-
12
- Sauce.config do |config|
13
- config.browsers = [
14
- ["Windows 2003", "firefox", "3.6."],
15
- ["Windows 2003", "iexplore", "8."]
16
- ]
17
- config.browser_url = "http://saucelabs.com"
18
-
19
- #config.application_host = "localhost"
20
- #config.application_port = "4444"
21
- end
22
-
23
- def ensure_rvm_installed
24
- rvm_executable = File.expand_path("~/.rvm/bin/rvm")
25
- if File.exist? rvm_executable
26
- unless defined?(RVM)
27
- rvm_lib_path = File.expand_path("~/.rvm/lib")
28
- $LOAD_PATH.unshift(rvm_lib_path) unless $LOAD_PATH.include?(rvm_lib_path)
29
- require 'rvm'
30
- end
31
- else
32
- raise "You do not have RVM installed. It is required for the integration tests.\n" +
33
- "Please install it from http://rvm.beginrescueend.com/"
34
- end
35
- end
@@ -1,202 +0,0 @@
1
- require File.expand_path("../helper.rb", __FILE__)
2
-
3
- class TestIntegrations < Test::Unit::TestCase
4
- @@globally_setup = false
5
-
6
- def setup
7
- if !@@globally_setup
8
- ensure_rvm_installed
9
- Dir.chdir File.expand_path("../..", __FILE__) do
10
- silence_stream(STDOUT) do
11
- system("gem build sauce.gemspec")
12
- end
13
- end
14
- ENV['SAUCE_GEM'] = File.expand_path("../../"+Dir.entries(".").select {|f| f =~ /sauce-.*.gem/}.sort.last, __FILE__)
15
- @@globally_setup = true
16
- end
17
- end
18
-
19
- def run_with_ruby(ruby_version, test)
20
- ruby_version = RVM.list_strings.find {|version| version =~ /#{ruby_version}/}
21
- if ruby_version.nil?
22
- RVM.install ruby_version
23
- ruby_version = RVM.list_strings.find {|version| version =~ /#{ruby_version}/}
24
- end
25
-
26
- gemset_name = "saucegem_#{test.to_s}"
27
- rubie = RVM.environment(ruby_version)
28
- rubie.gemset.create gemset_name
29
- begin
30
- rubie = RVM.environment("#{ruby_version}@#{gemset_name}")
31
- send(test, rubie)
32
- ensure
33
- rubie.gemset.delete gemset_name
34
- end
35
- end
36
-
37
- def run_in_environment(env, command)
38
- result = env.run(command)
39
- assert result.successful?, result.stderr
40
- end
41
-
42
- def in_tempdir
43
- oldwd = Dir.pwd
44
- temp = File.join(Dir.tmpdir, "sauce_gem_integration_test_#{rand(100000)}")
45
- Dir.mkdir(temp)
46
- Dir.chdir(temp)
47
- begin
48
- yield temp
49
- ensure
50
- Dir.chdir(oldwd)
51
- FileUtils.remove_dir(temp)
52
- end
53
- end
54
-
55
- def with_rails_3_environment(env)
56
- in_tempdir do |temp|
57
- run_in_environment(env, "gem install rails --no-rdoc --no-ri")
58
- run_in_environment(env, "rails new rails3_testapp")
59
- Dir.chdir("rails3_testapp")
60
- run_in_environment(env, "bundle install")
61
- run_in_environment(env, "rake db:migrate")
62
- yield
63
- end
64
- end
65
-
66
- def with_rails_2_environment(env)
67
- in_tempdir do |temp|
68
- run_in_environment(env, "gem install rails -v 2.3.10 --no-rdoc --no-ri")
69
- run_in_environment(env, "gem install sqlite3 --no-rdoc --no-ri")
70
- run_in_environment(env, "rails rails2_testapp")
71
- Dir.chdir("rails2_testapp")
72
- run_in_environment(env, "rake db:migrate")
73
- yield
74
- end
75
- end
76
-
77
- def recipe_rails3_testunit(env)
78
- with_rails_3_environment(env) do
79
- # Add some Sauce
80
- open("Gemfile", 'a') do |f|
81
- f.puts "gem 'sauce'"
82
- end
83
- run_in_environment(env, "gem install \"$SAUCE_GEM\" --no-rdoc --no-ri")
84
- run_in_environment(env, "bundle install")
85
- run_in_environment(env, "rails generate sauce:install #{ENV['SAUCE_USERNAME']} #{ENV['SAUCE_ACCESS_KEY']}")
86
-
87
- open("test/selenium/demo_test.rb", 'wb') do |file|
88
- file.write(<<-EOF)
89
- require "test_helper"
90
-
91
- class DemoTest < Sauce::RailsTestCase
92
- test "my app" do
93
- page.open "/"
94
- assert page.is_text_present("Welcome aboard")
95
- end
96
- end
97
- EOF
98
- end
99
-
100
- run_in_environment(env, "rake test:selenium:sauce")
101
- run_in_environment(env, "rake test:selenium:local") unless ENV['SAUCE_TEST_NO_LOCAL']
102
- end
103
- end
104
-
105
- def recipe_rails3_rspec(env)
106
- with_rails_3_environment(env) do
107
- open("Gemfile", 'a') do |f|
108
- f.puts "gem 'sauce'"
109
- f.puts "gem 'rspec-rails'"
110
- end
111
- run_in_environment(env, "gem install \"$SAUCE_GEM\" --no-rdoc --no-ri")
112
- run_in_environment(env, "bundle install")
113
- run_in_environment(env, "rails generate rspec:install")
114
-
115
- # Add some Sauce
116
- run_in_environment(env, "rails generate sauce:install #{ENV['SAUCE_USERNAME']} #{ENV['SAUCE_ACCESS_KEY']}")
117
-
118
- open("spec/selenium/demo_spec.rb", 'wb') do |file|
119
- file.write(<<-EOF)
120
- require "spec_helper"
121
-
122
- describe "my app" do
123
- it "should have a home page" do
124
- page.open "/"
125
- page.is_text_present("Welcome aboard").should be_true
126
- end
127
- end
128
- EOF
129
- end
130
-
131
- run_in_environment(env, "rake spec:selenium:sauce")
132
- run_in_environment(env, "rake spec:selenium:local") unless ENV['SAUCE_TEST_NO_LOCAL']
133
- end
134
- end
135
-
136
- def recipe_rails2_testunit(env)
137
- with_rails_2_environment(env) do
138
- run_in_environment(env, "gem install \"$SAUCE_GEM\" --no-rdoc --no-ri")
139
- run_in_environment(env, "script/generate sauce #{ENV['SAUCE_USERNAME']} #{ENV['SAUCE_ACCESS_KEY']}")
140
-
141
- open("test/selenium/demo_test.rb", 'wb') do |file|
142
- file.write(<<-EOF)
143
- require "test_helper"
144
-
145
- class DemoTest < Sauce::RailsTestCase
146
- test "my app" do
147
- page.open "/"
148
- assert page.is_text_present("Welcome aboard")
149
- end
150
- end
151
- EOF
152
- end
153
-
154
- run_in_environment(env, "rake test:selenium:sauce")
155
- run_in_environment(env, "rake test:selenium:local") unless ENV['SAUCE_TEST_NO_LOCAL']
156
- end
157
- end
158
-
159
- def recipe_rails2_rspec(env)
160
- with_rails_2_environment(env) do
161
-
162
- run_in_environment(env, "gem install rspec-rails -v '< 2' --no-rdoc --no-ri")
163
- if env.environment_name =~ /^ruby-1.9.*/
164
- # newer versions of hoe get angry
165
- run_in_environment(env, "gem install hoe -v 1.5.1 --no-rdoc --no-ri")
166
- # this is a strange dependency...
167
- run_in_environment(env, "gem install test-unit -v 1.2.3 --no-rdoc --no-ri")
168
- end
169
- run_in_environment(env, "script/generate rspec")
170
-
171
- # Add some Sauce
172
- run_in_environment(env, "gem install \"$SAUCE_GEM\" --no-rdoc --no-ri")
173
- run_in_environment(env, "script/generate sauce #{ENV['SAUCE_USERNAME']} #{ENV['SAUCE_ACCESS_KEY']}")
174
-
175
- open("spec/selenium/demo_spec.rb", 'wb') do |file|
176
- file.write(<<-EOF)
177
- require "spec_helper"
178
-
179
- describe "my app" do
180
- it "should have a home page" do
181
- page.open "/"
182
- page.is_text_present("Welcome aboard").should be_true
183
- end
184
- end
185
- EOF
186
- end
187
-
188
- run_in_environment(env, "rake spec:selenium:sauce --trace")
189
- run_in_environment(env, "rake spec:selenium:local") unless ENV['SAUCE_TEST_NO_LOCAL']
190
- end
191
- end
192
-
193
- # Turn the recipes into tests
194
- self.instance_methods(false).select {|m| m =~ /recipe_.*/ }.each do |recipe|
195
- define_method(("test_ruby18_"+recipe).to_sym) do
196
- run_with_ruby("ruby-1.8.7", recipe.to_sym)
197
- end
198
- define_method(("test_ruby19_"+recipe).to_sym) do
199
- run_with_ruby("ruby-1.9.2", recipe.to_sym)
200
- end
201
- end
202
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path("../helper", __FILE__)
2
-
3
- class TestSauceTestCase < Sauce::TestCase
4
- self.selenium_flags = {:trustAllSSLCertificates => false}
5
- self.sauce_config = {:browser_url => "https://cacert.org"}
6
-
7
- def test_turning_off_trustAllSSLCertificates
8
- selenium.set_timeout("5000")
9
- assert_raise Selenium::Client::CommandError do
10
- selenium.open("https://cacert.org")
11
- end
12
- end
13
- end