Package Overview
What @testrelic/playwright-analytics provides: the reporter, the enhanced test fixture, the API fixture, and the shard-merge utility.
@testrelic/playwright-analytics is the SDK package for Playwright browser test analytics. It plugs into Playwright's reporter pipeline and an enhanced test fixture to capture rich test data with zero changes to your test logic.
What does this package provide?
| Export | Import path | What it does |
|---|---|---|
| Reporter class | @testrelic/playwright-analytics | Drop-in Playwright reporter — add to the reporter array in playwright.config.ts |
| Reporter-only entry | @testrelic/playwright-analytics/reporter | Same reporter without importing @playwright/test — use it in monorepos where a second Playwright copy would double-initialise |
defineConfig() | @testrelic/playwright-analytics | Wraps Playwright's defineConfig: turns on video, screenshot and trace and appends the TestRelic reporter (your own values win) |
recordNavigation() | @testrelic/playwright-analytics | Record a navigation the auto-tracker cannot see (iframes, web workers) |
| Enhanced fixture | @testrelic/playwright-analytics/fixture | Re-exports test and expect with automatic navigation tracking |
| API fixture | @testrelic/playwright-analytics/api-fixture | testRelicApiFixture (plus an assertion-aware expect) for extending API-only test fixtures |
| CommonJS fixtures | .../fixture/cjs, .../api-fixture/cjs | Explicit CJS builds, for projects that compile tests as CommonJS and hit ERR_REQUIRE_ESM |
| Visual matcher | @testrelic/playwright-analytics/visual | Registers toMatchVisualBaseline on Playwright's own expect — see Visual Testing |
| Merge utility | @testrelic/playwright-analytics/merge | mergeReports() — combine shard reports into one file |
testrelic | CLI binary | merge shard reports, and serve / open a streaming report locally |
How do I install it?
Install @testrelic/playwright-analytics in this project and set it up:
1. Run: npm install --save-dev @testrelic/playwright-analytics
2. Add it to playwright.config.ts reporter array:
['@testrelic/playwright-analytics', {
outputPath: './test-results/analytics-timeline.json',
includeNetworkStats: true,
}]
3. In test files, change the import from '@playwright/test' to
'@testrelic/playwright-analytics/fixture'
Show me the updated config and one example test file.Testing with Appium / mobile?
For the @testrelic/appium-analytics package, see the Appium Package Overview.
Next steps
Overview
Welcome to TestRelic for Playwright — the AI-driven Testing Observability Platform that captures navigation timelines, network stats, and CI metadata from your Playwright browser tests.
Get Started
Install the @testrelic/playwright-analytics reporter and fixture in your Playwright project and produce structured analytics JSON in minutes.