Skip to content

Commit

Permalink
[chore] Fix Saucelabs tests (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne authored Jan 22, 2017
1 parent 54c0438 commit 387be05
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 32 deletions.
35 changes: 33 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,43 @@ node_js:
- '0.10'
- '0.12'
- '4'
- 'node'
- '6'
- '7'
git:
depth: 1
notifications:
irc: "irc.freenode.org#socket.io"
matrix:
include:
- node_js: 'node'
env: BROWSERS=1
env: BROWSER_NAME=chrome BROWSER_VERSION=latest
- node_js: 'node'
env: BROWSER_NAME=safari BROWSER_VERSION=latest
- node_js: 'node'
env: BROWSER_NAME=firefox BROWSER_VERSION=latest
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=6
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=7
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=8
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=9
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=10
- node_js: 'node'
env: BROWSER_NAME=ie BROWSER_VERSION=11
- node_js: 'node'
env: BROWSER_NAME=iphone BROWSER_VERSION=8.4
- node_js: 'node'
env: BROWSER_NAME=iphone BROWSER_VERSION=9.2
- node_js: 'node'
env: BROWSER_NAME=iphone BROWSER_VERSION=10.0
- node_js: 'node'
env: BROWSER_NAME=android BROWSER_VERSION=4.4
- node_js: 'node'
env: BROWSER_NAME=android BROWSER_VERSION=5.1
- node_js: 'node'
env: BROWSER_NAME=ipad BROWSER_VERSION=9.3
- node_js: 'node'
env: BROWSER_NAME=ipad BROWSER_VERSION=10.0
15 changes: 13 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const FILES_TO_CLEAN = [
];

gulp.task('test', ['lint'], function () {
if (process.env.hasOwnProperty('BROWSERS')) {
if (process.env.hasOwnProperty('BROWSER_NAME')) {
return testZuul();
} else {
return testNode();
Expand Down Expand Up @@ -78,7 +78,18 @@ function testNode () {
// runs zuul through shell process
function testZuul () {
const ZUUL_CMD = './node_modules/zuul/bin/zuul';
const zuulChild = child.spawn(ZUUL_CMD, [ TEST_FILE ], { stdio: 'inherit' });
const args = [
'--browser-name',
process.env.BROWSER_NAME,
'--browser-version',
process.env.BROWSER_VERSION
];
if (process.env.hasOwnProperty('BROWSER_PLATFORM')) {
args.push('--browser-platform');
args.push(process.env.BROWSER_PLATFORM);
}
args.push(TEST_FILE);
const zuulChild = child.spawn(ZUUL_CMD, args, { stdio: 'inherit' });
zuulChild.on('exit', function (code) {
cleanFiles(FILES_TO_CLEAN);
process.exit(code);
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"gulp-task-listing": "1.0.1",
"istanbul": "0.2.3",
"mocha": "1.16.2",
"socket.io-browsers": "^1.0.0",
"webpack": "1.12.12",
"webpack-stream": "3.1.0",
"zuul": "3.11.0",
Expand Down
34 changes: 7 additions & 27 deletions zuul.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
'use strict';

var browsers = require('socket.io-browsers');

var zuulConfig = module.exports = {
module.exports = {
ui: 'mocha-bdd',
server: './test/support/server.js',
tunnel: {
type: 'ngrok',
authtoken: '6Aw8vTgcG5EvXdQywVvbh_3fMxvd4Q7dcL2caAHAFjV',
proto: 'tcp'
},
builder: 'zuul-builder-webpack',
webpack: require('./support/webpack.config.js'),

// test on localhost by default
local: true,

concurrency: 2, // ngrok only accepts two tunnels by default
// if browser does not sends output in 120s since last output:
// stop testing, something is wrong
browser_output_timeout: 120 * 1000,
browser_open_timeout: 60 * 4 * 1000,
// we want to be notified something is wrong asap, so no retry
browser_retries: 1
webpack: require('./support/webpack.config.js')
};

if (process.env.CI === 'true') {
zuulConfig.local = false;
zuulConfig.tunnel = {
type: 'ngrok',
bind_tls: true
};
}

var isPullRequest = process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST !== 'false';
zuulConfig.browsers = isPullRequest ? browsers.pullRequest : browsers.all;

0 comments on commit 387be05

Please sign in to comment.