From bd71c06b6f4ce3338d30c0c464e5aff500ccd734 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 13 Jun 2016 18:01:12 -0400 Subject: [PATCH] tweak e2e script to allow passing in more flags to npm task --- build/nightwatch.config.js | 8 ++++++++ test/e2e/runner.js | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/build/nightwatch.config.js b/build/nightwatch.config.js index 07697a50..1ec1e127 100644 --- a/build/nightwatch.config.js +++ b/build/nightwatch.config.js @@ -36,6 +36,14 @@ module.exports = { 'javascriptEnabled': true, 'acceptSslCerts': true } + }, + + 'phantomjs': { + 'desiredCapabilities': { + 'browserName': 'phantomjs', + 'javascriptEnabled': true, + 'acceptSslCerts': true + } } } } diff --git a/test/e2e/runner.js b/test/e2e/runner.js index 2274e387..3ca290dc 100644 --- a/test/e2e/runner.js +++ b/test/e2e/runner.js @@ -1,4 +1,5 @@ var path = require('path') +var spawn = require('cross-spawn') var httpServer = require('http-server') var server = httpServer.createServer({ root: path.resolve(__dirname, '../../') @@ -6,14 +7,16 @@ var server = httpServer.createServer({ server.listen(8080) -var spawn = require('cross-spawn') -var args = [ - '--config', 'build/nightwatch.config.js', - '--env', 'chrome,firefox' -] - -if (process.argv[2]) { - args.push('--test', 'test/e2e/specs/' + process.argv[2]) +var args = process.argv.slice(2) +if (args.indexOf('--config') === -1) { + args = args.concat(['--config', 'build/nightwatch.config.js']) +} +if (args.indexOf('--env') === -1) { + args = args.concat(['--env', 'chrome,firefox']) +} +var i = args.indexOf('--test') +if (i > -1) { + args[i + 1] = 'test/e2e/specs/' + args[i + 1] } var runner = spawn('./node_modules/.bin/nightwatch', args, {