Get Started
Install the @testrelic/playwright-analytics reporter and fixture in your Playwright project and produce structured analytics JSON in minutes.
TestRelic is free to use and published under the MIT license. Get up and running with @testrelic/playwright-analytics in minutes.
Appium / mobile testing
For Appium/WDIO setup, see the Appium Installation guide.
Prerequisites
- Node.js ≥ 18
- Playwright ≥ 1.40
Install @testrelic/playwright-analytics in this project and set it up completely:
1. Run: npm install @testrelic/playwright-analytics
2. Open playwright.config.ts and add the TestRelic reporter to the reporter array:
['@testrelic/playwright-analytics', {
outputPath: './test-results/analytics-timeline.json',
includeStackTrace: true,
includeCodeSnippets: true,
includeNetworkStats: true,
}]
3. In all test files that currently import from '@playwright/test', change the import
to '@testrelic/playwright-analytics/fixture' so navigation is tracked automatically.
Keep the existing 'list' reporter if it is already there. Do not change any test logic.Set up @testrelic/playwright-analytics for API testing in this project:
1. Install: npm install @testrelic/playwright-analytics
2. Update playwright.config.ts to include the reporter with trackApiCalls: true,
captureRequestBody: true, captureResponseBody: true.
3. In my API test files, extend the base test fixture using testRelicApiFixture:
import { test as base } from '@playwright/test';
import { testRelicApiFixture } from '@testrelic/playwright-analytics/api-fixture';
import { expect } from '@testrelic/playwright-analytics/fixture';
const test = base.extend(testRelicApiFixture);
Show me the updated config and one example test file.Troubleshooting
| Symptom | What to try |
|---|---|
| No JSON report after the run | Confirm the reporter array in playwright.config.ts includes @testrelic/playwright-analytics and that outputPath is writable. |
Cannot find module '@testrelic/playwright-analytics/fixture' | Run npm install @testrelic/playwright-analytics in the same package where Playwright runs. |
Next steps
Was this page helpful?
Package Overview
What @testrelic/playwright-analytics provides: the reporter, the enhanced test fixture, the API fixture, and the shard-merge utility.
Cloud Quickstart
Connect your Playwright project to the TestRelic cloud platform in under 10 minutes — create an account, configure the reporter, and explore your first test run.