@andrii_kremlovskyi/playwright-traces-reader 1.0.1 → 1.1.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.
- package/README.md +127 -61
- package/dist/extractors.d.ts +136 -11
- package/dist/extractors.d.ts.map +1 -1
- package/dist/extractors.js +251 -24
- package/dist/extractors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
- package/templates/skills/analyze-playwright-traces/SKILL.md +214 -39
package/README.md
CHANGED
|
@@ -4,11 +4,14 @@ Parse [Playwright](https://playwright.dev) trace files into structured data —
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- Extract
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- Find all unique failed tests across a report in one call — retries deduplicated, passing tests excluded, last retry selected automatically (`getFailedTestSummaries`)
|
|
8
|
+
- One-call failure summary: title, error, step tree, slowest steps, API calls, and DOM snapshot at failure (`getSummary`)
|
|
9
|
+
- Extract test steps with timings and errors (`getTestSteps`, `getTopLevelFailures`)
|
|
10
|
+
- Extract API and browser network traffic with resolved request/response bodies (`getNetworkTraffic`)
|
|
11
|
+
- Save screenshots from screencasts for human visual inspection (`extractScreenshots`)
|
|
12
|
+
- Extract full DOM snapshots (before / during / after each action) with back-reference resolution and filtering options (`getDomSnapshots`)
|
|
13
|
+
- Merged chronological timeline of steps, screenshots, DOM snapshots, and network calls (`getTimeline`)
|
|
14
|
+
- Reliable unique test title for deduplication across retries (`getTestTitle`)
|
|
12
15
|
- Support for multi-test reports (many SHA1 trace entries in one `data/` directory)
|
|
13
16
|
- GitHub Copilot skill scaffold via `init-skills` CLI command
|
|
14
17
|
|
|
@@ -18,53 +21,104 @@ Parse [Playwright](https://playwright.dev) trace files into structured data —
|
|
|
18
21
|
npm install @andrii_kremlovskyi/playwright-traces-reader
|
|
19
22
|
```
|
|
20
23
|
|
|
24
|
+
## GitHub Copilot Skill
|
|
25
|
+
|
|
26
|
+
Install a ready-made GitHub Copilot skill scaffold into your project:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx @andrii_kremlovskyi/playwright-traces-reader init-skills
|
|
30
|
+
# or into a custom target directory:
|
|
31
|
+
npx @andrii_kremlovskyi/playwright-traces-reader init-skills ./my-project
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This copies a `SKILL.md` template to `.github/skills/analyze-playwright-traces/SKILL.md` with code examples for all extractor functions. Once in place, GitHub Copilot will use the skill automatically when answering questions about your Playwright test runs.
|
|
35
|
+
|
|
36
|
+
## Trace Format
|
|
37
|
+
|
|
38
|
+
Playwright HTML reports store traces in `playwright-report/data/<sha1>/`:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
<sha1>/
|
|
42
|
+
├── test.trace ← step tree (getTestSteps / getTopLevelFailures / getSummary)
|
|
43
|
+
├── 0-trace.trace ← browser actions, screenshots, DOM snapshots, context-options
|
|
44
|
+
├── 0-trace.network ← network HAR entries
|
|
45
|
+
└── resources/ ← binary blobs (bodies, images) addressed by SHA1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
All trace files use **Newline-Delimited JSON (NDJSON)**.
|
|
49
|
+
|
|
21
50
|
## Quick Start
|
|
22
51
|
|
|
52
|
+
```typescript
|
|
53
|
+
import {
|
|
54
|
+
getFailedTestSummaries,
|
|
55
|
+
} from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
56
|
+
|
|
57
|
+
// One call — returns one TraceSummary per unique failing test.
|
|
58
|
+
// Retries deduplicated; passing tests excluded; last retry selected.
|
|
59
|
+
const failures = await getFailedTestSummaries('/path/to/playwright-report/data');
|
|
60
|
+
|
|
61
|
+
for (const f of failures) {
|
|
62
|
+
console.log(`[FAILED] ${f.testTitle ?? f.title}`);
|
|
63
|
+
console.log(`Error: ${f.error?.message}`);
|
|
64
|
+
console.log(`Duration: ${f.durationMs}ms`);
|
|
65
|
+
|
|
66
|
+
for (const call of f.apiCalls) {
|
|
67
|
+
console.log(` ${call.method} ${call.url} → ${call.status}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (f.failureDomSnapshot?.after) {
|
|
71
|
+
console.log('DOM at failure:', f.failureDomSnapshot.after.html.slice(0, 500));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Single trace
|
|
77
|
+
|
|
23
78
|
```typescript
|
|
24
79
|
import {
|
|
25
80
|
prepareTraceDir,
|
|
26
|
-
|
|
27
|
-
getNetworkTraffic,
|
|
28
|
-
getTestSteps,
|
|
29
|
-
extractScreenshots,
|
|
30
|
-
getDomSnapshots,
|
|
81
|
+
getSummary,
|
|
31
82
|
} from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
32
83
|
|
|
33
84
|
// Point at a single extracted trace directory (or a .zip)
|
|
34
85
|
const ctx = await prepareTraceDir('/path/to/playwright-report/data/<sha1>');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const steps = await getTestSteps(ctx);
|
|
86
|
+
const summary = await getSummary(ctx);
|
|
87
|
+
console.log(`[${summary.status.toUpperCase()}] ${summary.testTitle ?? summary.title}`);
|
|
88
|
+
console.log(`Error: ${summary.error?.message}`);
|
|
39
89
|
```
|
|
40
90
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
A Playwright HTML report stores one trace entry per test inside `playwright-report/data/`. Use `listTraces()` to iterate all of them:
|
|
91
|
+
## API
|
|
44
92
|
|
|
45
|
-
|
|
46
|
-
import { listTraces, getFailedTests } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
93
|
+
### `getFailedTestSummaries(reportDataDir)`
|
|
47
94
|
|
|
48
|
-
|
|
95
|
+
Report-level helper. Returns `TraceSummary[]` — one entry per **unique** failing test:
|
|
96
|
+
- Passing tests are skipped cheaply (no `getSummary` call).
|
|
97
|
+
- Retries are deduplicated by the full test title from `context-options`. The **last retry** (highest root step `endTime`) is used so the summary reflects the most recent execution.
|
|
98
|
+
- Pure API traces (no browser context) are deduplicated by `ctx.traceDir`.
|
|
49
99
|
|
|
50
|
-
for
|
|
51
|
-
const failures = await getFailedTests(ctx);
|
|
52
|
-
// ... process per-test results
|
|
53
|
-
}
|
|
54
|
-
```
|
|
100
|
+
This is the recommended entry point for failure analysis. See [`TraceSummary`](#tracesummary) for the full field list.
|
|
55
101
|
|
|
56
|
-
|
|
102
|
+
### `getSummary(ctx)`
|
|
57
103
|
|
|
58
|
-
|
|
104
|
+
Builds a `TraceSummary` for a single `TraceContext`. Use this when you already have a specific `ctx` from `listTraces()` and want a full snapshot without routing through `getFailedTestSummaries`.
|
|
59
105
|
|
|
60
106
|
### `listTraces(reportDataDir)`
|
|
61
107
|
|
|
62
|
-
Discovers all trace contexts inside a `data/` directory. Returns `TraceContext[]`.
|
|
108
|
+
Discovers all trace contexts inside a `data/` directory, including both passing and failing tests. Returns `TraceContext[]`. Each entry is either a directory (already extracted) or a `.zip` (auto-extracted). Non-trace files are ignored.
|
|
63
109
|
|
|
64
110
|
### `prepareTraceDir(tracePath)`
|
|
65
111
|
|
|
66
112
|
Takes a single path (extracted directory or `.zip`) and returns a `TraceContext`.
|
|
67
113
|
|
|
114
|
+
### `getTopLevelFailures(ctx)`
|
|
115
|
+
|
|
116
|
+
Returns the root-level failed steps as `TestStep[]` (only those with `error !== null`). Cheap — reads only `test.trace`. Each returned step contains the full `.children` tree for drilling down.
|
|
117
|
+
|
|
118
|
+
### `getTestTitle(ctx)`
|
|
119
|
+
|
|
120
|
+
Reads numbered trace files (`0-trace.trace`, …) for a `context-options` event and returns the full canonical test title: `"tests/auth.spec.ts:42 › describe › test name"`. Returns `null` for pure API traces with no browser context.
|
|
121
|
+
|
|
68
122
|
### `getTestSteps(ctx)`
|
|
69
123
|
|
|
70
124
|
Returns the full step tree from `test.trace` as `TestStep[]`. Each step has:
|
|
@@ -73,37 +127,39 @@ Returns the full step tree from `test.trace` as `TestStep[]`. Each step has:
|
|
|
73
127
|
|---|---|---|
|
|
74
128
|
| `callId` | `string` | Unique step identifier |
|
|
75
129
|
| `title` | `string` | Human-readable step name |
|
|
76
|
-
| `method` | `string
|
|
130
|
+
| `method` | `string` | API method if applicable |
|
|
77
131
|
| `startTime` | `number` | Unix ms timestamp |
|
|
78
132
|
| `endTime` | `number \| null` | Unix ms timestamp |
|
|
79
133
|
| `durationMs` | `number \| null` | Wall-clock duration |
|
|
80
134
|
| `error` | `TraceError \| null` | Error details if the step failed |
|
|
81
135
|
| `children` | `TestStep[]` | Nested child steps |
|
|
82
136
|
|
|
83
|
-
### `getFailedTests(ctx)`
|
|
84
|
-
|
|
85
|
-
Walks the step tree and returns a flat `FailedStep[]` for every step that has an `error`. Useful as a quick failure summary.
|
|
86
|
-
|
|
87
137
|
### `getNetworkTraffic(ctx)`
|
|
88
138
|
|
|
89
139
|
Returns `NetworkEntry[]` from all `*.network` trace files. Each entry includes:
|
|
90
140
|
|
|
91
141
|
| Field | Type | Description |
|
|
92
142
|
|---|---|---|
|
|
93
|
-
| `
|
|
143
|
+
| `source` | `'api' \| 'browser'` | `'api'` = Playwright `APIRequestContext`; `'browser'` = XHR / navigation |
|
|
94
144
|
| `method` | `string` | HTTP method |
|
|
145
|
+
| `url` | `string` | Request URL |
|
|
95
146
|
| `status` | `number` | HTTP response status |
|
|
96
|
-
| `
|
|
147
|
+
| `statusText` | `string` | HTTP status text |
|
|
148
|
+
| `requestHeaders` | `Array<{name,value}>` | Request headers |
|
|
149
|
+
| `responseHeaders` | `Array<{name,value}>` | Response headers |
|
|
97
150
|
| `requestBody` | `string \| null` | Resolved request body |
|
|
98
151
|
| `responseBody` | `string \| null` | Resolved response body (binary → `[binary: ...]` placeholder) |
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
152
|
+
| `mimeType` | `string` | Response content MIME type |
|
|
153
|
+
| `startedDateTime` | `string` | ISO 8601 request start time |
|
|
154
|
+
| `durationMs` | `number` | Total request duration |
|
|
101
155
|
|
|
102
156
|
### `extractScreenshots(ctx, outDir)`
|
|
103
157
|
|
|
104
|
-
Writes screencast frames from all `[N]-trace.trace` files to `outDir` as numbered `.jpeg` files. Returns `Screenshot[]` with `savedPath`, `timestamp`, `pageId`, `width`, and `height`.
|
|
158
|
+
Writes screencast frames from all `[N]-trace.trace` files to `outDir` as numbered `.jpeg` files. Returns `Screenshot[]` with `savedPath`, `sha1`, `timestamp`, `pageId`, `width`, and `height`.
|
|
159
|
+
|
|
160
|
+
> **Note**: AI agents cannot read JPEG/PNG image files from disk. `extractScreenshots` is for human visual inspection only. Use `getDomSnapshots()` for AI-readable UI state.
|
|
105
161
|
|
|
106
|
-
### `getDomSnapshots(ctx)`
|
|
162
|
+
### `getDomSnapshots(ctx, options?)`
|
|
107
163
|
|
|
108
164
|
Returns `ActionDomSnapshots[]` — one entry per browser action that has DOM snapshots. Each entry groups three phases:
|
|
109
165
|
|
|
@@ -125,39 +181,49 @@ Each `DomSnapshot` contains:
|
|
|
125
181
|
| `viewport` | `{ width: number; height: number }` | Viewport dimensions |
|
|
126
182
|
| `timestamp` | `number` | Unix ms timestamp |
|
|
127
183
|
|
|
128
|
-
|
|
184
|
+
**`DomSnapshotOptions`** (optional second argument):
|
|
129
185
|
|
|
130
|
-
|
|
186
|
+
| Option | Type | Description |
|
|
187
|
+
|---|---|---|
|
|
188
|
+
| `near` | `'last' \| string` | `'last'` = last `limit` entries; any other string = window centred on that callId |
|
|
189
|
+
| `phase` | `'before' \| 'action' \| 'after'` | Keep only entries where this phase is populated |
|
|
190
|
+
| `limit` | `number` | Max entries to return (default 5 with `near: 'last'`; caps from beginning otherwise) |
|
|
131
191
|
|
|
132
|
-
### `
|
|
192
|
+
### `getTimeline(ctx)`
|
|
133
193
|
|
|
134
|
-
|
|
194
|
+
Merges all event types into a single chronologically sorted `TimelineEntry[]`:
|
|
135
195
|
|
|
136
|
-
|
|
196
|
+
| Field | Type | Description |
|
|
197
|
+
|---|---|---|
|
|
198
|
+
| `timestamp` | `number` | Wall-clock ms since epoch |
|
|
199
|
+
| `type` | `'step' \| 'screenshot' \| 'dom' \| 'network'` | Event category |
|
|
200
|
+
| `data` | (typed union) | Payload — cast based on `type` |
|
|
137
201
|
|
|
138
|
-
|
|
202
|
+
Steps are flattened (all nesting levels). Screenshots are `ScreenshotMetadata` (no `savedPath` — no disk writes).
|
|
139
203
|
|
|
140
|
-
|
|
141
|
-
npx @andrii_kremlovskyi/playwright-traces-reader init-skills
|
|
142
|
-
# or into a custom target directory:
|
|
143
|
-
npx @andrii_kremlovskyi/playwright-traces-reader init-skills ./my-project
|
|
144
|
-
```
|
|
204
|
+
### `TraceSummary`
|
|
145
205
|
|
|
146
|
-
|
|
206
|
+
The bundle returned by `getSummary()` and `getFailedTestSummaries()`:
|
|
147
207
|
|
|
148
|
-
|
|
208
|
+
| Field | Type | Description |
|
|
209
|
+
|---|---|---|
|
|
210
|
+
| `testTitle` | `string \| null` | Full unique title from `context-options` (spec path + describe + test name). Use for display. `null` for pure API traces. |
|
|
211
|
+
| `title` | `string` | Root `test.step()` title (failing step or longest non-hook step) |
|
|
212
|
+
| `status` | `'passed' \| 'failed'` | Test outcome |
|
|
213
|
+
| `durationMs` | `number \| null` | Duration of the main root step |
|
|
214
|
+
| `error` | `TraceError \| null` | Top-level error, or `null` if passed |
|
|
215
|
+
| `topLevelSteps` | `TestStep[]` | Non-hook root steps (the visible `test.step()` blocks), each with `.children` |
|
|
216
|
+
| `slowestSteps` | `TestStep[]` | Top 5 slowest steps across the full step tree |
|
|
217
|
+
| `networkCalls` | `NetworkEntry[]` | All HTTP calls (`source: 'api'` = Node.js `APIRequestContext`; `source: 'browser'` = XHR / fetch / navigation) |
|
|
218
|
+
| `failureDomSnapshot` | `ActionDomSnapshots \| null` | DOM snapshot closest in time to the failure, or `null` |
|
|
149
219
|
|
|
150
|
-
|
|
220
|
+
### `getResourceBuffer(ctx, sha1)`
|
|
151
221
|
|
|
152
|
-
|
|
153
|
-
<sha1>/
|
|
154
|
-
├── test.trace ← step tree (getTestSteps / getFailedTests)
|
|
155
|
-
├── 0-trace.trace ← browser actions, screenshots, DOM snapshots
|
|
156
|
-
├── 0-trace.network ← network HAR entries
|
|
157
|
-
└── resources/ ← binary blobs (bodies, images) addressed by SHA1
|
|
158
|
-
```
|
|
222
|
+
Low-level helper. Resolves a SHA1 filename to a raw `Buffer` from `resources/`. Returns `null` if not found.
|
|
159
223
|
|
|
160
|
-
|
|
224
|
+
### `readNdjson<T>(filePath)`
|
|
225
|
+
|
|
226
|
+
Low-level async generator that streams and parses an NDJSON file line by line. Silently skips malformed lines.
|
|
161
227
|
|
|
162
228
|
## License
|
|
163
229
|
|
package/dist/extractors.d.ts
CHANGED
|
@@ -15,12 +15,6 @@ export interface TraceError {
|
|
|
15
15
|
message: string;
|
|
16
16
|
stack?: string;
|
|
17
17
|
}
|
|
18
|
-
export interface FailedStep {
|
|
19
|
-
callId: string;
|
|
20
|
-
title: string;
|
|
21
|
-
error: TraceError;
|
|
22
|
-
durationMs: number | null;
|
|
23
|
-
}
|
|
24
18
|
export interface NetworkEntry {
|
|
25
19
|
source: 'browser' | 'api';
|
|
26
20
|
method: string;
|
|
@@ -49,17 +43,31 @@ export interface Screenshot {
|
|
|
49
43
|
height: number;
|
|
50
44
|
savedPath: string;
|
|
51
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Screenshot metadata without a savedPath — returned by getTimeline() and
|
|
48
|
+
* other helpers that read screencast-frame events without writing to disk.
|
|
49
|
+
*/
|
|
50
|
+
export interface ScreenshotMetadata {
|
|
51
|
+
sha1: string;
|
|
52
|
+
timestamp: number;
|
|
53
|
+
pageId: string;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
}
|
|
52
57
|
/**
|
|
53
58
|
* Reconstructs the test step tree from a test.trace file.
|
|
54
59
|
* Returns top-level steps (roots), each with nested children.
|
|
55
60
|
*/
|
|
56
61
|
export declare function getTestSteps(traceContext: TraceContext): Promise<TestStep[]>;
|
|
57
62
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
63
|
+
* Returns only the root-level steps that failed — one entry per failing test
|
|
64
|
+
* per trace, matching exactly what the Playwright HTML report counts.
|
|
65
|
+
*
|
|
66
|
+
* Each returned `TestStep` includes the full `.children` tree, so you can
|
|
67
|
+
* drill into nested steps to find the specific assertion or action that failed.
|
|
68
|
+
* Use `getTestTitle()` to deduplicate retry traces across a full report run.
|
|
61
69
|
*/
|
|
62
|
-
export declare function
|
|
70
|
+
export declare function getTopLevelFailures(traceContext: TraceContext): Promise<TestStep[]>;
|
|
63
71
|
/**
|
|
64
72
|
* Reads all *.network files in the trace directory and returns structured
|
|
65
73
|
* network entries. Each entry is tagged as 'browser' (has pageref) or
|
|
@@ -115,6 +123,22 @@ export interface ActionDomSnapshots {
|
|
|
115
123
|
action: DomSnapshot | null;
|
|
116
124
|
after: DomSnapshot | null;
|
|
117
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Optional filtering options for getDomSnapshots().
|
|
128
|
+
*
|
|
129
|
+
* @param near `'last'` returns the last `limit` entries (default 5).
|
|
130
|
+
* A callId string like `'call@585'` returns a window of
|
|
131
|
+
* `limit` entries centred on that action.
|
|
132
|
+
* @param phase Filter to a single snapshot phase.
|
|
133
|
+
* @param limit Max entries to return. With `near: 'last'` this is the tail
|
|
134
|
+
* count; with `near: callId` it is the window size (default 5);
|
|
135
|
+
* without `near` it caps the result from the beginning.
|
|
136
|
+
*/
|
|
137
|
+
export interface DomSnapshotOptions {
|
|
138
|
+
near?: 'last' | string;
|
|
139
|
+
phase?: 'before' | 'action' | 'after';
|
|
140
|
+
limit?: number;
|
|
141
|
+
}
|
|
118
142
|
/**
|
|
119
143
|
* Extracts DOM snapshots from all browser context trace files (`[N]-trace.trace`
|
|
120
144
|
* where the context is a browser context, i.e. has frame-snapshot entries).
|
|
@@ -127,5 +151,106 @@ export interface ActionDomSnapshots {
|
|
|
127
151
|
* snapshots in this frame's history, find the `nodeIdx`-th node in post-order
|
|
128
152
|
* DFS of that snapshot".
|
|
129
153
|
*/
|
|
130
|
-
export declare function getDomSnapshots(traceContext: TraceContext): Promise<ActionDomSnapshots[]>;
|
|
154
|
+
export declare function getDomSnapshots(traceContext: TraceContext, options?: DomSnapshotOptions): Promise<ActionDomSnapshots[]>;
|
|
155
|
+
/**
|
|
156
|
+
* A single event in the merged chronological timeline produced by getTimeline().
|
|
157
|
+
*/
|
|
158
|
+
export interface TimelineEntry {
|
|
159
|
+
/** Wall-clock timestamp in milliseconds since epoch. */
|
|
160
|
+
timestamp: number;
|
|
161
|
+
/** Event category. */
|
|
162
|
+
type: 'step' | 'screenshot' | 'dom' | 'network';
|
|
163
|
+
/**
|
|
164
|
+
* Payload. Cast based on `type`:
|
|
165
|
+
* - `'step'` → TestStep
|
|
166
|
+
* - `'screenshot'` → ScreenshotMetadata
|
|
167
|
+
* - `'dom'` → ActionDomSnapshots
|
|
168
|
+
* - `'network'` → NetworkEntry
|
|
169
|
+
*/
|
|
170
|
+
data: TestStep | ScreenshotMetadata | ActionDomSnapshots | NetworkEntry;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Merges all trace event types (steps, screenshots, DOM snapshots, network
|
|
174
|
+
* calls) into a single chronologically sorted array.
|
|
175
|
+
*
|
|
176
|
+
* This makes it trivial to build a narrative of what happened during a test —
|
|
177
|
+
* all events share the same timeline without requiring manual timestamp
|
|
178
|
+
* correlation across four separate API calls.
|
|
179
|
+
*
|
|
180
|
+
* Steps are flattened (all nesting levels included). Screenshots are metadata
|
|
181
|
+
* only (no disk writes — use extractScreenshots() for that).
|
|
182
|
+
*/
|
|
183
|
+
export declare function getTimeline(traceContext: TraceContext): Promise<TimelineEntry[]>;
|
|
184
|
+
/**
|
|
185
|
+
* Extracts the full unique test title from the `context-options` event in a
|
|
186
|
+
* numbered browser context trace file (e.g. `0-trace.trace`).
|
|
187
|
+
*
|
|
188
|
+
* The full title includes the spec file path, describe-block names, and test
|
|
189
|
+
* name — e.g.:
|
|
190
|
+
* `"e2e/spec.ts:24 › Describe block › TC01 - should do something"`
|
|
191
|
+
*
|
|
192
|
+
* This is the canonical unique identifier for a test execution. Unlike root
|
|
193
|
+
* step titles in `test.trace`, it is guaranteed to be unique across different
|
|
194
|
+
* tests even when they share the same `test.step()` description.
|
|
195
|
+
*
|
|
196
|
+
* Returns `null` when no numbered trace file with a `context-options` title is
|
|
197
|
+
* found (e.g. pure API traces with no browser context).
|
|
198
|
+
*/
|
|
199
|
+
export declare function getTestTitle(traceContext: TraceContext): Promise<string | null>;
|
|
200
|
+
/**
|
|
201
|
+
* A single-call bundle of the most commonly needed trace data, useful as a
|
|
202
|
+
* starting point for any failure analysis.
|
|
203
|
+
*/
|
|
204
|
+
export interface TraceSummary {
|
|
205
|
+
/**
|
|
206
|
+
* Full unique test title from the `context-options` event in a numbered trace
|
|
207
|
+
* file — includes spec file path, describe-block names, and test name.
|
|
208
|
+
* Use this for deduplication across retries instead of `title`.
|
|
209
|
+
* `null` for pure API traces with no browser context.
|
|
210
|
+
*/
|
|
211
|
+
testTitle: string | null;
|
|
212
|
+
/** Title of the top-level test step (from test.trace root step). */
|
|
213
|
+
title: string;
|
|
214
|
+
/** Whether the test passed or failed. */
|
|
215
|
+
status: 'passed' | 'failed';
|
|
216
|
+
/** Total test duration in ms, or null if unavailable. */
|
|
217
|
+
durationMs: number | null;
|
|
218
|
+
/** The top-level error, or null if passed. */
|
|
219
|
+
error: TraceError | null;
|
|
220
|
+
/** Non-hook root steps representing the visible test flow (test.step() blocks). */
|
|
221
|
+
topLevelSteps: TestStep[]; /** Top 5 slowest steps across the entire tree. */
|
|
222
|
+
slowestSteps: TestStep[];
|
|
223
|
+
/** All HTTP calls (both Node.js APIRequestContext and browser XHR/fetch/navigation). */
|
|
224
|
+
networkCalls: NetworkEntry[];
|
|
225
|
+
/** The DOM snapshot (before/action/after) closest in time to the failure, or null if passed. */
|
|
226
|
+
failureDomSnapshot: ActionDomSnapshots | null;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Returns a TraceSummary bundling the most commonly needed trace data in one
|
|
230
|
+
* call. Recommended as the starting point for any AI failure analysis — it
|
|
231
|
+
* covers the 90% case without requiring separate calls to getTestSteps(),
|
|
232
|
+
* getNetworkTraffic(), and getDomSnapshots().
|
|
233
|
+
*/
|
|
234
|
+
export declare function getSummary(traceContext: TraceContext): Promise<TraceSummary>;
|
|
235
|
+
/**
|
|
236
|
+
* High-level report-level helper: finds all **unique** failing tests across
|
|
237
|
+
* an entire Playwright report data directory and returns a `TraceSummary` for
|
|
238
|
+
* each one.
|
|
239
|
+
*
|
|
240
|
+
* Handles three tricky cases automatically:
|
|
241
|
+
* - **Passing tests**: skipped cheaply (no `getSummary` call) by checking
|
|
242
|
+
* `getTopLevelFailures()` first.
|
|
243
|
+
* - **Retries**: deduplicated by the full unique title from `getTestTitle()`
|
|
244
|
+
* (`context-options` event in a numbered trace file), which includes the
|
|
245
|
+
* spec file path, describe block, and test name. When multiple retries exist
|
|
246
|
+
* for the same test, the **last retry** (highest root step `endTime`) is used
|
|
247
|
+
* — it reflects the most recent execution and has the most relevant DOM
|
|
248
|
+
* snapshot and network traffic for debugging.
|
|
249
|
+
* - **Pure API traces** (no browser context, so `getTestTitle` returns `null`):
|
|
250
|
+
* deduplicated by `ctx.traceDir` as a fallback.
|
|
251
|
+
*
|
|
252
|
+
* @param reportDataDir Path to the `playwright-report/data/` directory.
|
|
253
|
+
* @returns `TraceSummary[]` for each unique failing test (one per unique title).
|
|
254
|
+
*/
|
|
255
|
+
export declare function getFailedTestSummaries(reportDataDir: string): Promise<TraceSummary[]>;
|
|
131
256
|
//# sourceMappingURL=extractors.d.ts.map
|
package/dist/extractors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractors.d.ts","sourceRoot":"","sources":["../src/extractors.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AAE,MAAM,CAAC;IACd,yCAAyC;IACzC,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,yDAAyD;IACzD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,8CAA8C;IAC9C,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,mFAAmF;IACnF,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAE,kDAAkD;IAC9E,YAAY,EAAE,QAAQ,EAAE,CAAC;IACzB,wFAAwF;IACxF,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,gGAAgG;IAChG,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC/C;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAkElF;AAID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAsC3F"}
|
package/dist/extractors.js
CHANGED
|
@@ -34,10 +34,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.getTestSteps = getTestSteps;
|
|
37
|
-
exports.
|
|
37
|
+
exports.getTopLevelFailures = getTopLevelFailures;
|
|
38
38
|
exports.getNetworkTraffic = getNetworkTraffic;
|
|
39
39
|
exports.extractScreenshots = extractScreenshots;
|
|
40
40
|
exports.getDomSnapshots = getDomSnapshots;
|
|
41
|
+
exports.getTimeline = getTimeline;
|
|
42
|
+
exports.getTestTitle = getTestTitle;
|
|
43
|
+
exports.getSummary = getSummary;
|
|
44
|
+
exports.getFailedTestSummaries = getFailedTestSummaries;
|
|
41
45
|
const fs = __importStar(require("fs"));
|
|
42
46
|
const path = __importStar(require("path"));
|
|
43
47
|
const parseTrace_1 = require("./parseTrace");
|
|
@@ -90,30 +94,18 @@ async function getTestSteps(traceContext) {
|
|
|
90
94
|
}
|
|
91
95
|
return roots;
|
|
92
96
|
}
|
|
93
|
-
// ----------
|
|
97
|
+
// ---------- getTopLevelFailures ----------
|
|
94
98
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
99
|
+
* Returns only the root-level steps that failed — one entry per failing test
|
|
100
|
+
* per trace, matching exactly what the Playwright HTML report counts.
|
|
101
|
+
*
|
|
102
|
+
* Each returned `TestStep` includes the full `.children` tree, so you can
|
|
103
|
+
* drill into nested steps to find the specific assertion or action that failed.
|
|
104
|
+
* Use `getTestTitle()` to deduplicate retry traces across a full report run.
|
|
98
105
|
*/
|
|
99
|
-
async function
|
|
106
|
+
async function getTopLevelFailures(traceContext) {
|
|
100
107
|
const roots = await getTestSteps(traceContext);
|
|
101
|
-
|
|
102
|
-
function collect(steps) {
|
|
103
|
-
for (const step of steps) {
|
|
104
|
-
if (step.error) {
|
|
105
|
-
failed.push({
|
|
106
|
-
callId: step.callId,
|
|
107
|
-
title: step.title,
|
|
108
|
-
error: step.error,
|
|
109
|
-
durationMs: step.durationMs,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
collect(step.children);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
collect(roots);
|
|
116
|
-
return failed;
|
|
108
|
+
return roots.filter(step => step.error !== null);
|
|
117
109
|
}
|
|
118
110
|
// ---------- getNetworkTraffic ----------
|
|
119
111
|
/**
|
|
@@ -332,7 +324,7 @@ function escapeAttr(s) {
|
|
|
332
324
|
* snapshots in this frame's history, find the `nodeIdx`-th node in post-order
|
|
333
325
|
* DFS of that snapshot".
|
|
334
326
|
*/
|
|
335
|
-
async function getDomSnapshots(traceContext) {
|
|
327
|
+
async function getDomSnapshots(traceContext, options) {
|
|
336
328
|
const files = await fs.promises.readdir(traceContext.traceDir);
|
|
337
329
|
const traceFiles = files.filter(f => f.endsWith('.trace') && f !== 'test.trace').sort();
|
|
338
330
|
// Per-frame snapshot history: frameId → ordered list of raw html nodes
|
|
@@ -390,7 +382,7 @@ async function getDomSnapshots(traceContext) {
|
|
|
390
382
|
}
|
|
391
383
|
}
|
|
392
384
|
// Assemble into ActionDomSnapshots
|
|
393
|
-
|
|
385
|
+
let result = [];
|
|
394
386
|
for (const [callId, phases] of rawByCallId) {
|
|
395
387
|
result.push({
|
|
396
388
|
callId,
|
|
@@ -404,6 +396,36 @@ async function getDomSnapshots(traceContext) {
|
|
|
404
396
|
const tb = (b.before ?? b.action ?? b.after)?.timestamp ?? 0;
|
|
405
397
|
return ta - tb;
|
|
406
398
|
});
|
|
399
|
+
// Apply options filters
|
|
400
|
+
if (options) {
|
|
401
|
+
if (options.phase) {
|
|
402
|
+
const p = options.phase;
|
|
403
|
+
result = result
|
|
404
|
+
.map(r => ({
|
|
405
|
+
...r,
|
|
406
|
+
before: p === 'before' ? r.before : null,
|
|
407
|
+
action: p === 'action' ? r.action : null,
|
|
408
|
+
after: p === 'after' ? r.after : null,
|
|
409
|
+
}))
|
|
410
|
+
.filter(r => r.before !== null || r.action !== null || r.after !== null);
|
|
411
|
+
}
|
|
412
|
+
if (options.near === 'last') {
|
|
413
|
+
const n = options.limit ?? 5;
|
|
414
|
+
result = result.slice(-n);
|
|
415
|
+
}
|
|
416
|
+
else if (options.near) {
|
|
417
|
+
const idx = result.findIndex(r => r.callId === options.near);
|
|
418
|
+
if (idx >= 0) {
|
|
419
|
+
const n = options.limit ?? 5;
|
|
420
|
+
const half = Math.floor(n / 2);
|
|
421
|
+
const start = Math.max(0, idx - half);
|
|
422
|
+
result = result.slice(start, start + n);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else if (options.limit !== undefined) {
|
|
426
|
+
result = result.slice(0, options.limit);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
407
429
|
return result;
|
|
408
430
|
}
|
|
409
431
|
/** Recursively searches the snapshot tree for a node with __playwright_target__ */
|
|
@@ -426,4 +448,209 @@ function findPlaywrightTarget(node) {
|
|
|
426
448
|
}
|
|
427
449
|
return null;
|
|
428
450
|
}
|
|
451
|
+
// ---------- getScreenshotMetadata (internal) ----------
|
|
452
|
+
/**
|
|
453
|
+
* Reads screencast-frame events from trace files and returns screenshot
|
|
454
|
+
* metadata WITHOUT writing any files to disk. Used internally by getTimeline().
|
|
455
|
+
*/
|
|
456
|
+
async function getScreenshotMetadata(traceContext) {
|
|
457
|
+
const screenshots = [];
|
|
458
|
+
const files = await fs.promises.readdir(traceContext.traceDir);
|
|
459
|
+
const traceFiles = files.filter(f => f.endsWith('.trace') && f !== 'test.trace').sort();
|
|
460
|
+
for (const traceFile of traceFiles) {
|
|
461
|
+
const filePath = path.join(traceContext.traceDir, traceFile);
|
|
462
|
+
for await (const event of (0, parseTrace_1.readNdjson)(filePath)) {
|
|
463
|
+
if (event.type !== 'screencast-frame')
|
|
464
|
+
continue;
|
|
465
|
+
screenshots.push({
|
|
466
|
+
sha1: event.sha1,
|
|
467
|
+
timestamp: event.timestamp,
|
|
468
|
+
pageId: event.pageId,
|
|
469
|
+
width: event.width,
|
|
470
|
+
height: event.height,
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return screenshots;
|
|
475
|
+
}
|
|
476
|
+
// ---------- Shared helper ----------
|
|
477
|
+
/** Flattens a step tree into a single array (depth-first). */
|
|
478
|
+
function flattenSteps(steps) {
|
|
479
|
+
const out = [];
|
|
480
|
+
for (const s of steps) {
|
|
481
|
+
out.push(s);
|
|
482
|
+
out.push(...flattenSteps(s.children));
|
|
483
|
+
}
|
|
484
|
+
return out;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Merges all trace event types (steps, screenshots, DOM snapshots, network
|
|
488
|
+
* calls) into a single chronologically sorted array.
|
|
489
|
+
*
|
|
490
|
+
* This makes it trivial to build a narrative of what happened during a test —
|
|
491
|
+
* all events share the same timeline without requiring manual timestamp
|
|
492
|
+
* correlation across four separate API calls.
|
|
493
|
+
*
|
|
494
|
+
* Steps are flattened (all nesting levels included). Screenshots are metadata
|
|
495
|
+
* only (no disk writes — use extractScreenshots() for that).
|
|
496
|
+
*/
|
|
497
|
+
async function getTimeline(traceContext) {
|
|
498
|
+
const [steps, screenshots, domSnapshots, network] = await Promise.all([
|
|
499
|
+
getTestSteps(traceContext),
|
|
500
|
+
getScreenshotMetadata(traceContext),
|
|
501
|
+
getDomSnapshots(traceContext),
|
|
502
|
+
getNetworkTraffic(traceContext),
|
|
503
|
+
]);
|
|
504
|
+
const entries = [];
|
|
505
|
+
for (const step of flattenSteps(steps)) {
|
|
506
|
+
entries.push({ timestamp: step.startTime, type: 'step', data: step });
|
|
507
|
+
}
|
|
508
|
+
for (const shot of screenshots) {
|
|
509
|
+
entries.push({ timestamp: shot.timestamp, type: 'screenshot', data: shot });
|
|
510
|
+
}
|
|
511
|
+
for (const dom of domSnapshots) {
|
|
512
|
+
const ts = (dom.before ?? dom.action ?? dom.after)?.timestamp ?? 0;
|
|
513
|
+
entries.push({ timestamp: ts, type: 'dom', data: dom });
|
|
514
|
+
}
|
|
515
|
+
for (const net of network) {
|
|
516
|
+
entries.push({ timestamp: new Date(net.startedDateTime).getTime(), type: 'network', data: net });
|
|
517
|
+
}
|
|
518
|
+
entries.sort((a, b) => a.timestamp - b.timestamp);
|
|
519
|
+
return entries;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Extracts the full unique test title from the `context-options` event in a
|
|
523
|
+
* numbered browser context trace file (e.g. `0-trace.trace`).
|
|
524
|
+
*
|
|
525
|
+
* The full title includes the spec file path, describe-block names, and test
|
|
526
|
+
* name — e.g.:
|
|
527
|
+
* `"e2e/spec.ts:24 › Describe block › TC01 - should do something"`
|
|
528
|
+
*
|
|
529
|
+
* This is the canonical unique identifier for a test execution. Unlike root
|
|
530
|
+
* step titles in `test.trace`, it is guaranteed to be unique across different
|
|
531
|
+
* tests even when they share the same `test.step()` description.
|
|
532
|
+
*
|
|
533
|
+
* Returns `null` when no numbered trace file with a `context-options` title is
|
|
534
|
+
* found (e.g. pure API traces with no browser context).
|
|
535
|
+
*/
|
|
536
|
+
async function getTestTitle(traceContext) {
|
|
537
|
+
const files = await fs.promises.readdir(traceContext.traceDir);
|
|
538
|
+
const traceFiles = files
|
|
539
|
+
.filter(f => /^\d+-trace\.trace$/.test(f))
|
|
540
|
+
.sort((a, b) => parseInt(a) - parseInt(b));
|
|
541
|
+
for (const traceFile of traceFiles) {
|
|
542
|
+
const filePath = path.join(traceContext.traceDir, traceFile);
|
|
543
|
+
for await (const event of (0, parseTrace_1.readNdjson)(filePath)) {
|
|
544
|
+
if (event.type === 'context-options' && event.title) {
|
|
545
|
+
return event.title;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Returns a TraceSummary bundling the most commonly needed trace data in one
|
|
553
|
+
* call. Recommended as the starting point for any AI failure analysis — it
|
|
554
|
+
* covers the 90% case without requiring separate calls to getTestSteps(),
|
|
555
|
+
* getNetworkTraffic(), and getDomSnapshots().
|
|
556
|
+
*/
|
|
557
|
+
async function getSummary(traceContext) {
|
|
558
|
+
const [roots, network, domAll, testTitle] = await Promise.all([
|
|
559
|
+
getTestSteps(traceContext),
|
|
560
|
+
getNetworkTraffic(traceContext),
|
|
561
|
+
getDomSnapshots(traceContext),
|
|
562
|
+
getTestTitle(traceContext),
|
|
563
|
+
]);
|
|
564
|
+
// Infrastructure steps injected by Playwright — not meaningful test content.
|
|
565
|
+
const HOOK_TITLES = new Set([
|
|
566
|
+
'Before Hooks', 'After Hooks',
|
|
567
|
+
'Worker Cleanup', 'Worker Cleanup Hooks', 'Worker Setup',
|
|
568
|
+
]);
|
|
569
|
+
const isHook = (s) => HOOK_TITLES.has(s.title) || s.title.startsWith('Attach "');
|
|
570
|
+
// Test steps = non-infrastructure roots (the user-visible test.step() blocks)
|
|
571
|
+
const testRoots = roots.filter(r => !isHook(r));
|
|
572
|
+
// Main root: the failing step if any, otherwise the longest test step
|
|
573
|
+
const mainRoot = testRoots.find(r => r.error !== null) ??
|
|
574
|
+
testRoots.reduce((best, r) => best === null || (r.durationMs ?? 0) > (best.durationMs ?? 0) ? r : best, null) ??
|
|
575
|
+
roots[0] ??
|
|
576
|
+
null;
|
|
577
|
+
const title = mainRoot?.title ?? 'Unknown';
|
|
578
|
+
const status = roots.some(r => r.error !== null) ? 'failed' : 'passed';
|
|
579
|
+
const durationMs = mainRoot?.durationMs ?? null;
|
|
580
|
+
const error = mainRoot?.error ?? null;
|
|
581
|
+
// topLevelSteps = visible test steps (non-hook roots)
|
|
582
|
+
const topLevelSteps = testRoots;
|
|
583
|
+
const allSteps = flattenSteps(roots);
|
|
584
|
+
const slowestSteps = allSteps
|
|
585
|
+
.filter(s => s.durationMs !== null)
|
|
586
|
+
.sort((a, b) => (b.durationMs ?? 0) - (a.durationMs ?? 0))
|
|
587
|
+
.slice(0, 5);
|
|
588
|
+
const networkCalls = network;
|
|
589
|
+
let failureDomSnapshot = null;
|
|
590
|
+
if (error && mainRoot && domAll.length > 0) {
|
|
591
|
+
const failureTime = mainRoot.endTime ?? mainRoot.startTime;
|
|
592
|
+
failureDomSnapshot = domAll.reduce((closest, current) => {
|
|
593
|
+
const ct = (current.before ?? current.action ?? current.after)?.timestamp ?? 0;
|
|
594
|
+
const cct = (closest.before ?? closest.action ?? closest.after)?.timestamp ?? 0;
|
|
595
|
+
return Math.abs(ct - failureTime) < Math.abs(cct - failureTime) ? current : closest;
|
|
596
|
+
}, domAll[0]);
|
|
597
|
+
}
|
|
598
|
+
return {
|
|
599
|
+
testTitle,
|
|
600
|
+
title,
|
|
601
|
+
status,
|
|
602
|
+
durationMs,
|
|
603
|
+
error,
|
|
604
|
+
topLevelSteps,
|
|
605
|
+
slowestSteps,
|
|
606
|
+
networkCalls,
|
|
607
|
+
failureDomSnapshot,
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
// ---------- getFailedTestSummaries ----------
|
|
611
|
+
/**
|
|
612
|
+
* High-level report-level helper: finds all **unique** failing tests across
|
|
613
|
+
* an entire Playwright report data directory and returns a `TraceSummary` for
|
|
614
|
+
* each one.
|
|
615
|
+
*
|
|
616
|
+
* Handles three tricky cases automatically:
|
|
617
|
+
* - **Passing tests**: skipped cheaply (no `getSummary` call) by checking
|
|
618
|
+
* `getTopLevelFailures()` first.
|
|
619
|
+
* - **Retries**: deduplicated by the full unique title from `getTestTitle()`
|
|
620
|
+
* (`context-options` event in a numbered trace file), which includes the
|
|
621
|
+
* spec file path, describe block, and test name. When multiple retries exist
|
|
622
|
+
* for the same test, the **last retry** (highest root step `endTime`) is used
|
|
623
|
+
* — it reflects the most recent execution and has the most relevant DOM
|
|
624
|
+
* snapshot and network traffic for debugging.
|
|
625
|
+
* - **Pure API traces** (no browser context, so `getTestTitle` returns `null`):
|
|
626
|
+
* deduplicated by `ctx.traceDir` as a fallback.
|
|
627
|
+
*
|
|
628
|
+
* @param reportDataDir Path to the `playwright-report/data/` directory.
|
|
629
|
+
* @returns `TraceSummary[]` for each unique failing test (one per unique title).
|
|
630
|
+
*/
|
|
631
|
+
async function getFailedTestSummaries(reportDataDir) {
|
|
632
|
+
const traces = await (0, parseTrace_1.listTraces)(reportDataDir);
|
|
633
|
+
const byTitle = new Map();
|
|
634
|
+
for (const ctx of traces) {
|
|
635
|
+
// Cheap check — reads only test.trace. Skip passing tests immediately.
|
|
636
|
+
const topFailures = await getTopLevelFailures(ctx);
|
|
637
|
+
if (topFailures.length === 0)
|
|
638
|
+
continue;
|
|
639
|
+
const title = await getTestTitle(ctx);
|
|
640
|
+
const key = title ?? ctx.traceDir;
|
|
641
|
+
// Use the latest endTime of any root step as the proxy for when this
|
|
642
|
+
// retry finished. Fall back to 0 if no step has an endTime.
|
|
643
|
+
const latestEndTime = topFailures.reduce((max, s) => Math.max(max, s.endTime ?? s.startTime ?? 0), 0);
|
|
644
|
+
const existing = byTitle.get(key);
|
|
645
|
+
if (!existing || latestEndTime > existing.latestEndTime) {
|
|
646
|
+
byTitle.set(key, { ctx, latestEndTime });
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// --- Pass 2: build summaries only for the last retry of each unique failure ---
|
|
650
|
+
const results = [];
|
|
651
|
+
for (const { ctx } of byTitle.values()) {
|
|
652
|
+
results.push(await getSummary(ctx));
|
|
653
|
+
}
|
|
654
|
+
return results;
|
|
655
|
+
}
|
|
429
656
|
//# sourceMappingURL=extractors.js.map
|
package/dist/extractors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractors.js","sourceRoot":"","sources":["../src/extractors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyHA,oCA2CC;AASD,wCAoBC;AAUD,8CA+DC;AASD,gDAsCC;AA8LD,0CAkFC;AAzkBD,uCAAyB;AACzB,2CAA6B;AAC7B,6CAAgF;AAiHhF,qCAAqC;AAErC;;;GAGG;AACI,KAAK,UAAU,YAAY,CAAC,YAA0B;IAC3D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC5C,MAAM,KAAK,GAAe,EAAE,CAAC;IAE7B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAA,uBAAU,EAAqC,aAAa,CAAC,EAAE,CAAC;QACxF,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAa;gBACrB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;gBAChC,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,OAAO,EAAE,IAAI;gBACb,UAAU,EA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AAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,EACxD,CAAC,CACF,CAAC;QAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,IAAI,aAAa,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,iFAAiF;IACjF,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { prepareTraceDir, readNdjson, getResourceBuffer, listTraces } from './parseTrace';
|
|
2
2
|
export type { TraceContext } from './parseTrace';
|
|
3
|
-
export { getTestSteps,
|
|
4
|
-
export type { TestStep, TraceError,
|
|
3
|
+
export { getTestSteps, getTopLevelFailures, getTestTitle, getNetworkTraffic, extractScreenshots, getDomSnapshots, getTimeline, getSummary, getFailedTestSummaries, } from './extractors';
|
|
4
|
+
export type { TestStep, TraceError, NetworkEntry, Screenshot, ScreenshotMetadata, DomSnapshot, ActionDomSnapshots, DomSnapshotOptions, TimelineEntry, TraceSummary, } from './extractors';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1F,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EACL,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1F,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,UAAU,EACV,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDomSnapshots = exports.extractScreenshots = exports.getNetworkTraffic = exports.
|
|
3
|
+
exports.getFailedTestSummaries = exports.getSummary = exports.getTimeline = exports.getDomSnapshots = exports.extractScreenshots = exports.getNetworkTraffic = exports.getTestTitle = exports.getTopLevelFailures = exports.getTestSteps = exports.listTraces = exports.getResourceBuffer = exports.readNdjson = exports.prepareTraceDir = void 0;
|
|
4
4
|
var parseTrace_1 = require("./parseTrace");
|
|
5
5
|
Object.defineProperty(exports, "prepareTraceDir", { enumerable: true, get: function () { return parseTrace_1.prepareTraceDir; } });
|
|
6
6
|
Object.defineProperty(exports, "readNdjson", { enumerable: true, get: function () { return parseTrace_1.readNdjson; } });
|
|
@@ -8,8 +8,12 @@ Object.defineProperty(exports, "getResourceBuffer", { enumerable: true, get: fun
|
|
|
8
8
|
Object.defineProperty(exports, "listTraces", { enumerable: true, get: function () { return parseTrace_1.listTraces; } });
|
|
9
9
|
var extractors_1 = require("./extractors");
|
|
10
10
|
Object.defineProperty(exports, "getTestSteps", { enumerable: true, get: function () { return extractors_1.getTestSteps; } });
|
|
11
|
-
Object.defineProperty(exports, "
|
|
11
|
+
Object.defineProperty(exports, "getTopLevelFailures", { enumerable: true, get: function () { return extractors_1.getTopLevelFailures; } });
|
|
12
|
+
Object.defineProperty(exports, "getTestTitle", { enumerable: true, get: function () { return extractors_1.getTestTitle; } });
|
|
12
13
|
Object.defineProperty(exports, "getNetworkTraffic", { enumerable: true, get: function () { return extractors_1.getNetworkTraffic; } });
|
|
13
14
|
Object.defineProperty(exports, "extractScreenshots", { enumerable: true, get: function () { return extractors_1.extractScreenshots; } });
|
|
14
15
|
Object.defineProperty(exports, "getDomSnapshots", { enumerable: true, get: function () { return extractors_1.getDomSnapshots; } });
|
|
16
|
+
Object.defineProperty(exports, "getTimeline", { enumerable: true, get: function () { return extractors_1.getTimeline; } });
|
|
17
|
+
Object.defineProperty(exports, "getSummary", { enumerable: true, get: function () { return extractors_1.getSummary; } });
|
|
18
|
+
Object.defineProperty(exports, "getFailedTestSummaries", { enumerable: true, get: function () { return extractors_1.getFailedTestSummaries; } });
|
|
15
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAA0F;AAAjF,6GAAA,eAAe,OAAA;AAAE,wGAAA,UAAU,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,wGAAA,UAAU,OAAA;AAGnE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAA0F;AAAjF,6GAAA,eAAe,OAAA;AAAE,wGAAA,UAAU,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,wGAAA,UAAU,OAAA;AAGnE,2CAUsB;AATpB,0GAAA,YAAY,OAAA;AACZ,iHAAA,mBAAmB,OAAA;AACnB,0GAAA,YAAY,OAAA;AACZ,+GAAA,iBAAiB,OAAA;AACjB,gHAAA,kBAAkB,OAAA;AAClB,6GAAA,eAAe,OAAA;AACf,yGAAA,WAAW,OAAA;AACX,wGAAA,UAAU,OAAA;AACV,oHAAA,sBAAsB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrii_kremlovskyi/playwright-traces-reader",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Parse Playwright trace files into structured data for AI agents and tooling",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,6 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"author": "Andrii Kremlovskyi",
|
|
27
27
|
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/Kremliovskyi/playwright-traces-reader"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/Kremliovskyi/playwright-traces-reader#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/Kremliovskyi/playwright-traces-reader/issues"
|
|
35
|
+
},
|
|
28
36
|
"devDependencies": {
|
|
29
37
|
"@types/adm-zip": "^0.5.8",
|
|
30
38
|
"@types/jest": "^30.0.0",
|
|
@@ -18,22 +18,90 @@ And a built trace directory under `playwright-report/data/<sha1>/` (or a `.zip`
|
|
|
18
18
|
|
|
19
19
|
## How to Use
|
|
20
20
|
|
|
21
|
-
### 1. Find failed tests
|
|
21
|
+
### 1. Find failed tests
|
|
22
|
+
|
|
23
|
+
Use `getFailedTestSummaries()` — a single call that returns `TraceSummary[]` for every **unique** failing test in a report. It handles three tricky cases internally:
|
|
24
|
+
|
|
25
|
+
- **Passing tests** skipped cheaply (no full summary built)
|
|
26
|
+
- **Retries** deduplicated by the full unique title from `context-options` (spec path + describe + test name). The **last retry** is used — highest root step `endTime` — so the summary reflects the most recent execution with the most relevant DOM snapshot and network traffic
|
|
27
|
+
- **Pure API traces** (no browser context) deduplicated by trace directory name
|
|
22
28
|
|
|
23
29
|
```typescript
|
|
24
|
-
import {
|
|
30
|
+
import { getFailedTestSummaries } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
25
31
|
|
|
26
|
-
const
|
|
27
|
-
|
|
32
|
+
const failures = await getFailedTestSummaries('/path/to/playwright-report/data');
|
|
33
|
+
// failures.length = number of distinct failing tests
|
|
34
|
+
// Retries and passing tests are already excluded
|
|
28
35
|
|
|
36
|
+
console.log(`Unique failed tests: ${failures.length}`);
|
|
29
37
|
for (const f of failures) {
|
|
30
|
-
console.log(`FAILED: ${f.title}`);
|
|
31
|
-
console.log(`Error: ${f.error
|
|
38
|
+
console.log(`FAILED: ${f.testTitle ?? f.title}`);
|
|
39
|
+
console.log(`Error: ${f.error?.message}`);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Inspect failure details
|
|
44
|
+
|
|
45
|
+
Each item returned by `getFailedTestSummaries()` is a `TraceSummary` — it already contains everything needed for failure analysis. No second call required.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { getFailedTestSummaries } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
49
|
+
|
|
50
|
+
const failures = await getFailedTestSummaries('/path/to/playwright-report/data');
|
|
51
|
+
|
|
52
|
+
for (const f of failures) {
|
|
53
|
+
console.log(`[FAILED] ${f.testTitle ?? f.title}`);
|
|
32
54
|
console.log(`Duration: ${f.durationMs}ms`);
|
|
55
|
+
console.log(`Error: ${f.error?.message}`);
|
|
56
|
+
|
|
57
|
+
console.log('Test steps:');
|
|
58
|
+
for (const step of f.topLevelSteps) {
|
|
59
|
+
const failed = step.error ? ' ✗' : '';
|
|
60
|
+
console.log(` ${step.title} (${step.durationMs}ms)${failed}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log('Slowest 5 steps:');
|
|
64
|
+
for (const step of f.slowestSteps) {
|
|
65
|
+
console.log(` ${step.durationMs}ms — ${step.title}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
console.log(`Network calls: ${f.networkCalls.length}`);
|
|
69
|
+
for (const call of f.networkCalls) {
|
|
70
|
+
console.log(` ${call.method} ${call.url} → ${call.status}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (f.failureDomSnapshot?.after) {
|
|
74
|
+
// DOM state at the time of failure — AI-readable HTML
|
|
75
|
+
console.log('DOM at failure:', f.failureDomSnapshot.after.html.slice(0, 500));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Drill into the nested step tree to find the specific failing assertion/action
|
|
79
|
+
function collectErrors(steps, out = []) {
|
|
80
|
+
for (const s of steps) {
|
|
81
|
+
if (s.error) out.push(s);
|
|
82
|
+
collectErrors(s.children, out);
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
const deepFailures = f.topLevelSteps.flatMap(s => collectErrors(s.children));
|
|
87
|
+
for (const s of deepFailures) {
|
|
88
|
+
console.log(` nested failure: ${s.title} — ${s.error.message}`);
|
|
89
|
+
}
|
|
33
90
|
}
|
|
34
91
|
```
|
|
35
92
|
|
|
36
|
-
|
|
93
|
+
`TraceSummary` fields:
|
|
94
|
+
- **`testTitle`** — **full unique test title** from `context-options` (spec path + describe + test name). Use for display. `null` for pure API traces with no browser context.
|
|
95
|
+
- **`title`** — root `test.step()` title (from `test.trace`). The failing step or longest non-hook step.
|
|
96
|
+
- **`status`** — `'passed'` | `'failed'`
|
|
97
|
+
- **`durationMs`** — duration of the main test step
|
|
98
|
+
- **`error`** — the top-level error, or `null` if passed
|
|
99
|
+
- **`topLevelSteps`** — non-hook root steps (the visible `test.step()` blocks), each with `.children` for drilling down
|
|
100
|
+
- **`slowestSteps`** — top 5 slowest steps across the full step tree
|
|
101
|
+
- **`networkCalls`** — all HTTP calls made during the test (`source: 'api'` = Node.js `APIRequestContext`; `source: 'browser'` = XHR / fetch / navigation)
|
|
102
|
+
- **`failureDomSnapshot`** — `ActionDomSnapshots` closest in time to the failure, or `null`
|
|
103
|
+
|
|
104
|
+
### 3. Find slow steps
|
|
37
105
|
|
|
38
106
|
```typescript
|
|
39
107
|
import { prepareTraceDir, getTestSteps } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
@@ -55,7 +123,9 @@ console.log('Top 5 slowest steps:');
|
|
|
55
123
|
sorted.slice(0, 5).forEach(s => console.log(` ${s.durationMs}ms — ${s.title}`));
|
|
56
124
|
```
|
|
57
125
|
|
|
58
|
-
|
|
126
|
+
> **Shortcut**: `getSummary()` already returns the top 5 slowest steps in `summary.slowestSteps` — no manual flattening needed.
|
|
127
|
+
|
|
128
|
+
### 4. Extract network traffic
|
|
59
129
|
|
|
60
130
|
```typescript
|
|
61
131
|
import { prepareTraceDir, getNetworkTraffic } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
@@ -63,15 +133,19 @@ import { prepareTraceDir, getNetworkTraffic } from '@andrii_kremlovskyi/playwrig
|
|
|
63
133
|
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
64
134
|
const traffic = await getNetworkTraffic(ctx);
|
|
65
135
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
for (const call of apiCalls) {
|
|
69
|
-
console.log(`${call.method} ${call.url} → ${call.status}`);
|
|
136
|
+
for (const call of traffic) {
|
|
137
|
+
console.log(`[${call.source}] ${call.method} ${call.url} → ${call.status}`);
|
|
70
138
|
if (call.responseBody) console.log('Response:', call.responseBody.slice(0, 500));
|
|
71
139
|
}
|
|
140
|
+
|
|
141
|
+
// Filter by source if needed:
|
|
142
|
+
const apiOnly = traffic.filter(e => e.source === 'api'); // Node.js APIRequestContext
|
|
143
|
+
const browserOnly = traffic.filter(e => e.source === 'browser'); // XHR / fetch / navigation
|
|
72
144
|
```
|
|
73
145
|
|
|
74
|
-
###
|
|
146
|
+
### 5. Extract screenshots for human visual inspection
|
|
147
|
+
|
|
148
|
+
> **AI agent limitation**: AI agents cannot read or understand JPEG/PNG image files from disk. `extractScreenshots()` is for **human visual inspection only** — open the `savedPath` files in your image viewer. For AI analysis of UI state, use `getDomSnapshots()` (section 6), which returns full HTML that an AI can read and reason about.
|
|
75
149
|
|
|
76
150
|
```typescript
|
|
77
151
|
import { prepareTraceDir, extractScreenshots } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
@@ -83,38 +157,48 @@ const screenshots = await extractScreenshots(ctx, `${os.tmpdir()}/pw-screenshots
|
|
|
83
157
|
for (const s of screenshots) {
|
|
84
158
|
console.log(`Screenshot at ${s.timestamp}ms: ${s.savedPath}`);
|
|
85
159
|
}
|
|
86
|
-
//
|
|
160
|
+
// Open savedPath files in an image viewer for visual inspection
|
|
161
|
+
// An AI agent cannot interpret these files — use getDomSnapshots() for AI analysis
|
|
87
162
|
```
|
|
88
163
|
|
|
89
|
-
###
|
|
164
|
+
### 6. Inspect DOM state before/during/after each action
|
|
165
|
+
|
|
166
|
+
`getDomSnapshots()` accepts an optional `options` argument to filter the results — especially useful for long traces with many snapshots.
|
|
90
167
|
|
|
91
168
|
```typescript
|
|
92
169
|
import { prepareTraceDir, getDomSnapshots } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
93
170
|
|
|
94
171
|
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
95
|
-
const snapshots = await getDomSnapshots(ctx);
|
|
96
172
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
173
|
+
// Full list (may be large — 40+ entries per trace)
|
|
174
|
+
const all = await getDomSnapshots(ctx);
|
|
175
|
+
|
|
176
|
+
// Most useful for AI failure analysis: just the last 3 actions before the test ended
|
|
177
|
+
const last3 = await getDomSnapshots(ctx, { near: 'last', limit: 3 });
|
|
178
|
+
|
|
179
|
+
// Window of 5 entries around a specific action (e.g. from getSummary().failureDomSnapshot.callId)
|
|
180
|
+
const window = await getDomSnapshots(ctx, { near: 'call@585', limit: 5 });
|
|
181
|
+
|
|
182
|
+
// Only 'after' phase snapshots (post-action DOM state, most useful for debugging)
|
|
183
|
+
const afterOnly = await getDomSnapshots(ctx, { phase: 'after' });
|
|
184
|
+
|
|
185
|
+
for (const action of last3) {
|
|
101
186
|
const snap = action.after ?? action.before;
|
|
102
187
|
if (!snap) continue;
|
|
103
|
-
|
|
104
188
|
console.log(`callId: ${action.callId} | url: ${snap.frameUrl}`);
|
|
105
189
|
if (snap.targetElement) {
|
|
106
190
|
console.log(` targeted element (callId attr): ${snap.targetElement}`);
|
|
107
191
|
}
|
|
108
192
|
console.log(` DOM snippet: ${snap.html.slice(0, 300)}`);
|
|
109
193
|
}
|
|
110
|
-
|
|
111
|
-
// Find the DOM snapshot for a specific action by its callId
|
|
112
|
-
const target = snapshots.find(s => s.callId === 'call@42');
|
|
113
|
-
if (target?.after) {
|
|
114
|
-
console.log('DOM after action 42:', target.after.html);
|
|
115
|
-
}
|
|
116
194
|
```
|
|
117
195
|
|
|
196
|
+
`DomSnapshotOptions`:
|
|
197
|
+
- `near: 'last'` — return the last `limit` entries (default 5). Best for "what was the page doing just before it failed?"
|
|
198
|
+
- `near: 'call@N'` — return a window of `limit` entries centred on that callId
|
|
199
|
+
- `phase: 'before' | 'action' | 'after'` — filter to one snapshot phase
|
|
200
|
+
- `limit: number` — max entries to return; meaning varies by `near` (see above), or caps from the beginning when `near` is omitted
|
|
201
|
+
|
|
118
202
|
Each `DomSnapshot` includes:
|
|
119
203
|
- `html` — full serialized HTML string (back-references resolved, `<script>` tags stripped)
|
|
120
204
|
- `phase` — `"before"` | `"action"` | `"after"`
|
|
@@ -122,19 +206,69 @@ Each `DomSnapshot` includes:
|
|
|
122
206
|
- `targetElement` — `callId` of the action that targeted an element (from `__playwright_target__` attr), or `null`
|
|
123
207
|
- `viewport` — `{ width, height }` at snapshot time
|
|
124
208
|
|
|
209
|
+
### 7. Get a merged chronological timeline
|
|
210
|
+
|
|
211
|
+
`getTimeline()` merges all event types into a single chronologically sorted array, eliminating the need for manual timestamp correlation across four separate API calls.
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import { prepareTraceDir, getTimeline } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
215
|
+
import type { TestStep, ScreenshotMetadata, ActionDomSnapshots, NetworkEntry } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
216
|
+
|
|
217
|
+
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
218
|
+
const timeline = await getTimeline(ctx);
|
|
219
|
+
|
|
220
|
+
for (const entry of timeline) {
|
|
221
|
+
switch (entry.type) {
|
|
222
|
+
case 'step': {
|
|
223
|
+
const step = entry.data as TestStep;
|
|
224
|
+
console.log(`[step] ${step.title} (${step.durationMs}ms)`);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
case 'screenshot': {
|
|
228
|
+
const shot = entry.data as ScreenshotMetadata;
|
|
229
|
+
// No savedPath — call extractScreenshots() if you need the files
|
|
230
|
+
console.log(`[screenshot] sha1=${shot.sha1}`);
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
case 'dom': {
|
|
234
|
+
const dom = entry.data as ActionDomSnapshots;
|
|
235
|
+
console.log(`[dom] callId=${dom.callId}`);
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
case 'network': {
|
|
239
|
+
const net = entry.data as NetworkEntry;
|
|
240
|
+
console.log(`[network] ${net.method} ${net.url} → ${net.status}`);
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Focus on the last events before the test ended
|
|
247
|
+
for (const entry of timeline.slice(-10)) {
|
|
248
|
+
console.log(`[${entry.type}] @${entry.timestamp}`);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
`TimelineEntry` fields:
|
|
253
|
+
- `timestamp` — wall-clock time in milliseconds since epoch
|
|
254
|
+
- `type` — `'step'` | `'screenshot'` | `'dom'` | `'network'`
|
|
255
|
+
- `data` — cast based on `type` (see above)
|
|
256
|
+
|
|
257
|
+
> Note: screenshot entries in the timeline are `ScreenshotMetadata` (no `savedPath`). Screenshots are metadata-only to avoid unexpected disk writes. Call `extractScreenshots()` separately if you need the files.
|
|
258
|
+
|
|
125
259
|
## Locating Trace Directories
|
|
126
260
|
|
|
127
|
-
A Playwright report's `data/` directory holds **one SHA1 entry per test
|
|
261
|
+
A Playwright report's `data/` directory holds **one SHA1 entry per test execution** (including retries). `getFailedTestSummaries()` handles this automatically. For lower-level iteration use `listTraces()`:
|
|
128
262
|
|
|
129
263
|
```typescript
|
|
130
|
-
import { listTraces,
|
|
264
|
+
import { listTraces, getSummary } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
131
265
|
|
|
132
|
-
// Works for 1 test or many — automatically discovers all SHA1 trace entries
|
|
266
|
+
// Works for 1 test or many — automatically discovers all SHA1 trace entries (dirs and zips)
|
|
133
267
|
const traces = await listTraces('/path/to/playwright-report/data');
|
|
134
268
|
|
|
135
269
|
for (const ctx of traces) {
|
|
136
|
-
const
|
|
137
|
-
// ... process results per test
|
|
270
|
+
const summary = await getSummary(ctx);
|
|
271
|
+
// ... process results per test (includes passing, failing, and retries)
|
|
138
272
|
}
|
|
139
273
|
```
|
|
140
274
|
|
|
@@ -142,6 +276,18 @@ Each entry is either a directory (already extracted) or a `.zip` (auto-extracted
|
|
|
142
276
|
|
|
143
277
|
## Low-Level Utilities
|
|
144
278
|
|
|
279
|
+
### `getSummary(ctx)`
|
|
280
|
+
|
|
281
|
+
Builds a `TraceSummary` for a single `TraceContext`. Use this when you already have a specific `ctx` (e.g. from `listTraces()` without filtering). For report-level failure analysis, prefer `getFailedTestSummaries()` which calls this internally only for unique failures.
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
import { prepareTraceDir, getSummary } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
285
|
+
|
|
286
|
+
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
287
|
+
const summary = await getSummary(ctx);
|
|
288
|
+
console.log(`[${summary.status.toUpperCase()}] ${summary.testTitle ?? summary.title}`);
|
|
289
|
+
```
|
|
290
|
+
|
|
145
291
|
### `prepareTraceDir(tracePath)`
|
|
146
292
|
|
|
147
293
|
Takes a single path (directory or `.zip`) and returns a `TraceContext`. Use this when you have a specific trace path rather than a whole `data/` directory.
|
|
@@ -187,10 +333,39 @@ for await (const event of readNdjson<{ type: string }>(traceFile)) {
|
|
|
187
333
|
}
|
|
188
334
|
```
|
|
189
335
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
336
|
+
## Execution Pattern
|
|
337
|
+
|
|
338
|
+
All code snippets in this skill use ES module `import` syntax. Write them to a temporary `.mjs` file and execute with Node.js — the `.mjs` extension tells Node to treat the file as an ES module without requiring a `package.json` change.
|
|
339
|
+
|
|
340
|
+
**Recommended workflow (works on macOS, Linux, and Windows):**
|
|
341
|
+
|
|
342
|
+
1. Use the `create_file` tool to write the script to a fixed filename:
|
|
343
|
+
```
|
|
344
|
+
<workspace-root>/__trace_analysis__.mjs
|
|
345
|
+
```
|
|
346
|
+
2. Run it:
|
|
347
|
+
```bash
|
|
348
|
+
node __trace_analysis__.mjs
|
|
349
|
+
```
|
|
350
|
+
3. Clean up after the session:
|
|
351
|
+
```bash
|
|
352
|
+
# macOS / Linux
|
|
353
|
+
rm __trace_analysis__.mjs
|
|
354
|
+
# Windows PowerShell
|
|
355
|
+
Remove-Item __trace_analysis__.mjs
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Using a fixed, recognisable filename makes it easy to spot and clean up if the agent session ends unexpectedly.
|
|
359
|
+
|
|
360
|
+
## Tips
|
|
361
|
+
|
|
362
|
+
- **Starting point for report-level failures**: Use `getFailedTestSummaries(dataDir)` — returns `TraceSummary[]` for every unique failing test with retries deduplicated and passing tests excluded. The returned `TraceSummary` already contains steps, API calls, and the DOM snapshot at failure.
|
|
363
|
+
- **Starting point for per-context analysis**: Use `getSummary(ctx)` on a specific `TraceContext` from `listTraces()` — it gives `testTitle`, status, error, slowest steps, API calls, and the DOM snapshot closest to the failure in one call.
|
|
364
|
+
- **Accurate failure count**: `getFailedTestSummaries()` deduplicates by the full Playwright title (spec path + describe + test name from `context-options`), correctly identifying 13 unique tests even when 23 traces exist (10 failed × 2 retries + 3 flaky × 1 trace). Using root step titles (`f.title`) would under-count when different tests share the same `test.step()` description.
|
|
365
|
+
- **Drill into failures**: Each `TestStep` in `topLevelSteps` includes `.children`. Walk them recursively to find the specific assertion or action that failed within the test.
|
|
366
|
+
- **Failures**: The `error.message` in a `TraceSummary` contains the full diff for assertion failures.
|
|
367
|
+
- **Network issues**: `summary.networkCalls` contains all HTTP calls (API and browser). Filter by `source === 'api'` for Node.js `APIRequestContext` calls or `source === 'browser'` for XHR/fetch/navigation. Check `status >= 400` for HTTP errors.
|
|
368
|
+
- **Slow tests**: `getSummary().slowestSteps` gives top 5 instantly. For the full picture use `getTestSteps()` and sort by `durationMs`.
|
|
369
|
+
- **Visual state (AI)**: Use `getDomSnapshots()` with `{ near: 'last', limit: 3 }` — returns full HTML that an AI can read and reason about. `failureDomSnapshot` on each `TraceSummary` gives the DOM closest to the failure directly.
|
|
370
|
+
- **Visual state (human)**: Use `extractScreenshots()` to get JPEG files for human inspection in an image viewer. AI agents cannot read image files from disk.
|
|
371
|
+
- **Timeline**: Use `getTimeline()` to build a chronological narrative merging steps, screenshots, DOM snapshots, and network calls — ideal for correlating what was happening at the exact moment of failure.
|