-
Notifications
You must be signed in to change notification settings - Fork 9
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: set up Playwright #2554
base: main
Are you sure you want to change the base?
Feat: set up Playwright #2554
Conversation
use a base image that already has playwright and its browsers installed
this provides a better dev experience when reading and writing tests from within the devcontainer
this makes it so they are used any time pytest is invoked from this directory
since the tests-pytest workflow runs from the root level, it will also collect Playwright tests if we don't specify the directory.
@@ -0,0 +1,11 @@ | |||
# https://playwright.dev/docs/docker | |||
FROM mcr.microsoft.com/playwright/python:v1.48.0-jammy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thekaveman tried running this setup and ran into an error about needing to use the latest image which is now mcr.microsoft.com/playwright/python:v1.49.0-jammy
.
Is there a latest
tag we could use? Or maybe it has something to do with the version of pytest-playwright
(try to pin it)?
Closes #2533
This PR sets us up to be able to run and write Playwright tests inside containers.
(This is basically a re-do of #2500 with cleaner commits and smaller scope, i.e. this just focuses on getting the needed tooling in place.)
Running
The
playwright
service added in this PR is to be used for running Playwright tests.The service uses an image built by Microsoft that has Playwright + dependencies already installed as the base image.
Trying it out
Outside of the devcontainer, run this in a terminal:
You can also start a terminal session in the
playwright
service by running:and then you can run the tests and/or run other Playwright commands using that session.
The test will run as headless. A later PR will contain the setup for running in headed mode.
The console output will hopefully tell you the tests passed, and you can view more output under
tests/playwright/test-results
.Writing
We do install
pytest-playwright
into the devcontainer so that when viewing the test code in the devcontainer, we get syntax-highlighting, code completion, etc.Docs on writing tests
Healthcheck test as a starting point
A test called
test_dev_healthcheck
is included here just so we have something to run. We can decide later if there's any value in keeping it once other tests are added.