Appium Configuration Reference

Complete reference for all @testrelic/appium-analytics configuration options — AppiumReporterConfig, TestRelicService options, and cloud upload settings.

TestRelicService options
TestRelicReporter options
Live capture behavior
Output paths and upload

@testrelic/appium-analytics is configured through options passed to TestRelicService (in services) and TestRelicReporter (in reporters) in your wdio.conf.ts.

Playwright configuration

This page covers @testrelic/appium-analytics options. For Playwright configuration, see the Playwright overview.

TestRelicService options

TestRelicService runs during each test session. It collects device logs, network traffic, commands, and screenshots. Pass options as the second element of the service tuple:

wdio.conf.ts
services: [
  [TestRelicService, {
    includeDeviceLogs: true,
    includeNetworkLogs: true,
    screenshotOnEvery: 'failure',
  }],
],
OptionTypeDefaultDescription
includeDeviceLogsbooleantrueCapture Android logcat / iOS syslog per test
includeNetworkLogsbooleantrueCapture HTTP network traffic
includeConsoleLogsbooleantrueCapture browser/app console output
includeScreenshotsbooleantrueCapture screenshots
screenshotOnEvery'test' | 'failure' | 'never''failure'When to capture screenshots
includeVideoRecordingbooleanfalseCapture screen video (performance impact)
includeCommandsbooleantrueCapture every WebDriver command with args and timing
includeAssertionsbooleantrueCapture assertion results
includeActionStepsbooleantrueCapture named action steps
deviceLogPollIntervalnumber1000Milliseconds between device log polls (minimum 100)
preferBiDibooleantruePrefer WebDriver BiDi (log.entryAdded) for console log capture; falls back to polling when unavailable

TestRelicReporter options

TestRelicReporter runs after all tests complete. It writes the structured report file and optionally uploads to the cloud. Pass options as the second element of the reporter tuple:

wdio.conf.ts
reporters: [
  'spec',
  [TestRelicReporter, {
    outputPath: './test-results/testrelic-timeline.json',
    openReport: true,
    cloud: {
      apiKey: process.env.TESTRELIC_API_KEY,
    },
  }],
],

Core options

OptionTypeDefaultDescription
outputPathstring'./test-results/testrelic-timeline.json'Path for the JSON report file
htmlReportPathstringDerived from outputPath (.html extension)Path for the HTML report file
openReportbooleantrueOpen the HTML report in the browser after the run
testRunIdstringAuto-generated UUIDOverride the run ID — useful for correlating with CI build numbers
maxDeviceLogsnumber2000Keep at most this many device-log lines per test (the most recent); 0 keeps all
redactPatterns(string | RegExp)[]4 built-in patternsAdditional patterns to redact from output (appended to built-in patterns)
metadataRecord<string, unknown>undefinedCustom metadata attached to the report
quietbooleanfalseSuppress the console summary printed after the run
cloudCloudReporterOptionsundefinedCloud upload configuration — see below

Output files

The reporter writes the JSON report to outputPath, plus a per-worker copy suffixed with the run ID (testrelic-timeline-<testRunId>.json) so parallel workers never overwrite each other, and the HTML report to htmlReportPath. Merge worker files with npx testrelic-appium merge — see Merging shards.

redactPatterns

Built-in patterns already redact AWS access keys, Bearer tokens, private key blocks, and credentials embedded in URLs. The redactPatterns option appends additional patterns — it does not replace the built-ins.

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

Cloud upload options (CloudReporterOptions)

The cloud object inside reporter options controls cloud upload behaviour.

OptionTypeDefaultDescription
apiKeystring—Required. Your TestRelic API key (a '$VAR' string is read from that environment variable)
endpointstring'https://platform.testrelic.ai/api/v1'Cloud API endpoint (override for self-hosted)
upload'batch' | 'realtime' | 'both''batch'Upload strategy: one payload at the end, per-test as tests finish, or both
timeoutnumber30000Upload request timeout in milliseconds
projectNamestringundefinedProject name, used to identify the repository when there is no git remote
uploadArtifactsbooleantrueUpload screenshots and video alongside the report
artifactMaxSizeMbnumber50Per-file size limit for artifact uploads (MB)
queueMaxAgestring'7d'How long failed uploads stay queued before discarding (s, m, h, d units)
queueDirectorystring'.testrelic/queue'Directory where failed uploads are queued for retry

Cloud settings are also read from .testrelic/testrelic-config.json (same format as the Playwright config file) and from the TESTRELIC_API_KEY, TESTRELIC_CLOUD_ENDPOINT, TESTRELIC_UPLOAD_STRATEGY and TESTRELIC_CLOUD_TIMEOUT environment variables, which take the highest priority.

Provide the key through the environment or config file

TestRelicReporter.finalize() runs in the WDIO launcher process and rebuilds its cloud connection from TESTRELIC_API_KEY and .testrelic/testrelic-config.json only. An API key that exists solely as a literal in the reporter's cloud options is not visible there, so the final upload is skipped. Keep the key in TESTRELIC_API_KEY (as the examples do with process.env.TESTRELIC_API_KEY) or in the config file.

Retry queue

If an upload fails (e.g., network error), the reporter writes the payload to the local queue directory and retries on the next run. Entries older than queueMaxAge are automatically discarded. Configure queueDirectory to a project-specific path if you need deterministic queue locations across CI agents.

Full configuration example

Generate a full configuration with an AI assistant

AI Prompt — Full Appium production config
Update my wdio.conf.ts to use @testrelic/appium-analytics with a production CI configuration:

services:
  - TestRelicService with:
      includeDeviceLogs: true
      includeNetworkLogs: true
      includeScreenshots: true
      screenshotOnEvery: 'failure'
      includeCommands: true
      includeActionSteps: true
      preferBiDi: true

reporters:
  - TestRelicReporter with:
      outputPath: './test-results/testrelic-timeline.json'
      openReport: false
      testRunId: process.env.CI_BUILD_ID (or null if not set)
      metadata: { branch: process.env.CI_BRANCH, commit: process.env.CI_COMMIT_SHA }
      cloud: { apiKey: process.env.TESTRELIC_API_KEY, uploadArtifacts: true, artifactMaxSizeMb: 100 }

Also add an onComplete hook that calls TestRelicReporter.finalize().
Add 'import dotenv/config' at the top.
Show me the complete updated file.
AI Prompt — Minimal local-only config
Update my wdio.conf.ts to use @testrelic/appium-analytics with minimal local-only configuration.
No cloud upload needed — just capture device logs and screenshots on failure.
Show me the updated services and reporters sections only.
AI Prompt — Add redaction patterns
Update my wdio.conf.ts to add custom redactPatterns to TestRelicService.
I want to redact:
  - Any string matching /auth_token=[^&\s]+/gi
  - Any string matching /x-api-key:\s*\S+/gi
Show me the updated service options.
Was this page helpful?

On this page