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: set up Playwright #2554

Merged
merged 8 commits into from
Feb 5, 2025
Merged

Feat: set up Playwright #2554

merged 8 commits into from
Feb 5, 2025

Conversation

angela-tran
Copy link
Member

@angela-tran angela-tran commented Dec 2, 2024

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:
docker compose run --rm playwright

You can also start a terminal session in the playwright service by running:

docker compose run --rm playwright /bin/bash

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.

@angela-tran angela-tran self-assigned this Dec 2, 2024
@github-actions github-actions bot added tests Related to automated testing (unit, UI, integration, etc.) docker Application container, devcontainer, Compose, etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev labels Dec 2, 2024
Copy link

github-actions bot commented Dec 2, 2024

Coverage report

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

@angela-tran angela-tran marked this pull request as ready for review December 4, 2024 17:24
@angela-tran angela-tran requested a review from a team as a code owner December 4, 2024 17:24
@angela-tran angela-tran marked this pull request as draft December 10, 2024 18:12
Copy link

github-actions bot commented Feb 5, 2025

@angela-tran angela-tran force-pushed the feat/set-up-playwright branch from f81b44c to aedee0d Compare February 5, 2025 18:21
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.
@angela-tran angela-tran force-pushed the feat/set-up-playwright branch from aedee0d to efcf709 Compare February 5, 2025 18:22
@angela-tran angela-tran marked this pull request as ready for review February 5, 2025 18:23
Copy link
Member

@machikoyasuda machikoyasuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image Tests passing!

@machikoyasuda
Copy link
Member

Very much appreciate how small and scoped this PR is 💯

@angela-tran angela-tran merged commit 02057b8 into main Feb 5, 2025
16 checks passed
@angela-tran angela-tran deleted the feat/set-up-playwright branch February 5, 2025 19:19
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.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Figure out a way for developers to run Playwright easily
2 participants