Browse Source

tweak e2e script to allow passing in more flags to npm task

dev
Evan You 9 years ago
parent
commit
bd71c06b6f
  1. 8
      build/nightwatch.config.js
  2. 19
      test/e2e/runner.js

8
build/nightwatch.config.js

@ -36,6 +36,14 @@ module.exports = {
'javascriptEnabled': true,
'acceptSslCerts': true
}
},
'phantomjs': {
'desiredCapabilities': {
'browserName': 'phantomjs',
'javascriptEnabled': true,
'acceptSslCerts': true
}
}
}
}

19
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, {

Loading…
Cancel
Save