Use Sauce Labs to test Jasmine against a metric ton of browsers

This commit is contained in:
Greg Cobb and JR Boyens
2013-07-19 11:29:12 -07:00
parent 89a54ea2bb
commit d40e0cebac
3 changed files with 67 additions and 22 deletions

View File

@@ -1,26 +1,39 @@
---
before_install:
- "export DISPLAY=:99.0"
- "sudo mkdir -p /etc/init.d/"
- "sudo touch /etc/init.d/xvfb"
- "sh -e /etc/init.d/xvfb start"
#- "sh -e travis-chromium-script.sh"
script: "DISPLAY=:99.0 bundle exec rake core_spec"
language:
- ruby
- objective-c
rvm: "1.9.3"
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
before_script:
- curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
script: DISPLAY=:99.0 bundle exec rake core_spec
language: ruby
rvm: 1.9.3
env:
- JASMINE_BROWSER=firefox
#- JASMINE_BROWSER=chrome
- JASMINE_BROWSER=phantomjs
global:
- USE_SAUCE=true
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
- secure: WSPWhlnC4mWSnSPquX+m1/BCu5ch5NygkaHuM2Nea7lD8oS3XLX8QncZZAsQ4lnNfqoDDuBOizG0AESiqNvE4y6x5qvLLTS6q+ce255ZEMZ71TBdZgDEEvGMEjOPPsVXiXyTQOP1lwOPlrbZvaPgWV7e11KIBab6DfFcQpnvDgo=
- secure: SW7CJhZnwaNT749Gdnhvqb5rbXlAOsygUAzh9qhtyvbqXKkmJdBIEsO01YF6pbju1X2twE9JvWCOxeZju43NgQChJlPsGbjY2j3k/TdQeTAJesQe2K7ytwghunI30gjEovtRH0T3w1EmcKPH8yj5eBIcB2OYoJHx8KEC7e68q1g=
matrix:
allow_failures:
#- env: JASMINE_BROWSER=chrome
- env: JASMINE_BROWSER=phantomjs
- env: JASMINE_BROWSER=phantomjs
include:
- language: objective-c
env: JASMINE_BROWSER=safari
- JASMINE_BROWSER=firefox
SAUCE_PLATFORM=Linux
SAUCE_VERSION=''
- JASMINE_BROWSER=safari
SAUCE_PLATFORM="OS X 10.8"
SAUCE_VERSION=''
- JASMINE_BROWSER="internet explorer"
SAUCE_PLATFORM="Windows 8"
SAUCE_VERSION=10
- JASMINE_BROWSER="internet explorer"
SAUCE_PLATFORM="Windows 7"
SAUCE_VERSION=9
- JASMINE_BROWSER="internet explorer"
SAUCE_PLATFORM="Windows 7"
SAUCE_VERSION=8
- JASMINE_BROWSER=chrome
SAUCE_PLATFORM=Linux
SAUCE_VERSION=''
- JASMINE_BROWSER=phantomjs
USE_SAUCE=false

View File

@@ -23,4 +23,5 @@ Gem::Specification.new do |s|
s.add_development_dependency "fuubar"
s.add_development_dependency "awesome_print"
s.add_development_dependency "nokogiri"
s.add_development_dependency "sauce-connect"
end

View File

@@ -4,8 +4,39 @@ require 'jasmine'
Jasmine.load_configuration_from_yaml(File.join(Dir.pwd, 'spec', 'jasmine.yml'))
config = Jasmine.config
browser = ENV['JASMINE_BROWSER'] || 'firefox'
if ENV['USE_SAUCE'] == 'true'
require 'selenium-webdriver'
unless ENV['TRAVIS_BUILD_NUMBER']
require 'sauce/connect'
# we want Sauce Connect locally, not on Travis
Sauce::Connect.connect!
end
username = ENV['SAUCE_USERNAME']
key = ENV['SAUCE_ACCESS_KEY']
platform = ENV['SAUCE_PLATFORM']
version = ENV['SAUCE_VERSION']
url = "http://#{username}:#{key}@localhost:4445/wd/hub"
config.port = 5555
webdriver = Selenium::WebDriver.for :remote, :url => url, :desired_capabilities => {
:platform => platform,
:version => version,
:build => ENV['TRAVIS_BUILD_NUMBER'],
:tags => [ENV['TRAVIS_RUBY_VERSION'], 'CI'],
:browserName => browser
}
end
Jasmine.configure do |config|
config.browser = ENV['JASMINE_BROWSER'] || 'firefox'
config.webdriver = webdriver if webdriver
config.browser = browser if browser
end
server = Jasmine::Server.new(config.port, Jasmine::Application.app(config))
driver = Jasmine::SeleniumDriver.new(config.browser, "#{config.host}:#{config.port}/")