Headless Nightwatch Tests
Waltir | 2019-05-02
The Nightwatch documentation unfortunately does not cover how to run your tests in a headless mode so I thought it would be worth writing a small post about it. For those of you that are not familiar with the term ‘headless’ it simply means running a automated browser window that does not physically appear anywhere on your machine.
To enable headless this headless mode you’ll want to add ”headless”
to your ”chromeOptions”
like so:
// The environment below is named 'headless' and is located in our nightwatch.conf.js file. | |
"headless": { | |
"desiredCapabilities": { | |
"chromeOptions": { | |
"args": [ | |
"headless", // This is the line that tells nightwatch to run in a headless mode | |
], | |
}, | |
"browserName": "chrome", | |
"javascriptEnabled": true | |
} | |
} |
That’s all it takes to initiate a headless mode in Nightwatch. Hopefully this is able to help some of my fellow Nightwatch users out.