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
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.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
| Option | Type | Default | Description |
|---|---|---|---|
outputPath | string | './test-results/analytics-timeline.json' | Where to write the JSON report |
includeStackTrace | boolean | false | Include full stack traces in failure diagnostics |
includeCodeSnippets | boolean | true | Include source code snippets around the failure line |
codeContextLines | number | 3 | Lines of context above/below the failure line |
includeNetworkStats | boolean | true | Track network requests and bytes per navigation |
captureRequestBody | boolean | false | Include request body in network capture |
captureResponseBody | boolean | false | Include response body in network capture |
includeActionSteps | boolean | true | Capture Playwright test steps/actions plus assertions, video-synced |
captureConsoleLogs | boolean | true | Capture browser console logs per test |
captureAssertions | boolean | true | Capture expect() assertion results |
includeArtifacts | boolean | true | Capture screenshots and video artifacts |
captureNavigation | boolean | true | Capture the Test Navigation timeline; set false to drop it before upload |
navigationTypes | NavigationType[] | null | null (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) |
testRunId | string | null | null (auto UUID) | Override the test run ID — useful for correlating with external CI systems |
metadata | Record<string, unknown> | null | null | Attach custom metadata to the report |
reportMode | 'streaming' | 'batched' | 'streaming' | How the reporter writes the JSON file |
streamingThreshold | number | 0 | Minimum 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
| Symptom | What to try |
|---|---|
| Very large JSON in CI | Turn off includeStackTrace / includeCodeSnippets, narrow navigationTypes, or disable includeNetworkStats for a CI-only profile. |
| Missing code around failures | Set includeCodeSnippets to true and increase codeContextLines. |
Next steps
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.
Merging Shard Reports
How do I merge TestRelic reports from parallel Playwright shards or Appium/WDIO workers into one file?