@testrelic/playwright-analytics 2.4.10-next.6 → 2.4.10-next.8
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.
- package/README.md +69 -1
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -22,10 +22,27 @@ When you run your Playwright tests with the TestRelic reporter and fixture, you
|
|
|
22
22
|
|
|
23
23
|
### 1. Install
|
|
24
24
|
|
|
25
|
+
Install `@testrelic/playwright-analytics` alongside `@playwright/test` (a required peer dependency):
|
|
26
|
+
|
|
25
27
|
```bash
|
|
26
|
-
npm
|
|
28
|
+
# npm
|
|
29
|
+
npm install -D @playwright/test @testrelic/playwright-analytics
|
|
30
|
+
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add -D @playwright/test @testrelic/playwright-analytics
|
|
33
|
+
|
|
34
|
+
# yarn
|
|
35
|
+
yarn add -D @playwright/test @testrelic/playwright-analytics
|
|
27
36
|
```
|
|
28
37
|
|
|
38
|
+
If your project already has `@playwright/test` installed, just add `@testrelic/playwright-analytics`. Any version `>=1.35.0` of Playwright is compatible.
|
|
39
|
+
|
|
40
|
+
#### Installation notes
|
|
41
|
+
|
|
42
|
+
- **Peer dependency:** `@playwright/test` must be a direct dependency in the same project. If you see a peer dependency warning from pnpm or npm after installing only `@testrelic/playwright-analytics`, install `@playwright/test` explicitly as shown above — this is a tooling hint, not a TestRelic bug.
|
|
43
|
+
|
|
44
|
+
- **Postinstall:** On a fresh install (outside CI), the package prints a line like `[testrelic] Created .testrelic/testrelic-config.json`. This is intentional — it scaffolds a config file at your project root for cloud upload. Update `testrelic-repo.name` to match your project and set `TESTRELIC_API_KEY` in your environment before using cloud features. In CI environments where `CI=true` or `CI=1`, the script is skipped automatically; create the config file manually if needed. See [Cloud Integration](#cloud-integration) for full details.
|
|
45
|
+
|
|
29
46
|
### 2. Add the reporter to your Playwright config
|
|
30
47
|
|
|
31
48
|
**Option A: Use `defineConfig` (recommended)** — automatically enables video, screenshots, trace capture, and the TestRelic reporter:
|
|
@@ -125,6 +142,57 @@ npx playwright test
|
|
|
125
142
|
|
|
126
143
|
The JSON report will be written to `./test-results/analytics-timeline.json` and the HTML report to `./test-results/analytics-timeline.html`.
|
|
127
144
|
|
|
145
|
+
## Troubleshooting
|
|
146
|
+
|
|
147
|
+
### `require() of ES Module … fixture.js`
|
|
148
|
+
|
|
149
|
+
**Symptom:** Running `npx playwright test` throws an error like:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
Error [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/@testrelic/playwright-analytics/dist/fixture.js not supported.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Cause:** Your project's TypeScript or Playwright configuration compiles test files as **CommonJS**. When a CJS module calls `require('@testrelic/playwright-analytics/fixture')`, some toolchains mis-resolve the subpath export to the ESM build (`fixture.js`) instead of the CJS build (`fixture.cjs`).
|
|
156
|
+
|
|
157
|
+
**Fix — Option A (recommended): Run tests as ESM**
|
|
158
|
+
|
|
159
|
+
Add `"type": "module"` to your project's `package.json`, or configure TypeScript to emit ESM:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
// package.json
|
|
163
|
+
{ "type": "module" }
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
```jsonc
|
|
167
|
+
// tsconfig.json
|
|
168
|
+
{
|
|
169
|
+
"compilerOptions": {
|
|
170
|
+
"module": "NodeNext", // or "ESNext"
|
|
171
|
+
"moduleResolution": "NodeNext"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Fix — Option B: Use the explicit CJS subpath**
|
|
177
|
+
|
|
178
|
+
Import the CJS build via the dedicated subpath export (no deep `node_modules` path needed):
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
// base-test.ts or your fixture wrapper
|
|
182
|
+
import { test, expect } from '@testrelic/playwright-analytics/fixture/cjs';
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// api tests
|
|
187
|
+
import { testRelicApiFixture } from '@testrelic/playwright-analytics/api-fixture/cjs';
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
This is stable across version upgrades and pnpm/npm layouts.
|
|
191
|
+
|
|
192
|
+
### `[testrelic] No API key configured`
|
|
193
|
+
|
|
194
|
+
This message is printed when `TESTRELIC_API_KEY` is not set in the environment the test process sees. **Local HTML/JSON reports are still written** — this only affects cloud upload. Set the key in your shell or CI secrets; see [Cloud Integration](#cloud-integration).
|
|
195
|
+
|
|
128
196
|
## Cloud Integration
|
|
129
197
|
|
|
130
198
|
TestRelic can upload test results, action steps, artifacts (screenshots, videos), and network logs directly to the [TestRelic cloud platform](https://platform.testrelic.ai) for team-wide visibility, historical tracking, and the interactive Steps dashboard.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testrelic/playwright-analytics",
|
|
3
|
-
"version": "2.4.10-next.
|
|
3
|
+
"version": "2.4.10-next.8",
|
|
4
4
|
"description": "Playwright test analytics reporter with E2E navigation tracking, API call capture, network stats, failure diagnostics, and interactive HTML reports",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"playwright",
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"default": "./dist/fixture.cjs"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
+
"./fixture/cjs": {
|
|
51
|
+
"types": "./dist/fixture.d.cts",
|
|
52
|
+
"default": "./dist/fixture.cjs"
|
|
53
|
+
},
|
|
50
54
|
"./api-fixture": {
|
|
51
55
|
"import": {
|
|
52
56
|
"types": "./dist/api-fixture.d.ts",
|
|
@@ -57,6 +61,10 @@
|
|
|
57
61
|
"default": "./dist/api-fixture.cjs"
|
|
58
62
|
}
|
|
59
63
|
},
|
|
64
|
+
"./api-fixture/cjs": {
|
|
65
|
+
"types": "./dist/api-fixture.d.cts",
|
|
66
|
+
"default": "./dist/api-fixture.cjs"
|
|
67
|
+
},
|
|
60
68
|
"./merge": {
|
|
61
69
|
"import": {
|
|
62
70
|
"types": "./dist/merge.d.ts",
|
|
@@ -82,7 +90,7 @@
|
|
|
82
90
|
"@playwright/test": ">=1.35.0"
|
|
83
91
|
},
|
|
84
92
|
"dependencies": {
|
|
85
|
-
"@testrelic/core": "2.4.10-next.
|
|
93
|
+
"@testrelic/core": "2.4.10-next.8"
|
|
86
94
|
},
|
|
87
95
|
"devDependencies": {
|
|
88
96
|
"@playwright/test": "^1.35.0",
|