From ae42d5eadb56059ef86b4ff0751d56318aa6c52d Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Fri, 30 Dec 2016 17:46:09 +0100 Subject: [PATCH] Update zuul config to speed up tests in browser --- .travis.yml | 34 ++-------------------------------- .zuul.yml | 5 ----- Makefile | 16 +++------------- package.json | 1 + zuul.config.js | 29 +++++++++++++++++++++++++++++ 5 files changed, 35 insertions(+), 50 deletions(-) delete mode 100644 .zuul.yml create mode 100644 zuul.config.js diff --git a/.travis.yml b/.travis.yml index 0238770..f238e60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,35 +11,5 @@ git: depth: 1 matrix: include: - - node_js: '0.12' - env: BROWSER_NAME=chrome BROWSER_VERSION=latest - - node_js: '0.12' - env: BROWSER_NAME=safari BROWSER_VERSION=latest - - node_js: '0.12' - env: BROWSER_NAME=firefox BROWSER_VERSION=latest BROWSER_PLATFORM="Windows 10" - - node_js: '0.12' - env: BROWSER_NAME=ie BROWSER_VERSION=6 - - node_js: '0.12' - env: BROWSER_NAME=ie BROWSER_VERSION=7 - - node_js: '0.12' - env: BROWSER_NAME=ie BROWSER_VERSION=8 - - node_js: '0.12' - env: BROWSER_NAME=ie BROWSER_VERSION=9 - - node_js: '0.12' - env: BROWSER_NAME=ie BROWSER_VERSION=10 BROWSER_PLATFORM="Windows 2012" - - node_js: '0.12' - env: BROWSER_NAME=ie BROWSER_VERSION=latest BROWSER_PLATFORM="Windows 2012" - - node_js: '0.12' - env: BROWSER_NAME=microsoftedge BROWSER_VERSION=13 BROWSER_PLATFORM="Windows 10" - - node_js: '0.12' - env: BROWSER_NAME=iphone BROWSER_VERSION=8.4 - - node_js: '0.12' - env: BROWSER_NAME=iphone BROWSER_VERSION=9.2 - - node_js: '0.12' - env: BROWSER_NAME=android BROWSER_VERSION=4.3 - - node_js: '0.12' - env: BROWSER_NAME=android BROWSER_VERSION=4.4 - - node_js: '0.12' - env: BROWSER_NAME=android BROWSER_VERSION=5.1 - - node_js: '0.12' - env: BROWSER_NAME=android BROWSER_VERSION=latest + - node_js: 'node' + env: BROWSERS=1 diff --git a/.zuul.yml b/.zuul.yml deleted file mode 100644 index 2cc4b3c..0000000 --- a/.zuul.yml +++ /dev/null @@ -1,5 +0,0 @@ -ui: mocha-bdd -tunnel: - type: ngrok - authtoken: 6Aw8vTgcG5EvXdQywVvbh_3fMxvd4Q7dcL2caAHAFjV - proto: tcp diff --git a/Makefile b/Makefile index 80912ed..2942f60 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ REPORTER = dot test: - @if [ "x$(BROWSER_NAME)" = "x" ]; then make test-node; else make test-zuul; fi + @if [ "x$(BROWSERS)" = "x" ]; then make test-node; else make test-zuul; fi test-node: @./node_modules/.bin/mocha \ @@ -11,17 +11,7 @@ test-node: test/index.js test-zuul: - @if [ "x$(BROWSER_PLATFORM)" = "x" ]; then \ - ./node_modules/zuul/bin/zuul \ - --browser-name $(BROWSER_NAME) \ - --browser-version $(BROWSER_VERSION) \ - test/index.js; \ - else \ - ./node_modules/zuul/bin/zuul \ - --browser-name $(BROWSER_NAME) \ - --browser-version $(BROWSER_VERSION) \ - --browser-platform "$(BROWSER_PLATFORM)" \ - test/index.js; \ - fi + @./node_modules/zuul/bin/zuul \ + test/index.js .PHONY: test diff --git a/package.json b/package.json index 09639ce..0f98c47 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "benchmark": "2.1.2", "expect.js": "0.3.1", "mocha": "3.2.0", + "socket.io-browsers": "^1.0.0", "zuul": "3.11.1", "zuul-ngrok": "4.0.0" }, diff --git a/zuul.config.js b/zuul.config.js new file mode 100644 index 0000000..46d3108 --- /dev/null +++ b/zuul.config.js @@ -0,0 +1,29 @@ +'use strict'; + +var browsers = require('socket.io-browsers'); + +var zuulConfig = module.exports = { + ui: 'mocha-bdd', + + // 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 +}; + +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;