TestRelic

Examples

What testing modes does TestRelic support for Playwright — E2E browser, API, and unified — and where do example projects live?

TestRelic supports three testing modes for Playwright, each optimized for a different scenario. All three write to the same analytics JSON, so reports compose naturally even when a suite mixes modes.

E2E Testing (Browser)

Uses the page fixture for browser navigation tracking — page load timing, DOM content loaded, network idle detection, and network request statistics.

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

test('homepage loads', { tag: ['@e2e'] }, async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page).toHaveTitle(/Example/);
});

Learn more: E2E Testing Guide

API Testing

Uses the request fixture for API call tracking — HTTP method, URL, status code, headers, bodies, response times, and assertions. No browser needed.

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);

test('fetch posts', { tag: ['@api'] }, async ({ request }) => {
  const response = await request.get('https://jsonplaceholder.typicode.com/posts');
  expect(response.status()).toBe(200);
});

Learn more: API Testing Guide

Unified Testing (Browser + API)

Uses both page and request in the same test — the report shows the navigation timeline and API call details together.

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

test('API data matches UI', { tag: ['@e2e', '@api'] }, async ({ page, request }) => {
  const apiResponse = await request.get('https://api.example.com/user/1');
  const user = await apiResponse.json();

  await page.goto('https://example.com/profile');
  await expect(page.locator('.user-name')).toHaveText(user.name);
});

Learn more: Unified Testing Guide

Report types

Each mode generates a report tuned to what it captures:

  • Browser Reports — navigation timelines, network stats, page load metrics
  • API Reports — request/response tracking, timing, headers, bodies
  • Unified Reports — combined browser + API analytics in a single view

Creating your own example project

Terminal
mkdir my-testrelic-example && cd my-testrelic-example
npm init -y
npm install -D @playwright/test @testrelic/playwright-analytics
npx playwright install chromium
npx playwright test

The analytics report is generated at test-results/analytics-timeline.json — inspect it with jq, your IDE's JSON viewer, or JSON Crack.

Testing with Appium / mobile?

For Android and iOS mobile testing with WebdriverIO, see the Appium overview.

Next steps

Was this page helpful?

On this page