Skip to content
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

Feat: Playwright headed mode #2558

Draft
wants to merge 1 commit into
base: feat/set-up-playwright
Choose a base branch
from

Conversation

angela-tran
Copy link
Member

Part of #2504

Builds off #2554

This PR makes it so we can run Playwright in headed mode and use its GUI tools like trace viewer, inspector, debugger, etc.

Credit goes to this blog post for its helpful explanation: https://www.oddbird.net/2022/11/30/headed-playwright-in-docker/

Trying it out

In your .env file, add this environment variable based on your host platform:

  • Windows: DISPLAY=:0
  • macOS: DISPLAY=host.docker.internal:0
  • Linux: DISPLAY=$DISPLAY

For Windows, see this section for some steps you can run to verify this will work: # Microsoft Windows

For macOS, see this section for some additional steps that are needed: # macOS

Then, in a terminal, run:

docker compose run --rm playwright /bin/bash

to start a session inside the playwright container.

Then in that session, run:

pytest --headed --slowmo 1000

You should see a browser window pop up that goes to the dev-benefits healthcheck.

make environment variables available so that the DISPLAY variable can
be specified for the host platform, and mount the XServer Unix
socket.
@github-actions github-actions bot added the docker Application container, devcontainer, Compose, etc. label Dec 4, 2024
Copy link

github-actions bot commented Dec 4, 2024

Coverage report

This PR does not seem to contain any modification to coverable code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Application container, devcontainer, Compose, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant