How do I debug a Testcafe browser running in a testcafe/testcafe docker container? How do I debug a Testcafe browser running in a testcafe/testcafe docker container? docker docker

How do I debug a Testcafe browser running in a testcafe/testcafe docker container?


You can use the NODE_OPTIONS environment variable to enable remote debugging:

docker run -it --rm -p 9229:9229 -e NODE_OPTIONS="--inspect-brk=0.0.0.0:9229" -v /host/path/to/tests:/tests testcafe/testcafe 'chromium --no-sandbox' /tests/test.js

If you don't use docker-machine, you can open http://localhost:9229/json in your browser and navigate to a DevTools URL specified in the devtoolsFrontendUrl property.

Otherwise, use the docker-machine ip command to get the IP address of your Docker VM and open http://${DOCKER_MACHINE_IP}:9229/json to get a DevTools URL.


On the off-chance you are developing on a Mac, one possibility is that you need to specify the host as host.docker.internal rather than 127.0.0.1 in order for the running services on the host to be visible to the container. That could be one of the discrepancies between the local and containerized test runs.

https://docs.docker.com/docker-for-mac/networking/