TestRelic for Playwright (Python)
testrelic-playwright is a pytest plugin for Playwright Python that captures a rich analytics timeline from every test run. Install it alongside pytest-playwright, run pytest, and get an interactive HTML report plus a JSON timeline — with optional upload to the TestRelic cloud.
The plugin auto-activates through a pytest11 entry point, so there is no conftest.py wiring to add.
A faithful port of the JS reporter
testrelic-playwright is a Python port of @testrelic/playwright-analytics v2.7.0 with field-for-field parity (report schema 1.3.0). If you have used the JavaScript reporter, the report shape, panels, and behavior are the same here. See the JS SDK frameworks overview for the Node version.
What it captures
- Navigation timeline —
goto, link clicks, back/forward, SPA route changes, and hash changes. - API call tracking — method, URL, status, headers, bodies, timing, and assertions for
APIRequestContextcalls. - Network stats — totals, failed requests, bytes transferred, and a resource-type breakdown per navigation.
- Failure diagnostics — failure messages, source code snippets around the failing line, and optional full stack traces.
- Action steps — page actions and
expectassertions captured as categorized, video-synced steps. - Assertion tracking — every
expect()with pass/fail, expected/actual values, source location, and linkage to related API calls. - Console log capture — browser console messages, per test.
- Screenshots & video — captured per test into
artifacts/and embedded in the HTML report. - CI metadata — GitHub Actions, GitLab CI, Jenkins, CircleCI, and Bitbucket.
- Sensitive-data redaction — headers and body fields are redacted before they ever reach disk or the cloud.
Requirements
| Requirement | Version |
|---|---|
| Python | >=3.9 |
| pytest | >=7.0 |
| pytest-playwright | >=0.5.0 |
| playwright | >=1.35 |
| httpx | >=0.27 |
The package is published on PyPI (current version 0.3.4).
Where results land
A run produces an analytics timeline in test-results/:
test-results/
├── analytics-timeline.json
└── analytics-timeline.html
Open the HTML file for the interactive report, or set a TESTRELIC_API_KEY to upload runs to the TestRelic cloud.