Skip to main content
Ask AI

Get Started with the Free SDK

TestRelic is free to use and published under the MIT license. Get up and running with @testrelic/playwright-analytics in your Playwright project in minutes — either by asking your AI assistant to do it, or by following the manual steps yourself.

What do I need before I start?

  • Node.js >= 18
  • Playwright >= 1.35.0

How do I set up TestRelic using an AI assistant?

Copy one of the prompts below and paste it into your AI coding assistant. Each prompt is self-contained and tells the AI exactly what to install and configure.


Full setup (one prompt, does everything)

Use this if you want the AI to handle the entire setup in one go:

AI Prompt — Full setup (copy & paste into your AI assistant)
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.

Step-by-step prompts (one at a time)

Use these if you prefer to guide the AI step by step.

Step 1 — Install the package:

AI Prompt — Step 1: Install
Run the following in my project terminal:
npm install @testrelic/playwright-analytics

Step 2 — Configure the reporter:

AI Prompt — Step 2: Configure reporter
Open playwright.config.ts and add @testrelic/playwright-analytics to the reporter array.
Use this configuration:

['@testrelic/playwright-analytics', {
outputPath: './test-results/analytics-timeline.json',
includeStackTrace: true,
includeCodeSnippets: true,
includeNetworkStats: true,
}]

Keep any existing reporters (like 'list'). Show me the updated file.

Step 3 — Switch the test fixture:

AI Prompt — Step 3: Switch fixture
In my test files, replace:
import { test, expect } from '@playwright/test';
with:
import { test, expect } from '@testrelic/playwright-analytics/fixture';

This enables automatic navigation tracking. Do not change any test logic.

Step 4 — Run the tests:

AI Prompt — Step 4: Run tests
Run my Playwright tests with:
npx playwright test

Then tell me where the analytics report was written.

Prompt for API testing setup

Use this if you are writing API-only tests (no browser):

AI Prompt — API testing setup
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.

What should I do next?