Docker上のSeleniumGridを使ってNightwatchでE2Eテストをするサンプルです
Install docker for mac or windows.
[mac] https://docs.docker.com/docker-for-mac/
[windows] https://docs.docker.com/docker-for-windows/
Create selenium docker host.
$ docker-machine create -d virtualbox selenium
Set environment.
$ eval $(docker-machine env selenium)
git clone https://github.com/treetips/selenium-grid-nightwatch-example.git
$ docker-compose up -d
$ npm install
You can check the docker-host with the docker-machine ip command.
$ docker-machine ip selenium
172.16.53.136
Open nightwatch.conf.js and edit selenium_host.
let DEFAULT_CONFIGURATION = {
launch_url: "http://localhost",
selenium_port: 4444,
selenium_host: "172.16.53.136",
If execute 'npm run local', start up local chrome or firefox by standalone-selenium without docker and selenium-grid.
# test for chrome
$ npm run local-chrome
# test for firefox
$ npm run local-firefox
# test for chrome and firefox
$ npm run local
If execute 'npm run grid', parallel start up chrome or firefox by selenium-grid on docker
$ npm run grid
Edit src/test.js.