Just recipes for running Playwright tests

Plus the pytest header now reports selected Playwright browsers
This commit is contained in:
Simon Willison 2026-06-16 13:35:15 -07:00
commit 77fa49cf17
3 changed files with 55 additions and 11 deletions

View file

@ -71,24 +71,42 @@ These tests are skipped by default, so you can run the main test suite with
.. _Playwright: https://playwright.dev/python/
The Playwright tests use a separate dependency group. To run them, first install
the browser engine you want to test against, for example Chromium::
The Playwright tests use a separate dependency group. The easiest way to run
them is using ``just``. First install the browser engine you want to test
against. Chromium is used by default::
just playwright-install
Then run the Playwright test module::
just playwright
You can also run the same tests against Firefox or WebKit by installing that
browser engine and passing it to ``just playwright``::
just playwright-install firefox
just playwright firefox
just playwright-install webkit
just playwright webkit
To install every supported browser engine and run the tests against all of
them, use::
just playwright-install-all
just playwright-all
You can pass extra ``pytest`` options after the browser name::
just playwright chromium -k permissions
just playwright-all -x
If you are not using ``just``, the equivalent Chromium commands are::
uv run --group playwright playwright install chromium
Then run the Playwright test module with the explicit ``--playwright`` flag::
uv run --group playwright pytest tests/test_playwright.py --playwright --browser chromium
You can also run the same tests against Firefox or WebKit by installing that
browser engine and passing it to ``--browser``::
uv run --group playwright playwright install firefox
uv run --group playwright pytest tests/test_playwright.py --playwright --browser firefox
uv run --group playwright playwright install webkit
uv run --group playwright pytest tests/test_playwright.py --playwright --browser webkit
.. _contributing_using_fixtures:
Using fixtures