@sentinelqa/playwright-reporter 0.1.54 → 0.1.57
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 +116 -130
- package/dist/localReport.js +453 -3
- package/dist/mode.d.ts +2 -0
- package/dist/mode.js +16 -0
- package/dist/quickDiagnosis.js +92 -161
- package/dist/reporter.d.ts +1 -0
- package/dist/reporter.js +56 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,68 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sentinelqa/playwright-reporter
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- a clear CLI diagnosis
|
|
6
|
-
- a shareable debugging link
|
|
7
|
-
- grouped failures by likely root cause
|
|
8
|
-
|
|
9
|
-
Sample run: https://app.sentinelqa.com/share/1f343d91-be17-4c14-b1b9-2d4e8ef448d2
|
|
3
|
+
Deterministic Playwright failure triage: CLI diagnosis, root-cause grouping, and a shareable debugging report.
|
|
10
4
|
|
|
11
5
|
[](https://www.npmjs.com/package/@sentinelqa/playwright-reporter)
|
|
12
6
|
[](https://www.npmjs.com/package/@sentinelqa/playwright-reporter)
|
|
13
7
|
[](./LICENSE)
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Works with no account and no API key.
|
|
18
|
-
|
|
19
|
-

|
|
20
|
-

|
|
21
|
-
|
|
22
|
-
## What It Does
|
|
23
|
-
|
|
24
|
-
Sentinel explains Playwright failures locally, groups them into real root causes, and gives you a shareable link to inspect the run.
|
|
25
|
-
|
|
26
|
-
The open-source reporter is focused on one job:
|
|
9
|
+
## What You Get
|
|
27
10
|
|
|
28
|
-
|
|
29
|
-
- show why it failed
|
|
30
|
-
- point to the likely root cause
|
|
31
|
-
- tell you what to check next
|
|
11
|
+
SAMPLE REPORT: https://sentinelqa.com/share/run/permanent-demo-playwright-report
|
|
32
12
|
|
|
33
|
-
|
|
13
|
+

|
|
34
14
|
|
|
35
|
-
|
|
36
|
-
- Deterministic CLI diagnosis after failed runs
|
|
37
|
-
- Failure grouping by likely root cause
|
|
38
|
-
- Shared run page with traces, screenshots, videos, and logs
|
|
39
|
-
- Failure pages that explain what broke, why, where, and what to do next
|
|
40
|
-
- Better timeout, actionability, assertion, navigation, and backend failure wording
|
|
41
|
-
- Public share links that are easy to paste into Slack, PRs, and issues
|
|
42
|
-
- Works with existing Playwright reporter setup
|
|
15
|
+
After a failed Playwright run, Sentinel prints:
|
|
43
16
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
- The CLI explains the failure immediately in CI
|
|
49
|
-
- Anyone on the team can open the same shared debugging link
|
|
50
|
-
- The hosted report keeps the explanation, artifacts, and grouped failures in one place
|
|
17
|
+
- a deterministic CLI diagnosis (1–3 root causes)
|
|
18
|
+
- how many tests are affected per root cause
|
|
19
|
+
- what to inspect first (usually trace)
|
|
20
|
+
- a report link (hosted by default, local in offline mode)
|
|
51
21
|
|
|
52
22
|
## Requirements
|
|
53
23
|
|
|
54
24
|
- Node.js 18+
|
|
55
|
-
- `@playwright/test` 1.40+
|
|
56
|
-
|
|
57
|
-
## Quick Start
|
|
25
|
+
- `@playwright/test` 1.40+ (newer is recommended)
|
|
58
26
|
|
|
59
|
-
Install
|
|
27
|
+
## Install
|
|
60
28
|
|
|
61
29
|
```bash
|
|
62
30
|
npm install -D @sentinelqa/playwright-reporter
|
|
63
31
|
```
|
|
64
32
|
|
|
65
|
-
|
|
33
|
+
## Setup (Recommended)
|
|
34
|
+
|
|
35
|
+
Wrap your `playwright.config.ts`:
|
|
66
36
|
|
|
67
37
|
```ts
|
|
68
38
|
import { defineConfig } from "@playwright/test";
|
|
@@ -72,11 +42,6 @@ export default withSentinel(
|
|
|
72
42
|
defineConfig({
|
|
73
43
|
reporter: [["line"]],
|
|
74
44
|
outputDir: "test-results",
|
|
75
|
-
use: {
|
|
76
|
-
trace: "retain-on-failure",
|
|
77
|
-
screenshot: "only-on-failure",
|
|
78
|
-
video: "retain-on-failure",
|
|
79
|
-
},
|
|
80
45
|
}),
|
|
81
46
|
{
|
|
82
47
|
project: "my-app",
|
|
@@ -84,91 +49,118 @@ export default withSentinel(
|
|
|
84
49
|
);
|
|
85
50
|
```
|
|
86
51
|
|
|
87
|
-
Run
|
|
52
|
+
Run tests normally:
|
|
88
53
|
|
|
89
54
|
```bash
|
|
90
55
|
npx playwright test
|
|
91
56
|
```
|
|
92
57
|
|
|
93
|
-
|
|
58
|
+
## How It Works (High Level)
|
|
59
|
+
|
|
60
|
+
Sentinel is a Playwright reporter that:
|
|
61
|
+
|
|
62
|
+
1. Ensures a Playwright JSON report exists (adds a JSON reporter if needed).
|
|
63
|
+
2. Collects the artifacts Playwright already produces (`trace.zip`, screenshots, video, logs, report.json).
|
|
64
|
+
3. Builds a **deterministic** failure summary:
|
|
65
|
+
- groups repeated failures into 1–3 canonical root causes
|
|
66
|
+
- extracts normalized evidence (where, blocker, target state, expected/received)
|
|
67
|
+
4. Publishes a report:
|
|
68
|
+
- default: a hosted share link
|
|
69
|
+
- offline: a local HTML report folder (no upload)
|
|
70
|
+
|
|
71
|
+
This project is intentionally heuristic-driven (not “AI guesses”) for root-cause grouping.
|
|
94
72
|
|
|
95
|
-
##
|
|
73
|
+
## Modes
|
|
96
74
|
|
|
97
|
-
|
|
75
|
+
Sentinel behavior is controlled by `SENTINEL_MODE`.
|
|
98
76
|
|
|
99
|
-
|
|
100
|
-
2. What caused it?
|
|
101
|
-
3. Where is it?
|
|
102
|
-
4. What should I check next?
|
|
77
|
+
### Hosted Mode (Default)
|
|
103
78
|
|
|
104
|
-
|
|
79
|
+
Do nothing. Sentinel uploads and prints a share link when failures happen.
|
|
105
80
|
|
|
106
|
-
|
|
107
|
-
Sentinel diagnosis
|
|
108
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
81
|
+
Environment:
|
|
109
82
|
|
|
110
|
-
|
|
83
|
+
- `SENTINEL_MODE` unset (or `SENTINEL_MODE=hosted`)
|
|
111
84
|
|
|
112
|
-
|
|
113
|
-
Collapsed into 2 real issues
|
|
85
|
+
### Workspace Mode (Private History)
|
|
114
86
|
|
|
115
|
-
|
|
116
|
-
Cause: .modal-backdrop intercepted pointer events before the click completed
|
|
117
|
-
Where: checkout.spec.ts:22; billing.spec.ts:41
|
|
118
|
-
Failing step: Click on getByRole('button', { name: 'Save' }) selector
|
|
119
|
-
Blocker: .modal-backdrop intercepting pointer events
|
|
120
|
-
Likely fix: dismiss or wait for .modal-backdrop to disappear before clicking Save
|
|
121
|
-
Impact: 3 tests failing with same root cause
|
|
87
|
+
If you have a workspace token:
|
|
122
88
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Where: app.spec.ts:68
|
|
126
|
-
Failing step: Expect text on getByTestId('metric-pass-rate') selector
|
|
127
|
-
Expected: 100%
|
|
128
|
-
Received: 88%
|
|
129
|
-
Likely fix: fix the UI state or data behind getByTestId('metric-pass-rate') so it shows "100%"
|
|
130
|
-
Impact: 1 test failing with this root cause
|
|
89
|
+
```bash
|
|
90
|
+
SENTINEL_TOKEN=your_project_ingest_token npx playwright test
|
|
131
91
|
```
|
|
132
92
|
|
|
133
|
-
|
|
93
|
+
Environment:
|
|
94
|
+
|
|
95
|
+
- `SENTINEL_MODE` unset (or `SENTINEL_MODE=hosted`)
|
|
96
|
+
- `SENTINEL_TOKEN=...`
|
|
97
|
+
|
|
98
|
+
### Offline Mode (No Uploads)
|
|
99
|
+
|
|
100
|
+
To keep everything local:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
SENTINEL_MODE=offline npx playwright test
|
|
104
|
+
```
|
|
134
105
|
|
|
135
|
-
|
|
106
|
+
Offline mode is strict:
|
|
136
107
|
|
|
137
|
-
|
|
108
|
+
- uploads are skipped
|
|
109
|
+
- a local report is generated (default `./sentinel-report/index.html`)
|
|
110
|
+
- the CLI prints a local `file://` link (or a relative path)
|
|
138
111
|
|
|
139
|
-
|
|
112
|
+
If a hosted upload fails, Sentinel falls back to generating the local report automatically.
|
|
140
113
|
|
|
141
|
-
|
|
142
|
-
- explanation of why each issue failed
|
|
143
|
-
- affected tests
|
|
144
|
-
- artifacts
|
|
145
|
-
- recent history
|
|
114
|
+
### Local Workspace Uploads (When Not In CI)
|
|
146
115
|
|
|
147
|
-
|
|
116
|
+
If you set `SENTINEL_TOKEN` locally, Sentinel will _not_ upload by default (to avoid accidental data egress).
|
|
117
|
+
To allow a local upload to your workspace, set:
|
|
148
118
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- screenshots, traces, videos, and logs
|
|
153
|
-
- direct links you can share with the rest of the team
|
|
119
|
+
```bash
|
|
120
|
+
SENTINEL_UPLOAD_LOCAL=1 SENTINEL_TOKEN=your_project_ingest_token npx playwright test
|
|
121
|
+
```
|
|
154
122
|
|
|
155
|
-
|
|
123
|
+
This is useful for quickly generating a private run history entry from your laptop.
|
|
156
124
|
|
|
157
|
-
|
|
125
|
+
### Implicit Local Public Upload (No Token, Not In CI)
|
|
158
126
|
|
|
159
|
-
|
|
127
|
+
If you are not in CI and you did not set `SENTINEL_TOKEN`, Sentinel can still upload in public mode by enabling:
|
|
160
128
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- failure explanation
|
|
165
|
-
- public share links
|
|
129
|
+
```bash
|
|
130
|
+
SENTINEL_UPLOAD_LOCAL=1 npx playwright test
|
|
131
|
+
```
|
|
166
132
|
|
|
167
|
-
|
|
133
|
+
### Share Links Are Optional (Open Source / Self-Hosted)
|
|
168
134
|
|
|
169
|
-
|
|
135
|
+
- Hosted mode prints a share URL on failures.
|
|
136
|
+
- Offline mode skips uploads and produces only a local report.
|
|
170
137
|
|
|
171
|
-
|
|
138
|
+
Pick the behavior explicitly with `SENTINEL_MODE` (and `SENTINEL_UPLOAD_LOCAL` for local uploads).
|
|
139
|
+
|
|
140
|
+
## Serving Local Reports
|
|
141
|
+
|
|
142
|
+
Local reports are static HTML + copied artifacts. You can open `index.html` directly, or run a tiny local server:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
cd sentinel-report
|
|
146
|
+
npx --yes serve -p 4173 .
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Then open `http://localhost:4173`.
|
|
150
|
+
|
|
151
|
+
## Secrets Masking
|
|
152
|
+
|
|
153
|
+
Sentinel masks common secret patterns before data is shared. This includes:
|
|
154
|
+
|
|
155
|
+
- environment-variable looking strings
|
|
156
|
+
- common credential/token patterns
|
|
157
|
+
- internal URLs/hosts (where possible)
|
|
158
|
+
|
|
159
|
+
If you find something that should be masked but isn’t, file an issue with a minimal reproducible example (redact the secret).
|
|
160
|
+
|
|
161
|
+
## Optional: Richer Failure Evidence
|
|
162
|
+
|
|
163
|
+
`withSentinel()` is enough for most setups. If you want richer UI evidence for actionability/timeouts, you can attach the failure capture fixture:
|
|
172
164
|
|
|
173
165
|
```ts
|
|
174
166
|
// tests/test.ts
|
|
@@ -185,24 +177,7 @@ Then import from that file in your specs:
|
|
|
185
177
|
import { test, expect } from "./test";
|
|
186
178
|
```
|
|
187
179
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
- blocked action diagnosis
|
|
191
|
-
- assertion mismatch diagnosis
|
|
192
|
-
- timeout explanations
|
|
193
|
-
- DOM and state evidence in the report
|
|
194
|
-
|
|
195
|
-
## What `withSentinel()` Does
|
|
196
|
-
|
|
197
|
-
- Preserves your existing reporter configuration
|
|
198
|
-
- Injects a Playwright JSON reporter if one is missing
|
|
199
|
-
- Sets sensible artifact defaults:
|
|
200
|
-
- trace: `retain-on-failure`
|
|
201
|
-
- screenshot: `only-on-failure`
|
|
202
|
-
- video: `retain-on-failure`
|
|
203
|
-
- Uploads the run to Sentinel at the end of the test run
|
|
204
|
-
|
|
205
|
-
## Options
|
|
180
|
+
## Configuration Options
|
|
206
181
|
|
|
207
182
|
```ts
|
|
208
183
|
withSentinel(config, {
|
|
@@ -215,12 +190,23 @@ withSentinel(config, {
|
|
|
215
190
|
});
|
|
216
191
|
```
|
|
217
192
|
|
|
218
|
-
##
|
|
193
|
+
## Troubleshooting
|
|
219
194
|
|
|
220
|
-
|
|
195
|
+
### “POST /api/runs failed …”
|
|
221
196
|
|
|
222
|
-
|
|
223
|
-
SENTINEL_TOKEN
|
|
224
|
-
|
|
197
|
+
- Check `SENTINEL_MODE` (offline skips uploads).
|
|
198
|
+
- If using a workspace token, confirm `SENTINEL_TOKEN` is correct.
|
|
199
|
+
- If a server schema changed, upgrade the reporter/uploader and/or run DB migrations for self-hosted deployments.
|
|
200
|
+
|
|
201
|
+
### “Local report generation failed …”
|
|
202
|
+
|
|
203
|
+
Make sure Playwright produced:
|
|
204
|
+
|
|
205
|
+
- `playwright-report/report.json`
|
|
206
|
+
- `test-results/` (or your configured `outputDir`)
|
|
207
|
+
|
|
208
|
+
Then rerun with `SENTINEL_MODE=offline` to force local generation.
|
|
209
|
+
|
|
210
|
+
## License
|
|
225
211
|
|
|
226
|
-
|
|
212
|
+
See [LICENSE](./LICENSE).
|