TestRelic

Configuration

Complete reference for configuring the TestRelic Playwright analytics reporter — output path, stack traces, network stats, redaction, and CI metadata.

Appium / WDIO configuration

This page covers @testrelic/playwright-analytics options. For Appium mobile testing with WebdriverIO, see Appium Configuration.

Tune what the reporter captures — stack traces, snippets, network, streaming, metadata — through the options object passed to the reporter in playwright.config.ts.

Common configuration patterns

AI Prompt — CI configuration
Update my playwright.config.ts to use @testrelic/playwright-analytics with a CI
configuration that reads build metadata from environment variables:

['@testrelic/playwright-analytics', {
  outputPath: './ci-reports/analytics.json',
  includeStackTrace: false,
  includeNetworkStats: true,
  testRunId: process.env.CI_BUILD_ID || null,
  metadata: {
    branch: process.env.CI_BRANCH,
    commit: process.env.CI_COMMIT_SHA,
    buildUrl: process.env.CI_BUILD_URL,
  }
}]

Show me the updated file.
AI Prompt — Redact sensitive data
Update my @testrelic/playwright-analytics reporter configuration to redact sensitive
data patterns from reports. Add these redact patterns:

redactPatterns: [
  /api_key=[^&\s]+/gi,
  /password=[^&\s]+/gi,
  /token=[^&\s]+/gi,
]

Show me the updated reporter configuration.

Options reference

OptionTypeDefaultDescription
outputPathstring'./test-results/analytics-timeline.json'Where to write the JSON report
includeStackTracebooleanfalseInclude full stack traces in failure diagnostics
includeCodeSnippetsbooleantrueInclude source code snippets around the failure line
codeContextLinesnumber3Lines of context above/below the failure line
includeNetworkStatsbooleantrueTrack network requests and bytes per navigation
captureRequestBodybooleanfalseInclude request body in network capture
captureResponseBodybooleanfalseInclude response body in network capture
includeActionStepsbooleantrueCapture Playwright test steps/actions plus assertions, video-synced
captureConsoleLogsbooleantrueCapture browser console logs per test
captureAssertionsbooleantrueCapture expect() assertion results
includeArtifactsbooleantrueCapture screenshots and video artifacts
captureNavigationbooleantrueCapture the Test Navigation timeline; set false to drop it before upload
navigationTypesNavigationType[] | nullnull (all)Filter the timeline to specific navigation types: goto, link_click, back, forward, spa_route, hash_change
redactPatterns(string | RegExp)[][] (additional only)Extra patterns appended to the built-in redaction set (AWS keys, Bearer tokens, PEM blocks)
testRunIdstring | nullnull (auto UUID)Override the test run ID — useful for correlating with external CI systems
metadataRecord<string, unknown> | nullnullAttach custom metadata to the report
reportMode'streaming' | 'batched''streaming'How the reporter writes the JSON file
streamingThresholdnumber0Minimum test count before streaming is active

Large runs always upload

You never lose a run to an upload size limit. When a run is large, the reporter automatically sheds optional detail in tiers — console and network logs first, then API-call detail — so the run still uploads. No configuration is required.

Troubleshooting

SymptomWhat to try
Very large JSON in CITurn off includeStackTrace / includeCodeSnippets, narrow navigationTypes, or disable includeNetworkStats for a CI-only profile.
Missing code around failuresSet includeCodeSnippets to true and increase codeContextLines.

Next steps

Was this page helpful?

On this page