Run the Docker image (one-time setup):
docker run -p 3000:3000 --rm --init -it mcr.microsoft.com/playwright:v1.41.0-jammy /bin/sh -c "cd /home/pwuser && npx -y playwright@1.41.0 run-server --port 3000 --host 0.0.0.0"
Add an environment variable in e.g. in: .zshrc, .zprofile, .bashrc or .bash_profile(one-time setup):
export PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:3000/
Might be good to add docs on how to use Playwright on Linux distributions as described in?: https://github.com/microsoft/playwright/issues/26482
We have follow these steps:
Run the Docker image (one-time setup):
docker run -p 3000:3000 --rm --init -it mcr.microsoft.com/playwright:v1.41.0-jammy /bin/sh -c "cd /home/pwuser && npx -y playwright@1.41.0 run-server --port 3000 --host 0.0.0.0"
Add an environment variable in e.g. in:
.zshrc
,.zprofile
,.bashrc
or.bash_profile
(one-time setup):export PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:3000/
Run the tests as usual:
npx playwright test
If component testing is used, then the
ctViteConfig.preview.host
has to be set inplaywright.config.ts
as described in https://github.com/microsoft/playwright/issues/31440#issuecomment-2197538299: