@sentinelqa/playwright-reporter 0.1.54 → 0.1.56

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 CHANGED
@@ -1,68 +1,38 @@
1
- # Playwright Reporter
1
+ # @sentinelqa/playwright-reporter
2
2
 
3
- After every failed Playwright run, Sentinel gives you:
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
  [![npm](https://img.shields.io/npm/v/@sentinelqa/playwright-reporter)](https://www.npmjs.com/package/@sentinelqa/playwright-reporter)
12
6
  [![downloads](https://img.shields.io/npm/dm/@sentinelqa/playwright-reporter)](https://www.npmjs.com/package/@sentinelqa/playwright-reporter)
13
7
  [![license](https://img.shields.io/npm/l/@sentinelqa/playwright-reporter)](./LICENSE)
14
8
 
15
- From failed CI run to root cause in seconds.
16
-
17
- Works with no account and no API key.
18
-
19
- ![Sentinel Report Example](./docs/screenshot2.png)
20
- ![CLI Quick Diagnosis](./docs/CLI2.png)
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
- - tell you what broke
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
- ## Features
13
+ ![CLI Output](./docs/cli.png)
34
14
 
35
- - Free hosted debugging links by default
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
- ## Why Teams Use It
45
-
46
- - You do not need to open raw logs first
47
- - Repeated failures collapse into a smaller number of real issues
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
- Add Sentinel to your Playwright config:
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,144 @@ export default withSentinel(
84
49
  );
85
50
  ```
86
51
 
87
- Run your tests:
52
+ Run tests normally:
88
53
 
89
54
  ```bash
90
55
  npx playwright test
91
56
  ```
92
57
 
93
- If tests fail, Sentinel uploads the run and prints a shareable link in the terminal.
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.
72
+
73
+ ## Modes
74
+
75
+ Sentinel behavior is controlled by `SENTINEL_MODE`.
76
+
77
+ ## Pricing Tiers (How This Maps)
78
+
79
+ - **Community (Open Source)**
80
+ - “Everything local”: generate the same report UI fully offline, no upload required.
81
+ - “Bring your own storage + DB”: artifacts and metadata stay in your VPC (S3/GCS + Postgres).
82
+ - “Deterministic root-cause clustering”: same grouping logic as the hosted product, no AI guessing.
83
+ - “No limits”: unlimited runs because you own infra.
84
+ - “Security posture”: secrets masking happens before anything leaves your environment (and in offline, nothing leaves).
85
+ - Share links are optional: run in hosted mode when you want a public URL, or offline mode for zero egress.
86
+
87
+ - **Personal ($0)**
88
+ - “Zero setup”: install + run, auto-upload on failures.
89
+ - “Share links for PRs”: reviewers open a read-only report without reproducing locally.
90
+ - “Retention”: keep enough history to see patterns (200 runs / 14 days).
91
+ - “Safe-by-default”: automatic secret masking before upload.
92
+ - “Works with shards”: parallel jobs still collapse into root-cause clusters.
93
+
94
+ - **Pro ($50/mo)**
95
+ - “Stop repeating fixes”: recurring failure tracking across commits (first seen, frequency, impact).
96
+ - “Compare runs”: last known good vs now, isolate what changed.
97
+ - “Team workflow”: shared workspace, multiple projects, roles.
98
+ - “High volume”: 10,000 run history and longer retention.
99
+ - “Faster decision making”: regressions vs flakes becomes obvious (trend + history).
100
+
101
+ The reporter package works in all tiers; the difference is where reports live and how much history you get.
102
+
103
+ ### Hosted Mode (Default)
104
+
105
+ Do nothing. Sentinel uploads and prints a share link when failures happen.
106
+
107
+ Environment:
108
+
109
+ - `SENTINEL_MODE` unset (or `SENTINEL_MODE=hosted`)
110
+
111
+ ### Workspace Mode (Private History)
112
+
113
+ If you have a workspace token:
114
+
115
+ ```bash
116
+ SENTINEL_TOKEN=your_project_ingest_token npx playwright test
117
+ ```
118
+
119
+ Environment:
94
120
 
95
- ## CLI Output
121
+ - `SENTINEL_MODE` unset (or `SENTINEL_MODE=hosted`)
122
+ - `SENTINEL_TOKEN=...`
96
123
 
97
- On failed runs, Sentinel prints a compact diagnosis that answers:
124
+ ### Offline Mode (No Uploads)
98
125
 
99
- 1. What failed?
100
- 2. What caused it?
101
- 3. Where is it?
102
- 4. What should I check next?
126
+ To keep everything local:
127
+
128
+ ```bash
129
+ SENTINEL_MODE=offline npx playwright test
130
+ ```
103
131
 
104
- Typical output:
132
+ Offline mode is strict:
105
133
 
106
- ```text
107
- Sentinel diagnosis
108
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
134
+ - uploads are skipped
135
+ - a local report is generated (default `./sentinel-report/index.html`)
136
+ - the CLI prints a local `file://` link (or a relative path)
109
137
 
110
- RECURRING FAILURE (12 previous runs)
138
+ If a hosted upload fails, Sentinel falls back to generating the local report automatically.
111
139
 
112
- 4 failures (grouped)
113
- Collapsed into 2 real issues
140
+ ### Local Workspace Uploads (When Not In CI)
114
141
 
115
- Issue 1: Blocked click on getByRole('button', { name: 'Save' }) (3 tests)
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
142
+ If you set `SENTINEL_TOKEN` locally, Sentinel will _not_ upload by default (to avoid accidental data egress).
143
+ To allow a local upload to your workspace, set:
122
144
 
123
- Issue 2: Assertion mismatch (getByTestId('metric-pass-rate')) (1 test)
124
- Cause: getByTestId('metric-pass-rate') showed "88%" instead of "100%"
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
145
+ ```bash
146
+ SENTINEL_UPLOAD_LOCAL=1 SENTINEL_TOKEN=your_project_ingest_token npx playwright test
131
147
  ```
132
148
 
133
- On passed runs, Sentinel stays quiet unless there is a strong risk signal worth surfacing.
149
+ This is useful for quickly generating a private run history entry from your laptop.
150
+
151
+ ### Implicit Local Public Upload (No Token, Not In CI)
134
152
 
135
- ## What The Shared Report Shows
153
+ If you are not in CI and you did not set `SENTINEL_TOKEN`, Sentinel can still upload in public mode by enabling:
136
154
 
137
- The hosted report is simple on purpose.
155
+ ```bash
156
+ SENTINEL_UPLOAD_LOCAL=1 npx playwright test
157
+ ```
138
158
 
139
- It focuses on:
159
+ ### Share Links Are Optional (Open Source / Self-Hosted)
140
160
 
141
- - grouped failures
142
- - explanation of why each issue failed
143
- - affected tests
144
- - artifacts
145
- - recent history
161
+ - Hosted mode prints a share URL on failures.
162
+ - Offline mode skips uploads and produces only a local report.
146
163
 
147
- Open the link to inspect:
164
+ Pick the behavior explicitly with `SENTINEL_MODE` (and `SENTINEL_UPLOAD_LOCAL` for local uploads).
148
165
 
149
- - failures grouped by likely root cause
150
- - whether multiple failures appear related
151
- - the best available explanation for each issue
152
- - screenshots, traces, videos, and logs
153
- - direct links you can share with the rest of the team
166
+ ## Serving Local Reports
154
167
 
155
- ## Free Hosted Mode
168
+ Local reports are static HTML + copied artifacts. You can open `index.html` directly, or run a tiny local server:
169
+
170
+ ```bash
171
+ cd sentinel-report
172
+ npx --yes serve -p 4173 .
173
+ ```
156
174
 
157
- If `SENTINEL_TOKEN` is not set, the reporter uploads the run to a free hosted Sentinel report and prints the public share URL.
175
+ Then open `http://localhost:4173`.
158
176
 
159
- This free flow includes:
177
+ ## Secrets Masking
160
178
 
161
- - CLI diagnosis
162
- - hosted run page
163
- - grouped failures
164
- - failure explanation
165
- - public share links
179
+ Sentinel masks common secret patterns before data is shared. This includes:
166
180
 
167
- ## Optional Richer Capture
181
+ - environment-variable looking strings
182
+ - common credential/token patterns
183
+ - internal URLs/hosts (where possible)
168
184
 
169
- `withSentinel()` works on its own and is the simplest setup.
185
+ If you find something that should be masked but isn’t, file an issue with a minimal reproducible example (redact the secret).
170
186
 
171
- If you want richer failure evidence, you can also attach the failure capture fixture:
187
+ ## Optional: Richer Failure Evidence
188
+
189
+ `withSentinel()` is enough for most setups. If you want richer UI evidence for actionability/timeouts, you can attach the failure capture fixture:
172
190
 
173
191
  ```ts
174
192
  // tests/test.ts
@@ -185,24 +203,7 @@ Then import from that file in your specs:
185
203
  import { test, expect } from "./test";
186
204
  ```
187
205
 
188
- This improves the quality of:
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
206
+ ## Configuration Options
206
207
 
207
208
  ```ts
208
209
  withSentinel(config, {
@@ -215,12 +216,23 @@ withSentinel(config, {
215
216
  });
216
217
  ```
217
218
 
218
- ## Workspace
219
+ ## Troubleshooting
219
220
 
220
- If you want private run history, recurring issue tracking, and team access, sign up for a Sentinel workspace and set `SENTINEL_TOKEN`.
221
+ ### “POST /api/runs failed …”
221
222
 
222
- ```bash
223
- SENTINEL_TOKEN=your_project_ingest_token npx playwright test
224
- ```
223
+ - Check `SENTINEL_MODE` (offline skips uploads).
224
+ - If using a workspace token, confirm `SENTINEL_TOKEN` is correct.
225
+ - If a server schema changed, upgrade the reporter/uploader and/or run DB migrations for self-hosted deployments.
226
+
227
+ ### “Local report generation failed …”
228
+
229
+ Make sure Playwright produced:
230
+
231
+ - `playwright-report/report.json`
232
+ - `test-results/` (or your configured `outputDir`)
233
+
234
+ Then rerun with `SENTINEL_MODE=offline` to force local generation.
235
+
236
+ ## License
225
237
 
226
- Create a workspace at [sentinelqa.com/register](https://sentinelqa.com/register).
238
+ See [LICENSE](./LICENSE).