问题
I have a local dev server running on Mac OS on localhost:3000
I want to be able to run testcafe tests in the docker container, pointing to the app running on the Mac host.
Test code:
fixture('<Page>')
.page(`localhost:3000/page-test`)
I've tried docker run --network="host"
which should make Mac's localhost accessible, but no success.
Have also read, host.docker.internal
or docker.for.mac.localhost
can be used inside the container, but there is no way for me to access, modify the image settings.
Anyone has a similar use case for testcafe docker or knows how to solve this? Thanks, Radek
回答1:
You can just use host.docker.internal
instead of localhost
right in your test code. It does not require image settings modification. Please, keep in mind that this feature was introduced in version 18.03.0-ce and is not available in Docker Toolbox.
来源:https://stackoverflow.com/questions/58006459/testcafe-docker-run-tests-against-app-running-on-hosts-localhost