sauce 2.2.2 → 2.3.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/bin/sauce +6 -2
- data/lib/sauce.rb +0 -1
- data/lib/sauce/capybara.rb +7 -1
- data/lib/sauce/config.rb +4 -4
- data/lib/sauce/version.rb +1 -1
- data/spec/integration/connect_integration_spec.rb +3 -1
- data/spec/sauce/capybara_spec.rb +5 -3
- data/spec/sauce/config_spec.rb +34 -1
- data/spec/spec_helper.rb +5 -3
- metadata +89 -64
- data/.document +0 -5
- data/.gitignore +0 -30
- data/Gemfile +0 -16
- data/LICENSE +0 -19
- data/README.markdown +0 -67
- data/Rakefile +0 -102
- data/gemfiles/rails2.gemfile +0 -10
- data/gemfiles/rails2.gemfile.lock +0 -77
- data/gemfiles/rails3.gemfile +0 -9
- data/gemfiles/rails3.gemfile.lock +0 -137
- data/gems/sauce-cucumber/.gitignore +0 -17
- data/gems/sauce-cucumber/README.md +0 -29
- data/gems/sauce-cucumber/Rakefile +0 -2
- data/gems/sauce-cucumber/lib/sauce/cucumber.rb +0 -121
- data/gems/sauce-cucumber/sauce-cucumber.gemspec +0 -20
- data/gems/sauce-jasmine/.gitignore +0 -17
- data/gems/sauce-jasmine/README.md +0 -29
- data/gems/sauce-jasmine/Rakefile +0 -2
- data/gems/sauce-jasmine/lib/sauce/jasmine.rb +0 -35
- data/gems/sauce-jasmine/lib/sauce/jasmine/rake.rb +0 -47
- data/gems/sauce-jasmine/lib/sauce/jasmine/runner.rb +0 -4
- data/gems/sauce-jasmine/sauce-jasmine.gemspec +0 -21
- data/generators/sauce/sauce_generator.rb +0 -57
- data/generators/sauce/templates/sauce.rake +0 -1
- data/lib/generators/sauce/install/templates/sauce.rake +0 -1
- data/lib/sauce/connect.rb +0 -112
- data/sauce.gemspec +0 -29
- data/support/Sauce-Connect.jar +0 -0
@@ -1,29 +0,0 @@
|
|
1
|
-
# Sauce::Cucumber
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'sauce-cucumber'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install sauce-cucumber
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
|
-
## Contributing
|
24
|
-
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
@@ -1,121 +0,0 @@
|
|
1
|
-
require 'capybara'
|
2
|
-
require 'cucumber'
|
3
|
-
require 'sauce/job'
|
4
|
-
require 'sauce/capybara'
|
5
|
-
|
6
|
-
module Sauce
|
7
|
-
module Capybara
|
8
|
-
module Cucumber
|
9
|
-
def use_sauce_driver
|
10
|
-
::Capybara.current_driver = :sauce
|
11
|
-
end
|
12
|
-
module_function :use_sauce_driver
|
13
|
-
|
14
|
-
def name_from_scenario(scenario)
|
15
|
-
# Special behavior to handle Scenario Outlines
|
16
|
-
if scenario.instance_of? ::Cucumber::Ast::OutlineTable::ExampleRow
|
17
|
-
table = scenario.instance_variable_get(:@table)
|
18
|
-
outline = table.instance_variable_get(:@scenario_outline)
|
19
|
-
return "#{outline.feature.file} - #{outline.title} - #{table.headers} -> #{scenario.name}"
|
20
|
-
end
|
21
|
-
scenario, feature = _scenario_and_feature_name(scenario)
|
22
|
-
return "#{feature} - #{scenario}"
|
23
|
-
end
|
24
|
-
module_function :name_from_scenario
|
25
|
-
|
26
|
-
def jenkins_name_from_scenario(scenario)
|
27
|
-
# Special behavior to handle Scenario Outlines
|
28
|
-
if scenario.instance_of? ::Cucumber::Ast::OutlineTable::ExampleRow
|
29
|
-
table = scenario.instance_variable_get(:@table)
|
30
|
-
outline = table.instance_variable_get(:@scenario_outline)
|
31
|
-
return "#{outline.feature.short_name}.#{outline.title}.#{outline.title} (outline example: #{scenario.name})"
|
32
|
-
end
|
33
|
-
scenario, feature = _scenario_and_feature_name(scenario)
|
34
|
-
return "#{feature}.#{scenario}.#{scenario}"
|
35
|
-
end
|
36
|
-
module_function :jenkins_name_from_scenario
|
37
|
-
|
38
|
-
def _scenario_and_feature_name(scenario)
|
39
|
-
scenario_name = scenario.name.split("\n").first
|
40
|
-
feature_name = scenario.feature.short_name
|
41
|
-
return scenario_name, feature_name
|
42
|
-
end
|
43
|
-
module_function :_scenario_and_feature_name
|
44
|
-
|
45
|
-
def before_hook
|
46
|
-
Sauce::Capybara::Cucumber.use_sauce_driver
|
47
|
-
end
|
48
|
-
module_function :before_hook
|
49
|
-
|
50
|
-
def using_jenkins?
|
51
|
-
# JENKINS_SERVER_COOKIE seems to be as good as any sentinel value to
|
52
|
-
# determine whether we're running under Jenkins or not.
|
53
|
-
ENV['JENKINS_SERVER_COOKIE']
|
54
|
-
end
|
55
|
-
module_function :using_jenkins?
|
56
|
-
|
57
|
-
def around_hook(scenario, block)
|
58
|
-
::Capybara.current_driver = :sauce
|
59
|
-
driver = ::Capybara.current_session.driver
|
60
|
-
# This session_id is the job ID used by Sauce Labs, we're pulling it
|
61
|
-
# off of the driver now to make sure we have it after `block.call`
|
62
|
-
session_id = driver.browser.session_id
|
63
|
-
job_name = Sauce::Capybara::Cucumber.name_from_scenario(scenario)
|
64
|
-
custom_data = {}
|
65
|
-
|
66
|
-
if using_jenkins?
|
67
|
-
custom_data.merge!({:commit => ENV['GIT_COMMIT'] || ENV['SVN_COMMIT'],
|
68
|
-
:jenkins_node => ENV['NODE_NAME'],
|
69
|
-
:jenkins_job => ENV['JOB_NAME']})
|
70
|
-
end
|
71
|
-
|
72
|
-
job = Sauce::Job.new('id' => session_id,
|
73
|
-
'name' => job_name,
|
74
|
-
'custom-data' => custom_data)
|
75
|
-
job.save unless job.nil?
|
76
|
-
|
77
|
-
Sauce.config do |c|
|
78
|
-
c[:name] = Sauce::Capybara::Cucumber.name_from_scenario(scenario)
|
79
|
-
end
|
80
|
-
|
81
|
-
if using_jenkins?
|
82
|
-
# If we're running under Jenkins, we should dump the
|
83
|
-
# `SauceOnDemandSessionID` into the Console Output for the Sauce OnDemand
|
84
|
-
# Jenkins plugin.
|
85
|
-
# See: <https://github.com/saucelabs/sauce_ruby/issues/48>
|
86
|
-
output = []
|
87
|
-
output << "\nSauceOnDemandSessionID=#{session_id}"
|
88
|
-
# The duplication in the scenario_name comes from the fact that the
|
89
|
-
# JUnit formatter seems to do the same, so in order to get the sauce
|
90
|
-
# OnDemand plugin for Jenkins to co-operate, we need to double it up as
|
91
|
-
# well
|
92
|
-
output << "job-name=#{Sauce::Capybara::Cucumber.jenkins_name_from_scenario(scenario)}"
|
93
|
-
puts output.join(' ')
|
94
|
-
end
|
95
|
-
|
96
|
-
block.call
|
97
|
-
|
98
|
-
# Quit the driver to allow for the generation of a new session_id
|
99
|
-
driver.finish!
|
100
|
-
|
101
|
-
unless job.nil?
|
102
|
-
job.passed = !scenario.failed?
|
103
|
-
job.save
|
104
|
-
end
|
105
|
-
end
|
106
|
-
module_function :around_hook
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
|
112
|
-
begin
|
113
|
-
Before('@selenium') do
|
114
|
-
Sauce::Capybara::Cucumber.before_hook
|
115
|
-
end
|
116
|
-
|
117
|
-
Around('@selenium') do |scenario, block|
|
118
|
-
Sauce::Capybara::Cucumber.around_hook(scenario, block)
|
119
|
-
end
|
120
|
-
rescue NoMethodError # This makes me sad
|
121
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../lib/sauce/version')
|
3
|
-
|
4
|
-
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["R. Tyler Croy"]
|
6
|
-
gem.email = ["tyler@monkeypox.org"]
|
7
|
-
gem.description = ''
|
8
|
-
gem.summary = ''
|
9
|
-
gem.homepage = ""
|
10
|
-
|
11
|
-
gem.files = `git ls-files`.split($\)
|
12
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
-
gem.name = "sauce-cucumber"
|
15
|
-
gem.require_paths = ["lib"]
|
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')
|
20
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# Sauce::Jasmine
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'sauce-jasmine'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install sauce-jasmine
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
|
-
## Contributing
|
24
|
-
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
data/gems/sauce-jasmine/Rakefile
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'jasmine'
|
2
|
-
|
3
|
-
module Sauce
|
4
|
-
module Jasmine
|
5
|
-
class Driver < ::Jasmine::SeleniumDriver
|
6
|
-
attr_reader :http_address, :driver, :browser
|
7
|
-
|
8
|
-
def initialize(browser, http_address)
|
9
|
-
@browser = browser
|
10
|
-
@http_address = http_address
|
11
|
-
@driver = Sauce::Selenium2.new(:browser => browser, :job_name => job_name)
|
12
|
-
puts "Starting job named: #{job_name}"
|
13
|
-
end
|
14
|
-
|
15
|
-
def job_name
|
16
|
-
"Jasmine Test Run #{Time.now.utc.to_i}"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module Jasmine
|
23
|
-
class Config
|
24
|
-
def jasmine_port
|
25
|
-
'3001'
|
26
|
-
end
|
27
|
-
|
28
|
-
def start
|
29
|
-
@client = Sauce::Jasmine::Driver.new(browser, "#{jasmine_host}:#{jasmine_port}/")
|
30
|
-
@client.connect
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'jasmine'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
|
4
|
-
namespace :jasmine do
|
5
|
-
def run_jasmine_server
|
6
|
-
ENV['JASMINE_PORT'] = '3001'
|
7
|
-
Jasmine::Config.new.start_jasmine_server
|
8
|
-
end
|
9
|
-
|
10
|
-
desc "Execute Jasmine tests in a Chrome browser on Sauce Labs"
|
11
|
-
task :sauce do
|
12
|
-
run_jasmine_server
|
13
|
-
Rake::Task['jasmine:sauce:chrome'].execute
|
14
|
-
end
|
15
|
-
|
16
|
-
namespace :sauce do
|
17
|
-
desc "Execute Jasmine tests in Chrome, Firefox and Internet Explorer on Sauce Labs"
|
18
|
-
task :all do
|
19
|
-
run_jasmine_server
|
20
|
-
threads = []
|
21
|
-
[:firefox, :chrome, :iexplore].each do |browser|
|
22
|
-
t = Thread.new do
|
23
|
-
Rake::Task["jasmine:sauce:#{browser}"].invoke
|
24
|
-
end
|
25
|
-
t.abort_on_exception = true
|
26
|
-
threads << t
|
27
|
-
end
|
28
|
-
|
29
|
-
threads.each do |t|
|
30
|
-
t.join
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
[[:firefox, 8], [:chrome, nil], [:iexplore, 8]].each do |browser, version|
|
35
|
-
desc "Execute Jasmine tests in #{browser}"
|
36
|
-
RSpec::Core::RakeTask.new(browser) do |t|
|
37
|
-
ENV['SAUCE_BROWSER'] = browser.to_s
|
38
|
-
unless version.nil?
|
39
|
-
ENV['SAUCE_BROWSER_VERSION'] = version.to_s
|
40
|
-
end
|
41
|
-
t.rspec_opts = '--color'
|
42
|
-
t.pattern = [File.expand_path(File.dirname(__FILE__) + '/runner.rb')]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../lib/sauce/version')
|
3
|
-
|
4
|
-
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["R. Tyler Croy"]
|
6
|
-
gem.email = ["tyler@monkeypox.org"]
|
7
|
-
gem.description = ''
|
8
|
-
gem.summary = ''
|
9
|
-
gem.homepage = ""
|
10
|
-
|
11
|
-
gem.files = `git ls-files`.split($\)
|
12
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
-
gem.name = "sauce-jasmine"
|
15
|
-
gem.require_paths = ["lib"]
|
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')
|
21
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'sauce/config'
|
2
|
-
|
3
|
-
# This generator bootstraps a Rails project for use with Sauce OnDemand
|
4
|
-
class SauceGenerator < Rails::Generator::Base
|
5
|
-
def initialize(runtime_args, runtime_options = {})
|
6
|
-
config = Sauce::Config.new
|
7
|
-
if config.username.nil? || config.access_key.nil?
|
8
|
-
if runtime_args.size < 2
|
9
|
-
puts "No username or API key specified. Assuming you're using Heroku Sauce"
|
10
|
-
else
|
11
|
-
system("sauce config #{runtime_args[0]} #{runtime_args[1]}")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
|
-
def manifest
|
18
|
-
record do |m|
|
19
|
-
if File.directory? 'spec'
|
20
|
-
m.directory File.join('spec', 'selenium') if File.directory? 'spec'
|
21
|
-
m.setup_helper(File.join('spec', 'spec_helper.rb')) if File.directory? 'spec'
|
22
|
-
end
|
23
|
-
|
24
|
-
m.directory File.join('lib', 'tasks')
|
25
|
-
m.directory File.join('test', 'selenium') if File.directory? 'test'
|
26
|
-
m.file 'sauce.rake', File.join('lib', 'tasks', 'sauce.rake')
|
27
|
-
m.setup_helper(File.join('test', 'test_helper.rb')) if File.directory? 'test'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def setup_helper(file)
|
32
|
-
contents = File.read(file)
|
33
|
-
if contents !~ /Sauce.config/
|
34
|
-
File.open(file, "a") do |file|
|
35
|
-
file.write <<-CONFIG
|
36
|
-
|
37
|
-
require 'sauce'
|
38
|
-
|
39
|
-
Sauce.config do |conf|
|
40
|
-
conf.browser_url = "http://#{rand(100000)}.test/"
|
41
|
-
conf.browsers = [
|
42
|
-
["Windows 2003", "firefox", "3.6."]
|
43
|
-
]
|
44
|
-
conf.application_host = "127.0.0.1"
|
45
|
-
conf.application_port = "3001"
|
46
|
-
end
|
47
|
-
CONFIG
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
protected
|
53
|
-
|
54
|
-
def banner
|
55
|
-
"Usage: #{$0} sauce [<USERNAME> <ACCESS_KEY>]"
|
56
|
-
end
|
57
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'sauce/raketasks'
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'sauce/raketasks'
|
data/lib/sauce/connect.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'sauce/config'
|
2
|
-
|
3
|
-
module Sauce
|
4
|
-
class Connect
|
5
|
-
TIMEOUT = 90
|
6
|
-
|
7
|
-
attr_reader :status, :error
|
8
|
-
|
9
|
-
def initialize(options={})
|
10
|
-
@ready = false
|
11
|
-
@status = "uninitialized"
|
12
|
-
@error = nil
|
13
|
-
@quiet = options[:quiet]
|
14
|
-
host = options[:host] || '127.0.0.1'
|
15
|
-
port = options[:port] || '3000'
|
16
|
-
tunnel_port = options[:tunnel_port] || '80'
|
17
|
-
options.delete(:host)
|
18
|
-
options.delete(:port)
|
19
|
-
options.delete(:tunnel_port)
|
20
|
-
@config = Sauce::Config.new(options)
|
21
|
-
if @config.username.nil?
|
22
|
-
raise ArgumentError, "Username required to launch Sauce Connect. Please set the environment variable $SAUCE_USERNAME"
|
23
|
-
end
|
24
|
-
if @config.access_key.nil?
|
25
|
-
raise ArgumentError, "Access key required to launch Sauce Connect. Please set the environment variable $SAUCE_ACCESS_KEY"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def connect
|
30
|
-
puts "[Connecting to Sauce OnDemand...]"
|
31
|
-
@pipe = IO.popen("exec #{Sauce::Connect.connect_command} #{@config.username} #{@config.access_key} 2>&1")
|
32
|
-
@process_status = $?
|
33
|
-
at_exit do
|
34
|
-
Process.kill("INT", @pipe.pid)
|
35
|
-
while @ready
|
36
|
-
sleep 1
|
37
|
-
end
|
38
|
-
end
|
39
|
-
Thread.new {
|
40
|
-
while( (line = @pipe.gets) )
|
41
|
-
if line =~ /Tunnel remote VM is (.*) (\.\.|at)/
|
42
|
-
@status = $1
|
43
|
-
end
|
44
|
-
if line =~/You may start your tests\./
|
45
|
-
@ready = true
|
46
|
-
end
|
47
|
-
if line =~ /- (Problem.*)$/
|
48
|
-
@error = $1
|
49
|
-
end
|
50
|
-
if line =~ /== Missing requirements ==/
|
51
|
-
@error = "Missing requirements"
|
52
|
-
@quiet = false
|
53
|
-
end
|
54
|
-
$stderr.puts line unless @quiet
|
55
|
-
end
|
56
|
-
@ready = false
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
def wait_until_ready
|
61
|
-
start = Time.now
|
62
|
-
while !@ready and (Time.now-start) < TIMEOUT and @error != "Missing requirements"
|
63
|
-
sleep 0.5
|
64
|
-
end
|
65
|
-
|
66
|
-
if @error == "Missing requirements"
|
67
|
-
raise "Missing requirements"
|
68
|
-
end
|
69
|
-
|
70
|
-
if !@ready
|
71
|
-
raise "Sauce Connect failed to connect after #{TIMEOUT} seconds"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def disconnect
|
76
|
-
if @ready
|
77
|
-
Process.kill("INT", @pipe.pid)
|
78
|
-
while @ready
|
79
|
-
sleep 1
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def self.find_sauce_connect
|
85
|
-
File.expand_path(File.dirname(__FILE__) + '/../../support/Sauce-Connect.jar')
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.connect_command
|
89
|
-
"java -jar #{Sauce::Connect.find_sauce_connect}"
|
90
|
-
end
|
91
|
-
|
92
|
-
# Global Sauce Connect-ness
|
93
|
-
@connection = nil
|
94
|
-
|
95
|
-
def self.connect!(*args)
|
96
|
-
@connection = self.new(*args)
|
97
|
-
@connection.connect
|
98
|
-
@connection.wait_until_ready
|
99
|
-
at_exit do
|
100
|
-
@connection.disconnect
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def self.ensure_connected(*args)
|
105
|
-
if @connection
|
106
|
-
@connection.wait_until_ready
|
107
|
-
else
|
108
|
-
connect!(*args)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|