-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run Playwright server for component tests in docker #31440
Comments
I would think this is the reason, yes. You need to make sure that the host port is accessible from within the container. Follow docker docks to either create a tunnel or configure docker to see the ports. |
I think the issue is that right now we cannot decouple the preview server host and the base URL when running the tests:
In my case I set use.baseURL to "host.docker.internal:3100", and my ctViteConfig.preview.host to "localhost". Even so, the test still tries to navigate to "localhost" instead of "host.docker.internal".
|
I see what you are saying. We |
Hm, I'm unsure if I misinterpreted the original question. Setup: Running Thanks for the quick response! |
Ah, yes, you are right. I assume you are non-Linux, so sharing network interface is not an option to you. Would SSH tunnel work for you? |
Another approach would be to set PW_TEST_CONNECT_EXPOSE_NETWORK - it would enable tethering (reverse proxy) to the host. The value is fed into https://playwright.dev/docs/api/class-browsertype#browser-type-connect's exposeNetwork. Tell me if that works for you and I can update the #26482. |
I got it working by setting ctViteConfig.preview.host to my host's local IP which worked both for the preview server and also allowed the container to reach it! |
Closing as per above, please feel free to open a new issue if this does not cover your use case. |
I would like to run Playwright component tests on a Playwright server in Docker while keeping the tests running on the host system.
Like explained in #26482 I've followed these steps:
Run Playwright Server in Docker
Connect client to running server
No I get the following error
I think, this is because of the fact, that Playwright uses Vite under the hood and Vite tries to start a new webserver on the hostmachine which doesn't know about the Server running in the docker container.
This is my
playwright-ct.config.ts
:It would be really nice to get this kind of setup running.
The text was updated successfully, but these errors were encountered: