@andrii_kremlovskyi/playwright-traces-reader 1.0.0 → 1.0.2
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
|
@@ -15,7 +15,7 @@ Parse [Playwright](https://playwright.dev) trace files into structured data —
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm install @
|
|
18
|
+
npm install @andrii_kremlovskyi/playwright-traces-reader
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Quick Start
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getTestSteps,
|
|
29
29
|
extractScreenshots,
|
|
30
30
|
getDomSnapshots,
|
|
31
|
-
} from '@
|
|
31
|
+
} from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
32
32
|
|
|
33
33
|
// Point at a single extracted trace directory (or a .zip)
|
|
34
34
|
const ctx = await prepareTraceDir('/path/to/playwright-report/data/<sha1>');
|
|
@@ -43,7 +43,7 @@ const steps = await getTestSteps(ctx);
|
|
|
43
43
|
A Playwright HTML report stores one trace entry per test inside `playwright-report/data/`. Use `listTraces()` to iterate all of them:
|
|
44
44
|
|
|
45
45
|
```typescript
|
|
46
|
-
import { listTraces, getFailedTests } from '@
|
|
46
|
+
import { listTraces, getFailedTests } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
47
47
|
|
|
48
48
|
const traces = await listTraces('/path/to/playwright-report/data');
|
|
49
49
|
|
|
@@ -138,9 +138,9 @@ Low-level async generator that streams and parses an NDJSON file line by line. S
|
|
|
138
138
|
Install a ready-made GitHub Copilot skill scaffold into your project:
|
|
139
139
|
|
|
140
140
|
```bash
|
|
141
|
-
npx @
|
|
141
|
+
npx @andrii_kremlovskyi/playwright-traces-reader init-skills
|
|
142
142
|
# or into a custom target directory:
|
|
143
|
-
npx @
|
|
143
|
+
npx @andrii_kremlovskyi/playwright-traces-reader init-skills ./my-project
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
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.
|
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.0.2",
|
|
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",
|
|
@@ -11,7 +11,7 @@ Use this skill when the user asks about test failures, API payloads in tests, sl
|
|
|
11
11
|
|
|
12
12
|
This skill requires the `@kremlovskyi/playwright-traces-reader` npm package in the project:
|
|
13
13
|
```bash
|
|
14
|
-
npm install @
|
|
14
|
+
npm install @andrii_kremlovskyi/playwright-traces-reader
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
And a built trace directory under `playwright-report/data/<sha1>/` (or a `.zip` of the same).
|
|
@@ -21,7 +21,7 @@ And a built trace directory under `playwright-report/data/<sha1>/` (or a `.zip`
|
|
|
21
21
|
### 1. Find failed tests and error details
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
-
import { prepareTraceDir, getFailedTests } from 'playwright-traces-reader';
|
|
24
|
+
import { prepareTraceDir, getFailedTests } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
25
25
|
|
|
26
26
|
const ctx = await prepareTraceDir('/path/to/playwright-report/data/<sha1>');
|
|
27
27
|
const failures = await getFailedTests(ctx);
|
|
@@ -36,7 +36,7 @@ for (const f of failures) {
|
|
|
36
36
|
### 2. Find slow steps
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
import { prepareTraceDir, getTestSteps } from 'playwright-traces-reader';
|
|
39
|
+
import { prepareTraceDir, getTestSteps } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
40
40
|
|
|
41
41
|
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
42
42
|
const steps = await getTestSteps(ctx);
|
|
@@ -58,7 +58,7 @@ sorted.slice(0, 5).forEach(s => console.log(` ${s.durationMs}ms — ${s.title}`
|
|
|
58
58
|
### 3. Extract API request/response bodies
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
|
-
import { prepareTraceDir, getNetworkTraffic } from 'playwright-traces-reader';
|
|
61
|
+
import { prepareTraceDir, getNetworkTraffic } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
62
62
|
|
|
63
63
|
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
64
64
|
const traffic = await getNetworkTraffic(ctx);
|
|
@@ -74,7 +74,7 @@ for (const call of apiCalls) {
|
|
|
74
74
|
### 4. Extract screenshots for visual inspection
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
|
-
import { prepareTraceDir, extractScreenshots } from 'playwright-traces-reader';
|
|
77
|
+
import { prepareTraceDir, extractScreenshots } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
78
78
|
import * as os from 'os';
|
|
79
79
|
|
|
80
80
|
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
@@ -89,7 +89,7 @@ for (const s of screenshots) {
|
|
|
89
89
|
### 5. Inspect DOM state before/during/after each action
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
|
-
import { prepareTraceDir, getDomSnapshots } from 'playwright-traces-reader';
|
|
92
|
+
import { prepareTraceDir, getDomSnapshots } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
93
93
|
|
|
94
94
|
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
95
95
|
const snapshots = await getDomSnapshots(ctx);
|
|
@@ -127,7 +127,7 @@ Each `DomSnapshot` includes:
|
|
|
127
127
|
A Playwright report's `data/` directory holds **one SHA1 entry per test**. A test suite run with multiple tests will have multiple entries. Use `listTraces()` to iterate all of them:
|
|
128
128
|
|
|
129
129
|
```typescript
|
|
130
|
-
import { listTraces, getFailedTests } from 'playwright-traces-reader';
|
|
130
|
+
import { listTraces, getFailedTests } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
131
131
|
|
|
132
132
|
// Works for 1 test or many — automatically discovers all SHA1 trace entries
|
|
133
133
|
const traces = await listTraces('/path/to/playwright-report/data');
|
|
@@ -159,7 +159,7 @@ const ctx = await prepareTraceDir('/path/to/playwright-report/data/<sha1>.zip');
|
|
|
159
159
|
Resolves a SHA1 filename to its raw `Buffer` from the trace's `resources/` directory. Returns `null` if the blob is not found. Useful when you need the raw bytes of a request/response body or a screenshot blob.
|
|
160
160
|
|
|
161
161
|
```typescript
|
|
162
|
-
import { prepareTraceDir, getResourceBuffer } from '@
|
|
162
|
+
import { prepareTraceDir, getResourceBuffer } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
163
163
|
|
|
164
164
|
const ctx = await prepareTraceDir('/path/to/trace-dir');
|
|
165
165
|
const buf = await getResourceBuffer(ctx, 'a1b2c3d4...');
|
|
@@ -174,7 +174,7 @@ if (buf) {
|
|
|
174
174
|
Async generator that streams and parses an NDJSON file line by line. Silently skips malformed lines. Useful for reading raw trace events when the built-in extractors don't cover your use case.
|
|
175
175
|
|
|
176
176
|
```typescript
|
|
177
|
-
import { prepareTraceDir, readNdjson } from '@
|
|
177
|
+
import { prepareTraceDir, readNdjson } from '@andrii_kremlovskyi/playwright-traces-reader';
|
|
178
178
|
import * as path from 'path';
|
|
179
179
|
|
|
180
180
|
const ctx = await prepareTraceDir('/path/to/trace-dir');
|