Skip to content

Commit

Permalink
tweak e2e script to allow passing in more flags to npm task
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 13, 2016
1 parent 000433c commit bd71c06
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
8 changes: 8 additions & 0 deletions build/nightwatch.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ module.exports = {
'javascriptEnabled': true,
'acceptSslCerts': true
}
},

'phantomjs': {
'desiredCapabilities': {
'browserName': 'phantomjs',
'javascriptEnabled': true,
'acceptSslCerts': true
}
}
}
}
19 changes: 11 additions & 8 deletions test/e2e/runner.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
var path = require('path')
var spawn = require('cross-spawn')
var httpServer = require('http-server')
var server = httpServer.createServer({
root: path.resolve(__dirname, '../../')
})

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, {
Expand Down

0 comments on commit bd71c06

Please sign in to comment.