Use 2 docker containers to run nightwatchjs test: one with nightwatch, the other with selenium/standalone-chrome
.
In your folder, the following files:
- Dockerfile
- test/
- nightwatch.json
- test.js
We may need to update the selenium_host ip to your host machine ip (accessible from your container, ie the bridge network gateway: try docker inspect bridge
).
Start the docker-selenium-chrome container with docker run --rm -d -p 4444:4444 --name selenium-chrome selenium/standalone-chrome
.
Build the nightwatchjs runner with docker run build -t nightwatch .
, run it with docker run nightwatch
.
You probably want to redirect selenium's url to your local sever, you can do that with:
echo "$SERVER_IP my-domain.com" | docker exec -i $SELENIUM_IMAGE_NAME sudo tee -a /etc/hosts
where SERVER_IP is the server ip and SELENIUM_IMAGE_NAME the selenium docker image name... simple.