Skip to content

Instantly share code, notes, and snippets.

@AlphaGit
Last active August 29, 2015 14:26
Show Gist options
  • Save AlphaGit/0f9e8bb35dd32a927477 to your computer and use it in GitHub Desktop.
Save AlphaGit/0f9e8bb35dd32a927477 to your computer and use it in GitHub Desktop.
Configuring Protractor to run on Travis and SauceLabs
language: node_js
sudo: false
cache:
directories:
- node_modules
- bower_components
- $(npm config get prefix)/bin/grunt-cli
- $(npm config get prefix)/bin/bower
node_js:
- 0.10
before_script:
- npm list -g grunt-cli --depth=0 || npm install -g grunt-cli
- npm list -g bower --depth=0 || npm install -g bower
- bower install
# used for Firefox and Chrome to work
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- ./node_modules/protractor/bin/webdriver-manager update
script:
- npm run test-travis
env:
global:
- secure: <SAUCE_USERNAME=[secure]>
- secure: <SAUCE_ACCESS_KEY=[secure]>
addons:
sauce_connect: true
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
// ...
protractor: {
// ...
travis: {
options: {
configFile: 'protractor-travis-conf.js',
args: { }
}
}
}
});
// ...
grunt.registerTask('test:travis', ['connect', 'protractor:travis']);
};
{
"scripts": {
"test-travis": "grunt test:travis"
}
}
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
specs: ['test/*.js'],
baseUrl: 'http://localhost:9001',
jasmineNodeOpts: {
showColors: true,
isVerbose: true,
realtimeFailure: true,
includeStackTrace: true,
defaultTimeoutInterval: 30000
},
multiCapabilities: [{
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
build: process.env.TRAVIS_BUILD_NUMBER,
name: 'ng-pattern-restrict Chrome build ' + process.env.TRAVIS_BUILD_NUMBER,
browserName: 'chrome',
shardTestFiles: true,
maxInstances: 5,
seleniumVersion: '2.46.0'
}, {
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
build: process.env.TRAVIS_BUILD_NUMBER,
name: 'ng-pattern-restrict Firefox build ' + process.env.TRAVIS_BUILD_NUMBER,
browserName: 'firefox',
shardTestFiles: true,
maxInstances: 5,
seleniumVersion: '2.46.0'
}, {
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
build: process.env.TRAVIS_BUILD_NUMBER,
name: 'ng-pattern-restrict IE build ' + process.env.TRAVIS_BUILD_NUMBER,
browserName: 'internet explorer',
shardTestFiles: true,
maxInstances: 5,
seleniumVersion: '2.46.0'
}, /*
// can't support automation in Opera until Selenium Opera Web Driver supports
// async script execution.
// See: https://github.com/angular/protractor/issues/226
// See: https://github.com/operasoftware/operaprestodriver/issues/97
{
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
build: process.env.TRAVIS_BUILD_NUMBER,
name: 'ng-pattern-restrict Opera build ' + process.env.TRAVIS_BUILD_NUMBER,
browserName: 'opera',
shardTestFiles: true,
maxInstances: 5,
seleniumVersion: '2.46.0'
}, */{
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
build: process.env.TRAVIS_BUILD_NUMBER,
name: 'ng-pattern-restrict Safari build ' + process.env.TRAVIS_BUILD_NUMBER,
browserName: 'safari',
shardTestFiles: true,
maxInstances: 5,
seleniumVersion: '2.46.0'
}, {
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
build: process.env.TRAVIS_BUILD_NUMBER,
name: 'ng-pattern-restrict iOS build ' + process.env.TRAVIS_BUILD_NUMBER,
browserName: 'iphone',
shardTestFiles: true,
maxInstances: 5,
seleniumVersion: '2.46.0'
}, {
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
build: process.env.TRAVIS_BUILD_NUMBER,
name: 'ng-pattern-restrict Android build ' + process.env.TRAVIS_BUILD_NUMBER,
browserName: 'android',
shardTestFiles: true,
maxInstances: 5,
seleniumVersion: '2.46.0'
}]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment