Setting up End-to-End testing (for Nyssetutka.fi) using Nightwatch.js, Selenium and ChromeDriver and running the tests in a headless Chrome instance was super easy.
Update 12/2017: since many people are arriving here from Google, please do share any and all ideas you have if you think this post could be improved somehow. Thanks!
Since I didn’t find any information whether this could actually work already (is the headless flag still buggy or something, has ChromeDriver added support etc.), here are my findings. All I had to configure was to add a CLI arg for Chrome to my Nightwatch configuration. Useful parts below.
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path,
},
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: [ 'headless' ]
}
}
}
Version information:
./node_modules/.bin/nightwatch -v
nightwatch v0.9.16
./node_modules/.bin/chromedriver -v
ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57)
google-chrome –version
Google Chrome 59.0.3071.115
I’m running Ubuntu 17.04.

Dude Thanks so much! this helped a ton.. simple and quick fix.