-
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
Merged
Merged
Feat: set up Playwright #2554
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
angela-tran
commented
Dec 4, 2024
Preview url: https://benefits-2554--cal-itp-previews.netlify.app |
f81b44c
to
aedee0d
Compare
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.
aedee0d
to
efcf709
Compare
machikoyasuda
approved these changes
Feb 5, 2025
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.
Very much appreciate how small and scoped this PR is 💯 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
deployment-dev
[auto] Changes that will trigger a deploy if merged to dev
docker
Application container, devcontainer, Compose, etc.
tests
Related to automated testing (unit, UI, integration, etc.)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.