Highlights
Traces for playwright.request API contexts (#333). --tracing now also records contexts created with playwright.request.new_context(), one chunk per test, so a session-scoped API context yields a trace per test. The traces follow the same retain-on-failure handling, trace-N.zip naming and report attachments as browser traces. Requires Playwright 1.60 or newer.
Artifacts in test reports (#332). Kept screenshots, videos and traces are added to the teardown report as playwright_screenshot, playwright_video and playwright_trace user properties, so --junitxml writes them as <property> elements and pytest_runtest_logreport hooks and reporters can pick them up. With pytest-html >= 4 they are linked from the report, and embedded with --self-contained-html.
Reruns keep their own artifacts (#331). With pytest-rerunfailures, every attempt now writes to its own folder, test-results/<test>-retry1/ and so on, like Playwright Test. Attempts no longer overwrite each other.
Artifacts survive fixture failures in teardown (#330). --tracing retain-on-failure, --video retain-on-failure and --screenshot only-on-failure now keep artifacts when a fixture fails during teardown. A test skipped from a fixture no longer counts as failed.
Per-test browser launch options (#329):
@pytest.mark.parametrize(
"browser_type_launch_args",
[{"args": ["--lang=de-DE"]}],
indirect=True,
)
def test_german(page):
...Each distinct value launches its own browser; command line options such as --headed and --slowmo still apply.
Multi-browser parametrization fixes. Overriding the page fixture no longer drops --browser parametrization on older pytest versions (#314). browser_name is now parametrized indirectly, so tests keep their original order within a browser (#284).
VS Code debugger (#328). The browser is launched headed under the debugger only when a display is available. On Linux without DISPLAY or WAYLAND_DISPLAY set, it stays headless unless --headed is passed.
Breaking changes
-
pytest-base-urlis now an optional dependency (#334). The plugin provides--base-url, thebase_urlini option, thePYTEST_BASE_URLenvironment variable and thebase_urlfixture on its own.--verify-base-urlneeds the extra:pip install pytest-playwright[base-url]
-
Minimum pytest version is 7.0 for pytest-playwright and 8.2 for pytest-playwright-asyncio (#333).
-
python-slugify9.x is now supported (#324).
Full Changelog: v0.9.0...v0.10.0