Skip to content

Commit bd71c06

Browse files
committed
tweak e2e script to allow passing in more flags to npm task
1 parent 000433c commit bd71c06

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

build/nightwatch.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ module.exports = {
3636
'javascriptEnabled': true,
3737
'acceptSslCerts': true
3838
}
39+
},
40+
41+
'phantomjs': {
42+
'desiredCapabilities': {
43+
'browserName': 'phantomjs',
44+
'javascriptEnabled': true,
45+
'acceptSslCerts': true
46+
}
3947
}
4048
}
4149
}

test/e2e/runner.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
var path = require('path')
2+
var spawn = require('cross-spawn')
23
var httpServer = require('http-server')
34
var server = httpServer.createServer({
45
root: path.resolve(__dirname, '../../')
56
})
67

78
server.listen(8080)
89

9-
var spawn = require('cross-spawn')
10-
var args = [
11-
'--config', 'build/nightwatch.config.js',
12-
'--env', 'chrome,firefox'
13-
]
14-
15-
if (process.argv[2]) {
16-
args.push('--test', 'test/e2e/specs/' + process.argv[2])
10+
var args = process.argv.slice(2)
11+
if (args.indexOf('--config') === -1) {
12+
args = args.concat(['--config', 'build/nightwatch.config.js'])
13+
}
14+
if (args.indexOf('--env') === -1) {
15+
args = args.concat(['--env', 'chrome,firefox'])
16+
}
17+
var i = args.indexOf('--test')
18+
if (i > -1) {
19+
args[i + 1] = 'test/e2e/specs/' + args[i + 1]
1720
}
1821

1922
var runner = spawn('./node_modules/.bin/nightwatch', args, {

0 commit comments

Comments
 (0)