Skip to main content

Installation & Quick Start

Get started with TestRelic in your Playwright project in just a few steps.

1. Install

Install the TestRelic Playwright analytics package:

npm install @testrelic/playwright-analytics

2. Add the reporter to your Playwright config

Update your playwright.config.ts to include the TestRelic reporter:

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
reporter: [
['list'],
['@testrelic/playwright-analytics', {
outputPath: './test-results/analytics-timeline.json',
includeStackTrace: true,
includeCodeSnippets: true,
includeNetworkStats: true,
}],
],
});

3. Use the fixture in your tests

Import the test fixture from TestRelic instead of the default Playwright test:

// my-test.spec.ts
import { test, expect } from '@testrelic/playwright-analytics/fixture';

test('homepage loads correctly', async ({ page }) => {
await page.goto('https://example.com');
await expect(page.locator('h1')).toBeVisible();
});

4. Run your tests

Execute your Playwright tests as usual:

npx playwright test

The JSON report will be written to ./test-results/analytics-timeline.json.

What's Next?

Was this doc helpful?