@sentinelqa/playwright-reporter 0.1.53 → 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,210 +1,192 @@
1
- # Playwright Reporter
1
+ # @sentinelqa/playwright-reporter
2
2
 
3
- After every failed run, reporter prints a shareable debugging link:
4
-
5
- Sample run: https://app.sentinelqa.com/share/1f343d91-be17-4c14-b1b9-2d4e8ef448d2
6
-
7
- Open it to inspect failures instantly or share it in Slack, PRs, or GitHub issues.
3
+ Deterministic Playwright failure triage: CLI diagnosis, root-cause grouping, and a shareable debugging report.
8
4
 
9
5
  [![npm](https://img.shields.io/npm/v/@sentinelqa/playwright-reporter)](https://www.npmjs.com/package/@sentinelqa/playwright-reporter)
10
6
  [![downloads](https://img.shields.io/npm/dm/@sentinelqa/playwright-reporter)](https://www.npmjs.com/package/@sentinelqa/playwright-reporter)
11
7
  [![license](https://img.shields.io/npm/l/@sentinelqa/playwright-reporter)](./LICENSE)
12
8
 
13
- From failed CI run → root cause in seconds.
14
- Get a shareable Playwright debugging link with traces, screenshots, and failure context — no setup required.
9
+ ## What You Get
15
10
 
16
- Works with no account or API key required.
11
+ SAMPLE REPORT: https://sentinelqa.com/share/run/permanent-demo-playwright-report
17
12
 
18
- Use it to get a shareable hosted run link from CI or local development, then upgrade to Sentinel Cloud for richer history and intelligence.
13
+ ![CLI Output](./docs/cli.png)
19
14
 
20
- ![Sentinel Report Example](./docs/screenshot2.png)
21
- ![CLI Quick Diagnosis](./docs/CLI1.png)
15
+ After a failed Playwright run, Sentinel prints:
22
16
 
23
- ## Features
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)
24
21
 
25
- - Free hosted debugging links by default, with no account or API key required
26
- - Public run page that opens on unified failures across the run
27
- - Within-run failure grouping so repeated failures collapse into one issue
28
- - Public failure pages with screenshots, evidence, parsed errors and light summaries
29
- - Copyable share actions for Slack, PRs, and debugging handoff
30
- - Deterministic quick diagnosis in the terminal after failed runs
31
- - Playwright traces, screenshots, videos and logs uploaded automatically
32
- - 48-hour public share links on the free hosted flow
33
- - Works with existing Playwright reporter setup
34
- - Optional live failure capture for richer Sentinel Cloud analysis
35
- - CI run history, retention, and deeper AI debugging in Sentinel Cloud
22
+ ## Requirements
36
23
 
37
- ## Why this exists
24
+ - Node.js 18+
25
+ - `@playwright/test` 1.40+ (newer is recommended)
38
26
 
39
- Debugging Playwright failures usually means downloading traces, screenshots, and logs separately from CI.
27
+ ## Install
40
28
 
41
- Reporter uploads those artifacts into a single hosted Sentinel run page so you can open one link, inspect failures fast, and share that link with the rest of the team.
29
+ ```bash
30
+ npm install -D @sentinelqa/playwright-reporter
31
+ ```
42
32
 
43
- ## CLI diagnosis
33
+ ## Setup (Recommended)
44
34
 
45
- Sentinel is not just a report link.
35
+ Wrap your `playwright.config.ts`:
46
36
 
47
- On failed runs, it prints a compact terminal diagnosis that answers:
37
+ ```ts
38
+ import { defineConfig } from "@playwright/test";
39
+ import { withSentinel } from "@sentinelqa/playwright-reporter";
48
40
 
49
- 1. what broke
50
- 2. why it broke
51
- 3. where to look
52
- 4. what changed
53
- 5. what to do next
41
+ export default withSentinel(
42
+ defineConfig({
43
+ reporter: [["line"]],
44
+ outputDir: "test-results",
45
+ }),
46
+ {
47
+ project: "my-app",
48
+ },
49
+ );
50
+ ```
54
51
 
55
- The goal is simple:
52
+ Run tests normally:
56
53
 
57
- you should not need to open logs first.
54
+ ```bash
55
+ npx playwright test
56
+ ```
58
57
 
59
- Typical CLI output:
58
+ ## How It Works (High Level)
60
59
 
61
- ```text
62
- Sentinel diagnosis
63
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
60
+ Sentinel is a Playwright reporter that:
64
61
 
65
- NEW FAILURE after 8 passing runs
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)
66
70
 
67
- What broke: 10 tests failed
68
- Why: collapsed into 2 real issues
71
+ This project is intentionally heuristic-driven (not “AI guesses”) for root-cause grouping.
69
72
 
70
- Issue 1: UI assertion mismatch (6 tests)
71
- Why: getByTestId('metric-pass-rate') showed "82%" instead of "88%"
72
- Where: app.spec.ts:43, app.spec.ts:69
73
- Expected: 88%
74
- Received: 82%
75
- What changed: "update analytics cards"
76
- Next: verify getByTestId('metric-pass-rate')
77
- Impact: 6 tests failing with same root cause
78
- Clears: fixing this likely clears 6 of 10 failures
79
- ```
73
+ ## Modes
80
74
 
81
- On passed runs, Sentinel stays short and only prints a warning if there is a strong risk signal worth caring about.
75
+ Sentinel behavior is controlled by `SENTINEL_MODE`.
82
76
 
83
- ## Why teams use the free version
77
+ ## Pricing Tiers (How This Maps)
84
78
 
85
- - Drop one wrapper into `playwright.config.ts` and keep running `npx playwright test`
86
- - Get a hosted Sentinel debugging link automatically on failed runs
87
- - Share one public URL in Slack, PRs, or GitHub issues instead of passing around raw CI artifacts
88
- - See unified failures, grouped failure patterns, screenshots, and evidence in one place
89
- - Let teammates inspect the failure without needing your CI system or local machine
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.
90
86
 
91
- ## Requirements
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.
92
93
 
93
- - Node.js 18+
94
- - `@playwright/test` 1.40+
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).
95
100
 
96
- ## Quick Start
101
+ The reporter package works in all tiers; the difference is where reports live and how much history you get.
97
102
 
98
- `withSentinel()` is the default setup for everyone:
103
+ ### Hosted Mode (Default)
99
104
 
100
- - best for free and local users
101
- - zero-friction setup
102
- - hosted Sentinel report link is generated automatically
103
- - no `SENTINEL_TOKEN` required
104
- - AI summaries use trace and reporter evidence, but are less precise than live page capture
105
+ Do nothing. Sentinel uploads and prints a share link when failures happen.
105
106
 
106
- Install:
107
+ Environment:
107
108
 
108
- ```bash
109
- npm install -D @sentinelqa/playwright-reporter
110
- ```
109
+ - `SENTINEL_MODE` unset (or `SENTINEL_MODE=hosted`)
111
110
 
112
- Add Sentinel to your Playwright config:
111
+ ### Workspace Mode (Private History)
113
112
 
114
- ```ts
115
- import { defineConfig } from "@playwright/test";
116
- import { withSentinel } from "@sentinelqa/playwright-reporter";
113
+ If you have a workspace token:
117
114
 
118
- export default withSentinel(
119
- defineConfig({
120
- reporter: [["line"]],
121
- outputDir: "test-results",
122
- use: {
123
- trace: "retain-on-failure",
124
- screenshot: "only-on-failure",
125
- video: "retain-on-failure",
126
- },
127
- }),
128
- {
129
- project: "my-app",
130
- },
131
- );
115
+ ```bash
116
+ SENTINEL_TOKEN=your_project_ingest_token npx playwright test
132
117
  ```
133
118
 
134
- ## Example
119
+ Environment:
120
+
121
+ - `SENTINEL_MODE` unset (or `SENTINEL_MODE=hosted`)
122
+ - `SENTINEL_TOKEN=...`
135
123
 
136
- Run your Playwright tests:
124
+ ### Offline Mode (No Uploads)
125
+
126
+ To keep everything local:
137
127
 
138
128
  ```bash
139
- npx playwright test
129
+ SENTINEL_MODE=offline npx playwright test
140
130
  ```
141
131
 
142
- If tests fail, Sentinel uploads a hosted debugging report and prints the shareable link in the terminal.
132
+ Offline mode is strict:
143
133
 
144
- Open the hosted report to inspect:
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)
145
137
 
146
- - failed tests across jobs
147
- - within-run grouped failures
148
- - screenshots and videos
149
- - trace links
150
- - parsed failure details
151
- - light summaries
152
- - shareable public debugging page
138
+ If a hosted upload fails, Sentinel falls back to generating the local report automatically.
153
139
 
154
- The free hosted public flow is designed for distribution:
140
+ ### Local Workspace Uploads (When Not In CI)
155
141
 
156
- - one shareable debugging link per run
157
- - public read-only pages
158
- - fast enough to use in CI comments and Slack threads
159
- - clear upgrade path into a full Sentinel workspace when teams want history, retention, and deeper analysis
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:
160
144
 
161
- ## Modes
145
+ ```bash
146
+ SENTINEL_UPLOAD_LOCAL=1 SENTINEL_TOKEN=your_project_ingest_token npx playwright test
147
+ ```
148
+
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)
152
+
153
+ If you are not in CI and you did not set `SENTINEL_TOKEN`, Sentinel can still upload in public mode by enabling:
162
154
 
163
- ### Free hosted mode
155
+ ```bash
156
+ SENTINEL_UPLOAD_LOCAL=1 npx playwright test
157
+ ```
164
158
 
165
- If `SENTINEL_TOKEN` is not set, the reporter uploads the run to a hosted public Sentinel report and prints the shareable URL.
159
+ ### Share Links Are Optional (Open Source / Self-Hosted)
166
160
 
167
- This free public flow includes:
161
+ - Hosted mode prints a share URL on failures.
162
+ - Offline mode skips uploads and produces only a local report.
168
163
 
169
- - hosted run page
170
- - hosted failure pages
171
- - grouped failures inside the run
172
- - light summaries
173
- - copy/share actions
174
- - 48-hour share links
164
+ Pick the behavior explicitly with `SENTINEL_MODE` (and `SENTINEL_UPLOAD_LOCAL` for local uploads).
175
165
 
176
- ### Workspace mode
166
+ ## Serving Local Reports
177
167
 
178
- If `SENTINEL_TOKEN` is set, the reporter uploads into your Sentinel workspace instead of the free hosted public flow.
168
+ Local reports are static HTML + copied artifacts. You can open `index.html` directly, or run a tiny local server:
179
169
 
180
170
  ```bash
181
- SENTINEL_TOKEN=your_project_ingest_token npx playwright test
171
+ cd sentinel-report
172
+ npx --yes serve -p 4173 .
182
173
  ```
183
174
 
184
- For local runs outside CI, Sentinel will use your local git metadata automatically when available.
185
-
186
- ## What `withSentinel()` does
175
+ Then open `http://localhost:4173`.
187
176
 
188
- - Preserves your existing reporter configuration
189
- - Injects a Playwright JSON reporter if one is missing
190
- - Sets sensible artifact defaults:
191
- - trace: `retain-on-failure`
192
- - screenshot: `only-on-failure`
193
- - video: `retain-on-failure`
194
- - Uploads the run to hosted Sentinel at the end of the test run
177
+ ## Secrets Masking
195
178
 
196
- ## Recommended Cloud Setup
179
+ Sentinel masks common secret patterns before data is shared. This includes:
197
180
 
198
- If you use Sentinel Cloud and want the best AI summaries and fix suggestions, keep `withSentinel()` in your Playwright config and add the live capture fixture.
181
+ - environment-variable looking strings
182
+ - common credential/token patterns
183
+ - internal URLs/hosts (where possible)
199
184
 
200
- Why:
185
+ If you find something that should be masked but isn’t, file an issue with a minimal reproducible example (redact the secret).
201
186
 
202
- - `withSentinel()` alone works from reporter and trace data
203
- - a Playwright reporter does not get the live `page` fixture
204
- - the live capture fixture lets Sentinel collect richer DOM and code context at the exact failure moment
205
- - this is required for the highest-quality DOM-aware patches
187
+ ## Optional: Richer Failure Evidence
206
188
 
207
- Create one shared test wrapper:
189
+ `withSentinel()` is enough for most setups. If you want richer UI evidence for actionability/timeouts, you can attach the failure capture fixture:
208
190
 
209
191
  ```ts
210
192
  // tests/test.ts
@@ -215,22 +197,13 @@ export const test = attachSentinelFailureCapture(base);
215
197
  export { expect };
216
198
  ```
217
199
 
218
- Then import from that file in your specs instead of `@playwright/test`:
200
+ Then import from that file in your specs:
219
201
 
220
202
  ```ts
221
203
  import { test, expect } from "./test";
222
204
  ```
223
205
 
224
- Use this cloud setup when you want:
225
-
226
- - best AI summaries
227
- - best fix suggestions
228
- - richer DOM-aware diagnosis
229
- - more reliable code patches grounded in real page state
230
-
231
- Free and local-only users do not need this. The standard `withSentinel()` setup remains the simplest path and will upload a hosted Sentinel report automatically.
232
-
233
- ## Options
206
+ ## Configuration Options
234
207
 
235
208
  ```ts
236
209
  withSentinel(config, {
@@ -243,19 +216,23 @@ withSentinel(config, {
243
216
  });
244
217
  ```
245
218
 
246
- ## Sentinel Cloud (optional)
219
+ ## Troubleshooting
220
+
221
+ ### “POST /api/runs failed …”
222
+
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`)
247
233
 
248
- Sentinel Cloud adds:
234
+ Then rerun with `SENTINEL_MODE=offline` to force local generation.
249
235
 
250
- - hosted debugging dashboards
251
- - CI run history
252
- - AI-generated failure summaries
253
- - flaky test detection
254
- - shareable run links
255
- - longer retention
256
- - compare against previous runs
257
- - recurring failure history
258
- - richer fix suggestions and team workflows
236
+ ## License
259
237
 
260
- Free for up to 100 CI runs per month.
261
- Create an account at [sentinelqa.com](https://sentinelqa.com).
238
+ See [LICENSE](./LICENSE).