@testrelic/appium-analytics 1.0.0-next.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/README.md +0 -704
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testrelic/appium-analytics",
3
- "version": "1.0.0-next.6",
3
+ "version": "1.0.0",
4
4
  "description": "Appium test analytics reporter with device log capture, command tracking, network interception, and interactive HTML reports for Android and iOS",
5
5
  "keywords": [
6
6
  "appium",
@@ -70,7 +70,7 @@
70
70
  "webdriverio": ">=9.0.0"
71
71
  },
72
72
  "dependencies": {
73
- "@testrelic/core": "2.4.11-next.6"
73
+ "@testrelic/core": "2.4.10"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/node": "^20.0.0",
package/README.md DELETED
@@ -1,704 +0,0 @@
1
- # @testrelic/appium-analytics
2
-
3
- [![npm version](https://img.shields.io/npm/v/@testrelic/appium-analytics.svg)](https://www.npmjs.com/package/@testrelic/appium-analytics)
4
- [![license](https://img.shields.io/npm/l/@testrelic/appium-analytics.svg)](https://github.com/testrelic-ai/testrelic-sdk/blob/main/packages/appium-analytics/LICENSE)
5
- [![node](https://img.shields.io/node/v/@testrelic/appium-analytics.svg)](https://nodejs.org)
6
-
7
- Appium test analytics reporter with device log capture, command tracking, network interception, and interactive HTML reports for Android and iOS.
8
-
9
- ---
10
-
11
- ## Table of Contents
12
-
13
- - [Features](#features)
14
- - [Requirements](#requirements)
15
- - [Installation](#installation)
16
- - [Quick Start](#quick-start)
17
- - [WDIO Integration](#wdio-integration)
18
- - [TestRelicService](#testrelicservice)
19
- - [TestRelicReporter](#testrelicreporter)
20
- - [onComplete Hook](#oncomplete-hook)
21
- - [Android Configuration](#android-configuration)
22
- - [iOS Configuration](#ios-configuration)
23
- - [Configuration Reference](#configuration-reference)
24
- - [Core Options](#core-options)
25
- - [Cloud Options](#cloud-options)
26
- - [Platform Setup](#platform-setup)
27
- - [Android](#android)
28
- - [iOS](#ios)
29
- - [Cloud Upload](#cloud-upload)
30
- - [Config File](#config-file)
31
- - [Environment Variables](#environment-variables)
32
- - [Priority Order](#priority-order)
33
- - [CLI](#cli)
34
- - [Merging Reports](#merging-reports)
35
- - [Viewing Reports Locally](#viewing-reports-locally)
36
- - [Redaction](#redaction)
37
- - [Troubleshooting](#troubleshooting)
38
- - [License](#license)
39
-
40
- ---
41
-
42
- ## Features
43
-
44
- - **Appium command tracking** — records every WebDriver command with timing, category, arguments, and return values; sensitive arguments are automatically redacted
45
- - **Device log capture** — streams Android logcat and iOS syslog / crashlog per test
46
- - **Network interception** — captures HTTP requests and responses via Chrome DevTools Protocol (Android), `safariNetwork` (iOS), or an automatic proxy fallback using `adb` when CDP is not available
47
- - **Console log capture** — collects webview / browser console output via BiDi `log.entryAdded` or falls back to `browser` / `safariConsole` log polling
48
- - **Screenshot collection** — captures screenshots after every test, only on failure, or never
49
- - **Video recording** — records the device screen using Appium recording commands or `adb screenrecord` on Android
50
- - **Interactive HTML reports** — self-contained report with a timeline view for commands, logs, network requests, screenshots, and video
51
- - **Cloud upload** — upload results to the TestRelic platform in batch or realtime mode
52
- - **CLI** — merge multiple report files, serve the report directory, or open the report in a browser
53
-
54
- ---
55
-
56
- ## Requirements
57
-
58
- | Requirement | Version |
59
- |-------------|---------|
60
- | Node.js | >= 18 (Appium 3.x requires >= 20.19) |
61
- | WebdriverIO | >= 9.0.0 *(peer dependency)* |
62
- | `@wdio/reporter` | >= 9.0.0 *(peer dependency)* |
63
- | Appium | 3.x (`npm install -g appium@latest`) |
64
- | Android driver | UiAutomator2 (`appium driver install uiautomator2`) |
65
- | iOS driver | XCUITest on macOS (`appium driver install xcuitest`) |
66
-
67
- > **iOS note:** iOS testing requires macOS 13+ with Xcode 15+. iOS tests cannot run on Windows or Linux.
68
-
69
- ---
70
-
71
- ## Installation
72
-
73
- ```bash
74
- # npm
75
- npm install @testrelic/appium-analytics
76
- npm install --save-dev webdriverio @wdio/reporter
77
-
78
- # yarn
79
- yarn add @testrelic/appium-analytics
80
- yarn add --dev webdriverio @wdio/reporter
81
-
82
- # pnpm
83
- pnpm add @testrelic/appium-analytics
84
- pnpm add --save-dev webdriverio @wdio/reporter
85
- ```
86
-
87
- ---
88
-
89
- ## Quick Start
90
-
91
- Add `TestRelicService` to `services` and `TestRelicReporter` to `reporters` in your WDIO config, then implement `onComplete`:
92
-
93
- ```ts
94
- // wdio.conf.ts
95
- import { join } from 'node:path';
96
- import { TestRelicService } from '@testrelic/appium-analytics/service';
97
- import { TestRelicReporter } from '@testrelic/appium-analytics';
98
-
99
- const REPORT_DIR = join(process.cwd(), 'test-results');
100
-
101
- async function onComplete() {
102
- try {
103
- await TestRelicReporter.finalize(process.cwd());
104
- } catch (err) {
105
- process.stderr.write(`[TestRelic] Cloud finalization failed: ${err}\n`);
106
- }
107
- }
108
-
109
- export const config = {
110
- runner: 'local',
111
- port: 4723,
112
- path: '/',
113
-
114
- specs: ['./tests/**/*.test.ts'],
115
- maxInstances: 1,
116
-
117
- capabilities: [{
118
- platformName: 'Android',
119
- 'appium:automationName': 'UiAutomator2',
120
- 'appium:deviceName': 'emulator-5554',
121
- 'appium:app': join(process.cwd(), 'apps', 'MyApp.apk'),
122
- }],
123
-
124
- framework: 'mocha',
125
- mochaOpts: { ui: 'bdd', timeout: 60000 },
126
-
127
- services: [
128
- [TestRelicService, {
129
- outputPath: REPORT_DIR,
130
- includeDeviceLogs: true,
131
- includeNetworkLogs: true,
132
- screenshotOnEvery: 'failure',
133
- }],
134
- ],
135
-
136
- reporters: [
137
- 'spec',
138
- [TestRelicReporter, {
139
- outputPath: join(REPORT_DIR, 'report.json'),
140
- htmlReportPath: join(REPORT_DIR, 'report.html'),
141
- openReport: true,
142
- }],
143
- ],
144
-
145
- onComplete,
146
- };
147
- ```
148
-
149
- ---
150
-
151
- ## WDIO Integration
152
-
153
- The package provides two WebdriverIO plugins that work together: a **service** and a **reporter**. Both accept the same `AppiumReporterConfig` options.
154
-
155
- ### TestRelicService
156
-
157
- Import path: `@testrelic/appium-analytics/service`
158
-
159
- `TestRelicService` is a WDIO service plugin that runs inside the **worker process** alongside your live Appium/WebDriver session. It registers the following hooks:
160
-
161
- | Hook | What it does |
162
- |------|-------------|
163
- | `before` | Detects platform/capabilities, starts `DeviceLogCollector`, `ConsoleLogCollector`, `NetworkInterceptor`, and prepares `ScreenshotCollector` |
164
- | `after` | Stops log and network collectors |
165
- | `beforeTest` / `afterTest` | Marks per-test log slice boundaries; captures screenshots; starts/stops video recording |
166
- | `beforeCommand` / `afterCommand` | Delegates to `CommandTracker` — records every Appium command with timing and redacted arguments |
167
- | `beforeAssertion` / `afterAssertion` | Delegates to `AssertionTracker` — records WebdriverIO v9 assertion steps |
168
-
169
- ### TestRelicReporter
170
-
171
- Import path: `@testrelic/appium-analytics`
172
-
173
- `TestRelicReporter` extends `@wdio/reporter` and runs in the same **worker process**. It consumes data collected by `TestRelicService` and writes the final reports:
174
-
175
- | Event | What it does |
176
- |-------|-------------|
177
- | `onRunnerStart` | Initializes the optional `CloudClient` |
178
- | `onTestEnd` | Pulls collected data from `TestRelicService`, builds a `TimelineBuildInput`, and optionally performs a realtime cloud upload |
179
- | `onRunnerEnd` | Builds the full timeline and summary, writes the JSON report, generates the HTML report, prints the console summary, and writes a cloud finalization manifest |
180
-
181
- ### onComplete Hook
182
-
183
- > **This is required for cloud upload to work correctly.**
184
-
185
- `TestRelicReporter.finalize()` is a static method that must be called from the WDIO **launcher process** (i.e., in `onComplete`) after all worker processes have exited. It reads the `.testrelic-finalize-<testRunId>.json` manifest written by each worker and sends the final upload payload to the cloud.
186
-
187
- ```ts
188
- async function onComplete() {
189
- try {
190
- await TestRelicReporter.finalize(process.cwd());
191
- } catch (err) {
192
- process.stderr.write(`[TestRelic] Cloud finalization failed: ${err}\n`);
193
- }
194
- }
195
-
196
- export const config = {
197
- // ...
198
- onComplete,
199
- };
200
- ```
201
-
202
- Even when cloud upload is not configured, including `onComplete` is harmless — `finalize()` exits immediately if no manifest files are found.
203
-
204
- ### Android Configuration
205
-
206
- Full example using the Android emulator:
207
-
208
- ```ts
209
- // wdio.android.conf.ts
210
- import { join } from 'node:path';
211
- import { TestRelicService } from '@testrelic/appium-analytics/service';
212
- import { TestRelicReporter } from '@testrelic/appium-analytics';
213
-
214
- const APP_PATH = join(process.cwd(), 'apps', 'MyApp.apk');
215
- const REPORT_DIR = join(process.cwd(), 'test-results');
216
-
217
- async function onComplete() {
218
- try {
219
- await TestRelicReporter.finalize(process.cwd());
220
- } catch (err) {
221
- process.stderr.write(`[TestRelic] Cloud finalization failed: ${err}\n`);
222
- }
223
- }
224
-
225
- export const config = {
226
- runner: 'local',
227
- port: 4723,
228
- path: '/',
229
-
230
- specs: ['./tests/android/**/*.test.ts'],
231
- maxInstances: 1,
232
-
233
- capabilities: [{
234
- platformName: 'Android',
235
- 'appium:automationName': 'UiAutomator2',
236
- 'appium:deviceName': 'emulator-5554',
237
- 'appium:app': APP_PATH,
238
- 'appium:autoGrantPermissions': true,
239
- 'appium:newCommandTimeout': 240,
240
- 'appium:appWaitActivity': '*',
241
- 'appium:noReset': false,
242
- }],
243
-
244
- logLevel: 'warn',
245
- waitforTimeout: 15000,
246
- connectionRetryTimeout: 120000,
247
- connectionRetryCount: 3,
248
-
249
- framework: 'mocha',
250
- mochaOpts: { ui: 'bdd', timeout: 90000 },
251
-
252
- services: [
253
- [TestRelicService, {
254
- outputPath: REPORT_DIR,
255
- includeDeviceLogs: true,
256
- includeNetworkLogs: true,
257
- includeConsoleLogs: true,
258
- includeCommands: true,
259
- includeAssertions: true,
260
- includeScreenshots: true,
261
- screenshotOnEvery: 'failure',
262
- includeVideoRecording: true,
263
- }],
264
- ],
265
-
266
- reporters: [
267
- 'spec',
268
- [TestRelicReporter, {
269
- outputPath: join(REPORT_DIR, 'report.json'),
270
- htmlReportPath: join(REPORT_DIR, 'report.html'),
271
- openReport: false,
272
- }],
273
- ],
274
-
275
- onComplete,
276
-
277
- autoCompileOpts: {
278
- tsNodeOpts: { project: './tsconfig.json' },
279
- },
280
- };
281
- ```
282
-
283
- ### iOS Configuration
284
-
285
- > **Requires macOS 13+ with Xcode 15+.** iOS tests cannot run on Windows or Linux.
286
-
287
- ```ts
288
- // wdio.ios.conf.ts
289
- import { join } from 'node:path';
290
- import { TestRelicService } from '@testrelic/appium-analytics/service';
291
- import { TestRelicReporter } from '@testrelic/appium-analytics';
292
-
293
- const APP_PATH = join(process.cwd(), 'apps', 'MyApp.app');
294
- const REPORT_DIR = join(process.cwd(), 'test-results');
295
-
296
- async function onComplete() {
297
- try {
298
- await TestRelicReporter.finalize(process.cwd());
299
- } catch (err) {
300
- process.stderr.write(`[TestRelic] Cloud finalization failed: ${err}\n`);
301
- }
302
- }
303
-
304
- export const config = {
305
- runner: 'local',
306
- port: 4723,
307
- path: '/',
308
-
309
- specs: ['./tests/ios/**/*.test.ts'],
310
- maxInstances: 1,
311
-
312
- capabilities: [{
313
- platformName: 'iOS',
314
- 'appium:automationName': 'XCUITest',
315
- 'appium:deviceName': 'iPhone 15',
316
- 'appium:platformVersion': '17.5',
317
- 'appium:app': APP_PATH,
318
- 'appium:newCommandTimeout': 240,
319
- 'appium:noReset': false,
320
- }],
321
-
322
- logLevel: 'warn',
323
- waitforTimeout: 10000,
324
- connectionRetryTimeout: 120000,
325
- connectionRetryCount: 3,
326
-
327
- framework: 'mocha',
328
- mochaOpts: { ui: 'bdd', timeout: 60000 },
329
-
330
- services: [
331
- [TestRelicService, {
332
- outputPath: REPORT_DIR,
333
- includeDeviceLogs: true,
334
- includeNetworkLogs: true,
335
- includeConsoleLogs: true,
336
- includeCommands: true,
337
- includeAssertions: true,
338
- includeScreenshots: true,
339
- screenshotOnEvery: 'failure',
340
- includeVideoRecording: false,
341
- }],
342
- ],
343
-
344
- reporters: [
345
- 'spec',
346
- [TestRelicReporter, {
347
- outputPath: join(REPORT_DIR, 'report.json'),
348
- htmlReportPath: join(REPORT_DIR, 'report.html'),
349
- openReport: false,
350
- }],
351
- ],
352
-
353
- onComplete,
354
-
355
- autoCompileOpts: {
356
- tsNodeOpts: { project: './tsconfig.json' },
357
- },
358
- };
359
- ```
360
-
361
- ---
362
-
363
- ## Configuration Reference
364
-
365
- Both `TestRelicService` and `TestRelicReporter` accept `Partial<AppiumReporterConfig>`. Options set on `TestRelicService` control data collection; options set on `TestRelicReporter` control report output and cloud upload. You can share the same options object between both plugins.
366
-
367
- ### Core Options
368
-
369
- | Option | Type | Default | Description |
370
- |--------|------|---------|-------------|
371
- | `outputPath` | `string` | `'./test-results/testrelic-timeline.json'` | File path for the JSON report. Directories are created automatically. |
372
- | `htmlReportPath` | `string` | `outputPath` with `.html` extension | File path for the HTML report. |
373
- | `openReport` | `boolean` | `true` | Automatically open the HTML report in the default browser after the run completes. |
374
- | `includeDeviceLogs` | `boolean` | `true` | Capture Android logcat / iOS syslog and crashlog entries. |
375
- | `includeNetworkLogs` | `boolean` | `true` | Capture HTTP network requests and responses. |
376
- | `includeConsoleLogs` | `boolean` | `true` | Capture webview and browser console output. |
377
- | `includeScreenshots` | `boolean` | `true` | Capture device screenshots. |
378
- | `screenshotOnEvery` | `'test' \| 'failure' \| 'never'` | `'failure'` | When to take screenshots: after every test, only on test failure, or never. |
379
- | `includeVideoRecording` | `boolean` | `false` | Record the device screen for each test. |
380
- | `includeCommands` | `boolean` | `true` | Record every Appium / WebDriver command with timing and arguments. |
381
- | `includeAssertions` | `boolean` | `true` | Record WebdriverIO assertion steps (WDIO v9+). |
382
- | `deviceLogPollInterval` | `number` (ms) | `1000` | Interval between device log polls. Minimum value is `100`. |
383
- | `preferBiDi` | `boolean` | `true` | Use the WebDriver BiDi `log.entryAdded` event for console log capture when the driver supports it, falling back to polling otherwise. |
384
- | `redactPatterns` | `(string \| RegExp)[]` | `[]` | Additional patterns to redact from command arguments and log entries. Built-in patterns are always applied (see [Redaction](#redaction)). |
385
- | `quiet` | `boolean` | `false` | Suppress the console summary table printed at the end of a run. |
386
- | `metadata` | `Record<string, unknown>` | `null` | Arbitrary key-value pairs attached to the test run report. Useful for build numbers, branch names, or environment tags. |
387
- | `cloud` | `CloudReporterOptions` | — | Cloud upload configuration. See [Cloud Options](#cloud-options) below. |
388
-
389
- ### Cloud Options
390
-
391
- Passed as the `cloud` key inside the reporter options, or loaded automatically from `.testrelic/testrelic-config.json` and environment variables.
392
-
393
- | Option | Type | Default | Description |
394
- |--------|------|---------|-------------|
395
- | `apiKey` | `string` | — | TestRelic API key. Required for cloud upload. |
396
- | `endpoint` | `string` | `'https://platform.testrelic.ai/api/v1'` | TestRelic API endpoint. Override for self-hosted or staging environments. |
397
- | `upload` | `'batch' \| 'realtime' \| 'both'` | `'batch'` | Upload strategy. `'batch'` uploads after `onComplete`; `'realtime'` uploads results as each test finishes; `'both'` does both. |
398
- | `timeout` | `number` (ms) | — | HTTP request timeout for cloud API calls. |
399
- | `projectName` | `string` | — | Override the project name shown in the TestRelic dashboard. Defaults to the git repository name. |
400
- | `uploadArtifacts` | `boolean` | — | Whether to upload screenshots and video files as run artifacts. |
401
- | `artifactMaxSizeMb` | `number` | — | Maximum size in MB for a single artifact file to be uploaded. Files exceeding this limit are skipped. |
402
-
403
- ---
404
-
405
- ## Platform Setup
406
-
407
- ### Android
408
-
409
- **Prerequisites**
410
-
411
- - Node.js >= 20.19
412
- - Java JDK 17+
413
- - Windows 10/11, macOS, or Linux with hardware acceleration enabled for the emulator
414
-
415
- **Step 1 — Install Android SDK Command-Line Tools**
416
-
417
- Download from [developer.android.com/studio#command-line-tools-only](https://developer.android.com/studio#command-line-tools-only), extract to a directory (e.g. `C:\Android\cmdline-tools\latest\`), and set the following environment variables:
418
-
419
- ```powershell
420
- # Windows (PowerShell)
421
- [System.Environment]::SetEnvironmentVariable("ANDROID_HOME", "C:\Android", "User")
422
- [System.Environment]::SetEnvironmentVariable(
423
- "Path",
424
- "$env:Path;C:\Android\cmdline-tools\latest\bin;C:\Android\platform-tools;C:\Android\emulator",
425
- "User"
426
- )
427
- ```
428
-
429
- ```bash
430
- # macOS / Linux (~/.zshrc or ~/.bashrc)
431
- export ANDROID_HOME=$HOME/Android
432
- export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator
433
- ```
434
-
435
- Accept SDK licenses:
436
-
437
- ```bash
438
- sdkmanager --licenses
439
- ```
440
-
441
- **Step 2 — Install Platform Tools, Emulator, and System Image**
442
-
443
- ```bash
444
- sdkmanager "platform-tools" "emulator"
445
- sdkmanager "platforms;android-34"
446
- sdkmanager "system-images;android-34;google_apis;x86_64"
447
- ```
448
-
449
- **Step 3 — Create an Android Virtual Device**
450
-
451
- ```bash
452
- avdmanager create avd -n MyEmulator -k "system-images;android-34;google_apis;x86_64" -d "pixel_7"
453
- ```
454
-
455
- **Step 4 — Start the Emulator**
456
-
457
- ```bash
458
- emulator -avd MyEmulator -no-snapshot-load
459
- ```
460
-
461
- Wait for the emulator to fully boot, then verify:
462
-
463
- ```bash
464
- adb devices
465
- # emulator-5554 device
466
- ```
467
-
468
- **Step 5 — Install Appium and UiAutomator2 Driver**
469
-
470
- ```bash
471
- npm install -g appium@latest
472
- appium driver install uiautomator2
473
- ```
474
-
475
- Verify:
476
-
477
- ```bash
478
- appium --version # 3.x.x
479
- appium driver list --installed # uiautomator2
480
- ```
481
-
482
- **Step 6 — Start the Appium Server**
483
-
484
- ```bash
485
- appium --address 127.0.0.1 --port 4723
486
- ```
487
-
488
- For the full Android setup guide see [`docs/ANDROID_SETUP.md`](docs/ANDROID_SETUP.md).
489
-
490
- ---
491
-
492
- ### iOS
493
-
494
- > **macOS only.** iOS testing requires macOS 13+ with Xcode 15+. These tests cannot run on Windows or Linux.
495
-
496
- **Prerequisites**
497
-
498
- - macOS 13+ (Ventura or later recommended)
499
- - Xcode 15+ with iOS Simulator
500
- - Node.js >= 20.19
501
- - Xcode Command Line Tools: `xcode-select --install`
502
-
503
- **Step 1 — Install Appium and XCUITest Driver**
504
-
505
- ```bash
506
- npm install -g appium@latest
507
- appium driver install xcuitest
508
- ```
509
-
510
- Verify:
511
-
512
- ```bash
513
- appium driver list --installed # xcuitest
514
- ```
515
-
516
- **Step 2 — Boot an iOS Simulator**
517
-
518
- ```bash
519
- xcrun simctl boot "iPhone 15"
520
- open -a Simulator
521
- ```
522
-
523
- List available simulators if `iPhone 15` is not found:
524
-
525
- ```bash
526
- xcrun simctl list devices
527
- ```
528
-
529
- **Step 3 — Start the Appium Server**
530
-
531
- ```bash
532
- appium --address 127.0.0.1 --port 4723
533
- ```
534
-
535
- For the full iOS setup guide see [`docs/IOS_SETUP.md`](docs/IOS_SETUP.md).
536
-
537
- ---
538
-
539
- ## Cloud Upload
540
-
541
- Results can be uploaded to the TestRelic cloud platform. Cloud upload is optional — reports are always written locally regardless.
542
-
543
- ### Config File
544
-
545
- Create `.testrelic/testrelic-config.json` in your project root. The file is discovered automatically by the reporter:
546
-
547
- ```json
548
- {
549
- "cloud": {
550
- "apiKey": "<your-api-key>",
551
- "endpoint": "https://platform.testrelic.ai/api/v1",
552
- "upload": "batch"
553
- }
554
- }
555
- ```
556
-
557
- Add this file to `.gitignore` to keep your API key out of version control.
558
-
559
- ### Environment Variables
560
-
561
- | Variable | Description |
562
- |----------|-------------|
563
- | `TESTRELIC_API_KEY` | TestRelic API key |
564
- | `TESTRELIC_CLOUD_ENDPOINT` | API endpoint URL |
565
- | `TESTRELIC_UPLOAD_STRATEGY` | Upload strategy: `batch`, `realtime`, or `both` |
566
-
567
- Environment variables are the recommended approach for CI/CD pipelines.
568
-
569
- ### Priority Order
570
-
571
- Configuration is merged in the following order — higher entries win:
572
-
573
- 1. `TESTRELIC_API_KEY` / `TESTRELIC_CLOUD_ENDPOINT` / `TESTRELIC_UPLOAD_STRATEGY` environment variables
574
- 2. `cloud` inline options inside the `TestRelicReporter` options block in `wdio.conf.ts`
575
- 3. `.testrelic/testrelic-config.json` config file
576
-
577
- ---
578
-
579
- ## CLI
580
-
581
- The package installs a `testrelic-appium` binary automatically.
582
-
583
- **Merge multiple report files** (useful after parallel worker runs):
584
-
585
- ```bash
586
- npx testrelic-appium merge ./test-results/report-worker-1.json ./test-results/report-worker-2.json \
587
- -o ./test-results/merged-report.json
588
- ```
589
-
590
- **Serve a report directory** (serves at `http://127.0.0.1:9323` by default):
591
-
592
- ```bash
593
- npx testrelic-appium serve ./test-results
594
- npx testrelic-appium serve ./test-results --port 8080
595
- ```
596
-
597
- **Serve and open in browser** (alias for `serve` + auto-open):
598
-
599
- ```bash
600
- npx testrelic-appium open ./test-results
601
- ```
602
-
603
- ---
604
-
605
- ## Merging Reports
606
-
607
- When running tests across multiple WDIO workers, each worker writes its own JSON report. Use `mergeReports()` or the CLI `merge` command to combine them into a single timeline.
608
-
609
- **Programmatic merge** (`@testrelic/appium-analytics/merge`):
610
-
611
- ```ts
612
- import { mergeReports } from '@testrelic/appium-analytics/merge';
613
-
614
- await mergeReports(
615
- ['./test-results/report-1.json', './test-results/report-2.json'],
616
- { output: './test-results/merged.json' }
617
- );
618
- ```
619
-
620
- **CLI merge** (see [CLI](#cli) section above).
621
-
622
- ---
623
-
624
- ## Viewing Reports Locally
625
-
626
- After a test run, the HTML report is written to `htmlReportPath` (default: same location as `outputPath` with an `.html` extension) and opened automatically in your browser when `openReport: true` (the default).
627
-
628
- To view a report at any time without running tests:
629
-
630
- ```bash
631
- npx testrelic-appium serve ./test-results
632
- # Open http://127.0.0.1:9323 in your browser
633
- ```
634
-
635
- ---
636
-
637
- ## Redaction
638
-
639
- The reporter automatically redacts sensitive data from command arguments and log entries using the following built-in patterns:
640
-
641
- | Pattern | Matches |
642
- |---------|---------|
643
- | AWS-style access keys | 20-character alphanumeric strings starting with `AKIA`, `ASIA`, etc. |
644
- | Bearer tokens | Values following `Bearer ` in headers or strings |
645
- | PEM private keys | `-----BEGIN * PRIVATE KEY-----` blocks |
646
- | Embedded credentials | `//user:password@` in URLs |
647
-
648
- To add custom redaction patterns, use the `redactPatterns` option:
649
-
650
- ```ts
651
- [TestRelicService, {
652
- redactPatterns: [
653
- /my-secret-\w+/, // regex
654
- 'my-fixed-token-value', // literal string
655
- ],
656
- }]
657
- ```
658
-
659
- Custom patterns are appended to the built-in set — the built-in patterns are always active.
660
-
661
- ---
662
-
663
- ## Troubleshooting
664
-
665
- ### Android: emulator won't start
666
- - Enable Intel VT-x / AMD-V in BIOS settings
667
- - On Windows 11: ensure the Hyper-V platform feature is enabled in Windows Features
668
- - Try a cold boot: `emulator -avd MyEmulator -no-snapshot`
669
-
670
- ### Android: `adb` not found
671
- - Ensure `$ANDROID_HOME/platform-tools` is on your `PATH`
672
- - Run `adb kill-server && adb start-server` to reset the adb daemon
673
-
674
- ### Android: Appium cannot find UiAutomator2
675
- - Run `appium driver install uiautomator2` again
676
- - If using a non-default Appium home, set `APPIUM_HOME` to point to the correct directory
677
-
678
- ### Android: tests time out during session creation
679
- - Ensure the emulator is fully booted before starting tests (`adb devices` shows `device`, not `offline`)
680
- - Increase `connectionRetryTimeout` in your WDIO config
681
- - Verify that the APK path in capabilities is correct and the file exists
682
-
683
- ### iOS: `xcrun: error: unable to find utility`
684
- - Run `sudo xcode-select --switch /Applications/Xcode.app` to point to the correct Xcode installation
685
-
686
- ### iOS: simulator not found
687
- - Open Xcode > Settings > Platforms and download the required iOS Simulator runtime
688
- - List available simulators: `xcrun simctl list devices`
689
-
690
- ### iOS: WebDriverAgent build fails
691
- - Open `~/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj` in Xcode
692
- - Set a valid signing team under Signing & Capabilities
693
-
694
- ### Report not generated
695
- - Ensure `TestRelicService` is listed in `services` **and** `TestRelicReporter` is listed in `reporters` — both are required
696
- - Check that `outputPath` directories are writable by the process
697
-
698
- ---
699
-
700
- ## License
701
-
702
- MIT — see [LICENSE](LICENSE) for details.
703
-
704
- &copy; TestRelic AI &lt;hello@testrelic.ai&gt; — [testrelic.ai](https://testrelic.ai)