How Do I Debug A Testcafe Browser Running In A Testcafe/testcafe Docker Container?
Got a test for a React app's login function in a Page class: async login(t) { console.log('starting login...'); debugger; this.logBrowserMessages(t); await this
Solution 1:
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.
Solution 2:
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.
Post a Comment for "How Do I Debug A Testcafe Browser Running In A Testcafe/testcafe Docker Container?"