@andrii_kremlovskyi/playwright-traces-reader 1.3.1 → 2.0.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 CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Parse [Playwright](https://playwright.dev) trace files into structured data — useful for AI agents, custom reporters, and post-run analysis tooling.
4
4
 
5
+ See [CLI_ARCHITECTURE.md](CLI_ARCHITECTURE.md) for the future CLI and report-hub architecture overview.
6
+ See [CLI_REFERENCE.md](CLI_REFERENCE.md) for the detailed CLI command reference.
7
+ See [CLI_JSON_CONTRACTS.md](CLI_JSON_CONTRACTS.md) for the versioned JSON output contracts used by the CLI.
8
+ See [LIBRARY_INTEGRATION.md](LIBRARY_INTEGRATION.md) for in-process library usage guidance.
9
+
5
10
  ## Features
6
11
 
7
12
  - Find all unique failed tests across a report in one call — retries deduplicated, passing tests excluded, last retry selected automatically (`getFailedTestSummaries`)
@@ -21,6 +26,35 @@ Parse [Playwright](https://playwright.dev) trace files into structured data —
21
26
  npm install @andrii_kremlovskyi/playwright-traces-reader
22
27
  ```
23
28
 
29
+ ## CLI
30
+
31
+ The package exposes a local CLI. In a repository that has the package installed, use it with `npx`:
32
+
33
+ ```bash
34
+ npx playwright-traces-reader failures ./playwright-report
35
+ npx playwright-traces-reader summary ./playwright-report/data/<sha1>
36
+ npx playwright-traces-reader network ./playwright-report/data/<sha1> --format json
37
+ ```
38
+
39
+ Phase 1 commands:
40
+
41
+ - `init-skills [targetDir]` — scaffold the GitHub Copilot skill into a repository
42
+ - `failures <reportPath>` — report-level unique failing test analysis
43
+ - `summary <tracePath>` — one-call trace summary
44
+ - `slow-steps <tracePath>` — slowest steps from a single trace
45
+ - `steps <tracePath>` — step tree reconstruction
46
+ - `network <tracePath>` — API and browser network traffic
47
+ - `dom <tracePath>` — DOM snapshots before, during, and after actions
48
+ - `timeline <tracePath>` — merged chronological trace timeline
49
+ - `screenshots <tracePath> --out-dir <path>` — extract screenshots for human inspection
50
+
51
+ Supported output modes in Phase 1:
52
+
53
+ - `--format text` — human-readable terminal output
54
+ - `--format json` — structured output for agents and automation
55
+
56
+ JSON responses are versioned envelopes documented in [CLI_JSON_CONTRACTS.md](CLI_JSON_CONTRACTS.md).
57
+
24
58
  ## GitHub Copilot Skill
25
59
 
26
60
  Install a ready-made GitHub Copilot skill scaffold into your project:
@@ -31,7 +65,13 @@ npx @andrii_kremlovskyi/playwright-traces-reader init-skills
31
65
  npx @andrii_kremlovskyi/playwright-traces-reader init-skills ./my-project
32
66
  ```
33
67
 
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.
68
+ This copies a `SKILL.md` template to `.github/skills/analyze-playwright-traces/SKILL.md`. The skill is CLI-first and points Copilot to supported `npx playwright-traces-reader ...` commands instead of temporary script generation.
69
+
70
+ ## Library Integration
71
+
72
+ The preferred interface for agents and test repositories is the CLI.
73
+
74
+ For in-process integrations such as future `playwright-reports` usage, see [LIBRARY_INTEGRATION.md](LIBRARY_INTEGRATION.md).
35
75
 
36
76
  ## Trace Format
37
77
 
@@ -63,7 +103,7 @@ for (const f of failures) {
63
103
  console.log(`Error: ${f.error?.message}`);
64
104
  console.log(`Duration: ${f.durationMs}ms`);
65
105
 
66
- for (const call of f.apiCalls) {
106
+ for (const call of f.networkCalls) {
67
107
  console.log(` ${call.method} ${call.url} → ${call.status}`);
68
108
  }
69
109
 
@@ -0,0 +1,14 @@
1
+ import type { ActionDomSnapshots, NetworkEntry, Screenshot, TestStep, TimelineEntry, TraceSummary } from '../index';
2
+ export type OutputFormat = 'text' | 'json';
3
+ export declare function emitOutput(io: {
4
+ stdout: (text: string) => void;
5
+ }, format: OutputFormat, data: unknown, text: string): void;
6
+ export declare function formatFailuresText(summaries: TraceSummary[]): string;
7
+ export declare function formatSummaryText(summary: TraceSummary): string;
8
+ export declare function formatSlowStepsText(steps: TestStep[]): string;
9
+ export declare function formatStepsText(steps: TestStep[]): string;
10
+ export declare function formatNetworkText(entries: NetworkEntry[]): string;
11
+ export declare function formatDomSnapshotsText(snapshots: ActionDomSnapshots[]): string;
12
+ export declare function formatTimelineText(entries: TimelineEntry[]): string;
13
+ export declare function formatScreenshotsText(screenshots: Screenshot[]): string;
14
+ //# sourceMappingURL=formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/cli/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3C,wBAAgB,UAAU,CAAC,EAAE,EAAE;IAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAO1H;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,MAAM,CAmBpE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CA+B/D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAM7D;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAQzD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAiBjE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAmB9E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,MAAM,CAwBnE;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAMvE"}
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emitOutput = emitOutput;
4
+ exports.formatFailuresText = formatFailuresText;
5
+ exports.formatSummaryText = formatSummaryText;
6
+ exports.formatSlowStepsText = formatSlowStepsText;
7
+ exports.formatStepsText = formatStepsText;
8
+ exports.formatNetworkText = formatNetworkText;
9
+ exports.formatDomSnapshotsText = formatDomSnapshotsText;
10
+ exports.formatTimelineText = formatTimelineText;
11
+ exports.formatScreenshotsText = formatScreenshotsText;
12
+ function emitOutput(io, format, data, text) {
13
+ if (format === 'json') {
14
+ io.stdout(`${JSON.stringify(data, null, 2)}\n`);
15
+ return;
16
+ }
17
+ io.stdout(`${text}\n`);
18
+ }
19
+ function formatFailuresText(summaries) {
20
+ if (summaries.length === 0)
21
+ return 'No failing tests found.';
22
+ return summaries.map((summary, index) => {
23
+ const title = summary.testTitle ?? summary.title;
24
+ const errorLine = firstLine(summary.error?.message) ?? 'No error message available';
25
+ const failedNetworkCount = summary.networkCalls.filter(entry => entry.status >= 400).length;
26
+ const slowSteps = summary.slowestSteps.slice(0, 3)
27
+ .map(step => `${step.durationMs ?? 0}ms ${step.title}`)
28
+ .join(' | ');
29
+ return [
30
+ `${index + 1}. [${summary.outcome ?? summary.status}] ${title}`,
31
+ ` Duration: ${formatDuration(summary.durationMs)}`,
32
+ ` Error: ${errorLine}`,
33
+ ` Network: ${summary.networkCalls.length} calls (${failedNetworkCount} errors)`,
34
+ ` Slowest: ${slowSteps || 'n/a'}`,
35
+ ].join('\n');
36
+ }).join('\n\n');
37
+ }
38
+ function formatSummaryText(summary) {
39
+ const lines = [
40
+ `${summary.status.toUpperCase()} ${summary.testTitle ?? summary.title}`,
41
+ `Outcome: ${summary.outcome ?? 'unknown'}`,
42
+ `Duration: ${formatDuration(summary.durationMs)}`,
43
+ ];
44
+ if (summary.error?.message) {
45
+ lines.push(`Error: ${summary.error.message}`);
46
+ }
47
+ if (summary.topLevelSteps.length > 0) {
48
+ lines.push('Top-level steps:');
49
+ lines.push(indentBlock(formatStepsText(summary.topLevelSteps), 2));
50
+ }
51
+ if (summary.slowestSteps.length > 0) {
52
+ lines.push('Slowest steps:');
53
+ lines.push(indentBlock(formatSlowStepsText(summary.slowestSteps), 2));
54
+ }
55
+ if (summary.networkCalls.length > 0) {
56
+ lines.push(`Network calls: ${summary.networkCalls.length}`);
57
+ }
58
+ if (summary.failureDomSnapshot) {
59
+ lines.push('Failure DOM snapshot:');
60
+ lines.push(indentBlock(formatDomSnapshotsText([summary.failureDomSnapshot]), 2));
61
+ }
62
+ return lines.join('\n');
63
+ }
64
+ function formatSlowStepsText(steps) {
65
+ if (steps.length === 0)
66
+ return 'No timed steps found.';
67
+ return steps.map((step, index) => (`${index + 1}. ${formatDuration(step.durationMs)} ${step.title}${step.error ? ' [failed]' : ''}`)).join('\n');
68
+ }
69
+ function formatStepsText(steps) {
70
+ if (steps.length === 0)
71
+ return 'No steps found.';
72
+ const lines = [];
73
+ for (const step of steps) {
74
+ appendStepLines(lines, step, 0);
75
+ }
76
+ return lines.join('\n');
77
+ }
78
+ function formatNetworkText(entries) {
79
+ if (entries.length === 0)
80
+ return 'No network entries found.';
81
+ return entries.map((entry, index) => {
82
+ const lines = [
83
+ `${index + 1}. [${entry.source}] ${entry.method} ${entry.url} -> ${entry.status} ${entry.statusText}`,
84
+ ` Duration: ${entry.durationMs}ms | MIME: ${entry.mimeType || 'unknown'}`,
85
+ ];
86
+ const requestBody = truncate(entry.requestBody, 240);
87
+ if (requestBody)
88
+ lines.push(` Request body: ${requestBody}`);
89
+ const responseBody = truncate(entry.responseBody, 240);
90
+ if (responseBody)
91
+ lines.push(` Response body: ${responseBody}`);
92
+ return lines.join('\n');
93
+ }).join('\n\n');
94
+ }
95
+ function formatDomSnapshotsText(snapshots) {
96
+ if (snapshots.length === 0)
97
+ return 'No DOM snapshots found.';
98
+ return snapshots.map((snapshot, index) => {
99
+ const lines = [`${index + 1}. callId ${snapshot.callId}`];
100
+ for (const phase of ['before', 'action', 'after']) {
101
+ const phaseSnapshot = snapshot[phase];
102
+ if (!phaseSnapshot)
103
+ continue;
104
+ lines.push(` ${phase}: ${phaseSnapshot.frameUrl}`);
105
+ if (phaseSnapshot.targetElement) {
106
+ lines.push(` ${phase} target: ${phaseSnapshot.targetElement}`);
107
+ }
108
+ lines.push(` ${phase} html: ${truncate(singleLine(phaseSnapshot.html), 220)}`);
109
+ }
110
+ return lines.join('\n');
111
+ }).join('\n\n');
112
+ }
113
+ function formatTimelineText(entries) {
114
+ if (entries.length === 0)
115
+ return 'No timeline entries found.';
116
+ return entries.map(entry => {
117
+ const prefix = `${new Date(entry.timestamp).toISOString()} [${entry.type}]`;
118
+ switch (entry.type) {
119
+ case 'step': {
120
+ const step = entry.data;
121
+ return `${prefix} ${step.title}`;
122
+ }
123
+ case 'screenshot': {
124
+ const screenshot = entry.data;
125
+ return `${prefix} ${screenshot.sha1} ${screenshot.width}x${screenshot.height}`;
126
+ }
127
+ case 'dom': {
128
+ const domSnapshot = entry.data;
129
+ return `${prefix} callId ${domSnapshot.callId}`;
130
+ }
131
+ case 'network': {
132
+ const networkEntry = entry.data;
133
+ return `${prefix} ${networkEntry.method} ${networkEntry.url} -> ${networkEntry.status}`;
134
+ }
135
+ }
136
+ }).join('\n');
137
+ }
138
+ function formatScreenshotsText(screenshots) {
139
+ if (screenshots.length === 0)
140
+ return 'No screenshots extracted.';
141
+ return screenshots.map((screenshot, index) => (`${index + 1}. ${screenshot.savedPath} (${screenshot.width}x${screenshot.height}, ${screenshot.timestamp})`)).join('\n');
142
+ }
143
+ function appendStepLines(lines, step, depth) {
144
+ const indent = ' '.repeat(depth);
145
+ const suffix = step.error ? ` [failed: ${firstLine(step.error.message) ?? step.error.name}]` : '';
146
+ lines.push(`${indent}- ${step.title} (${formatDuration(step.durationMs)})${suffix}`);
147
+ for (const child of step.children) {
148
+ appendStepLines(lines, child, depth + 1);
149
+ }
150
+ }
151
+ function formatDuration(durationMs) {
152
+ return durationMs === null ? 'n/a' : `${durationMs}ms`;
153
+ }
154
+ function firstLine(value) {
155
+ if (!value)
156
+ return null;
157
+ return value.split(/\r?\n/, 1)[0] ?? null;
158
+ }
159
+ function singleLine(value) {
160
+ return value.replace(/\s+/g, ' ').trim();
161
+ }
162
+ function truncate(value, maxLength) {
163
+ if (!value)
164
+ return null;
165
+ const compact = singleLine(value);
166
+ if (compact.length <= maxLength)
167
+ return compact;
168
+ return `${compact.slice(0, maxLength - 3)}...`;
169
+ }
170
+ function indentBlock(value, spaces) {
171
+ const indent = ' '.repeat(spaces);
172
+ return value.split('\n').map(line => `${indent}${line}`).join('\n');
173
+ }
174
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/cli/formatters.ts"],"names":[],"mappings":";;AAWA,gCAOC;AAED,gDAmBC;AAED,8CA+BC;AAED,kDAMC;AAED,0CAQC;AAED,8CAiBC;AAED,wDAmBC;AAED,gDAwBC;AAED,sDAMC;AAzJD,SAAgB,UAAU,CAAC,EAAsC,EAAE,MAAoB,EAAE,IAAa,EAAE,IAAY;IAClH,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO;IACT,CAAC;IAED,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,SAAgB,kBAAkB,CAAC,SAAyB;IAC1D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,yBAAyB,CAAC;IAE7D,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,IAAI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AAC3C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAgC,EAAE,SAAiB;IACnE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,OAAO,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,OAAO,CAAC;IAChD,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAE,MAAc;IAChD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type TraceContext } from '../index';
2
+ export declare function copySkillTemplate(targetDir: string): Promise<string>;
3
+ export declare function resolveReportDataDir(inputPath: string): Promise<string>;
4
+ export declare function loadReportMetadataForTrace(traceContext: TraceContext, explicitReportPath?: string): Promise<import("../parseTrace").ReportMetadata | null>;
5
+ export declare function parsePositiveInteger(value: string): number;
6
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAEhE,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAa1E;AAED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB7E;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,YAAY,EAC1B,kBAAkB,CAAC,EAAE,MAAM,0DAO5B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM1D"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.copySkillTemplate = copySkillTemplate;
37
+ exports.resolveReportDataDir = resolveReportDataDir;
38
+ exports.loadReportMetadataForTrace = loadReportMetadataForTrace;
39
+ exports.parsePositiveInteger = parsePositiveInteger;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const commander_1 = require("commander");
43
+ const index_1 = require("../index");
44
+ async function copySkillTemplate(targetDir) {
45
+ const skillDir = path.join(targetDir, '.github', 'skills', 'analyze-playwright-traces');
46
+ await fs.promises.mkdir(skillDir, { recursive: true });
47
+ const templatePath = path.resolve(__dirname, '..', '..', 'templates', 'skills', 'analyze-playwright-traces', 'SKILL.md');
48
+ const destPath = path.join(skillDir, 'SKILL.md');
49
+ if (!fs.existsSync(templatePath)) {
50
+ throw new Error(`Template not found at ${templatePath}`);
51
+ }
52
+ await fs.promises.copyFile(templatePath, destPath);
53
+ return destPath;
54
+ }
55
+ async function resolveReportDataDir(inputPath) {
56
+ const resolvedPath = path.resolve(inputPath);
57
+ const stat = await fs.promises.stat(resolvedPath);
58
+ if (!stat.isDirectory()) {
59
+ throw new Error(`Invalid report path: ${resolvedPath}. Expected a report root or data directory.`);
60
+ }
61
+ const reportIndexPath = path.join(resolvedPath, 'index.html');
62
+ const reportDataDir = path.join(resolvedPath, 'data');
63
+ if (fs.existsSync(reportIndexPath) && fs.existsSync(reportDataDir)) {
64
+ return reportDataDir;
65
+ }
66
+ if (path.basename(resolvedPath) === 'data') {
67
+ return resolvedPath;
68
+ }
69
+ throw new Error(`Could not resolve a Playwright report data directory from ${resolvedPath}.`);
70
+ }
71
+ async function loadReportMetadataForTrace(traceContext, explicitReportPath) {
72
+ if (explicitReportPath) {
73
+ return (0, index_1.getReportMetadata)(path.resolve(explicitReportPath));
74
+ }
75
+ return (0, index_1.getReportMetadata)(path.dirname(traceContext.traceDir));
76
+ }
77
+ function parsePositiveInteger(value) {
78
+ const parsed = Number.parseInt(value, 10);
79
+ if (!Number.isInteger(parsed) || parsed <= 0) {
80
+ throw new commander_1.InvalidArgumentError(`Invalid positive integer: ${value}`);
81
+ }
82
+ return parsed;
83
+ }
84
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,YAAY,CAAC,CAAC;IAC9D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACtD,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACnE,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,MAAM,EAAE,CAAC;QAC3C,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,6DAA6D,YAAY,GAAG,CAAC,CAAC;AAChG,CAAC;AAEM,KAAK,UAAU,0BAA0B,CAC9C,YAA0B,EAC1B,kBAA2B;IAE3B,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,IAAA,yBAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,IAAA,yBAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAa;IAChD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,gCAAoB,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { ActionDomSnapshots, NetworkEntry, Screenshot, TestStep, TimelineEntry, TraceSummary } from '../index';
2
+ export declare const CLI_JSON_SCHEMA_VERSION: 1;
3
+ export interface FailuresCommandJson {
4
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
5
+ command: 'failures';
6
+ count: number;
7
+ failures: TraceSummary[];
8
+ }
9
+ export interface SummaryCommandJson {
10
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
11
+ command: 'summary';
12
+ summary: TraceSummary;
13
+ }
14
+ export interface SlowStepsCommandJson {
15
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
16
+ command: 'slow-steps';
17
+ count: number;
18
+ steps: TestStep[];
19
+ }
20
+ export interface StepsCommandJson {
21
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
22
+ command: 'steps';
23
+ count: number;
24
+ steps: TestStep[];
25
+ }
26
+ export interface NetworkCommandJson {
27
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
28
+ command: 'network';
29
+ count: number;
30
+ entries: NetworkEntry[];
31
+ }
32
+ export interface DomCommandJson {
33
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
34
+ command: 'dom';
35
+ count: number;
36
+ snapshots: ActionDomSnapshots[];
37
+ }
38
+ export interface TimelineCommandJson {
39
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
40
+ command: 'timeline';
41
+ count: number;
42
+ entries: TimelineEntry[];
43
+ }
44
+ export interface ScreenshotsCommandJson {
45
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
46
+ command: 'screenshots';
47
+ count: number;
48
+ screenshots: Screenshot[];
49
+ }
50
+ export type CliCommandJson = FailuresCommandJson | SummaryCommandJson | SlowStepsCommandJson | StepsCommandJson | NetworkCommandJson | DomCommandJson | TimelineCommandJson | ScreenshotsCommandJson;
51
+ export declare function createFailuresCommandJson(failures: TraceSummary[]): FailuresCommandJson;
52
+ export declare function createSummaryCommandJson(summary: TraceSummary): SummaryCommandJson;
53
+ export declare function createSlowStepsCommandJson(steps: TestStep[]): SlowStepsCommandJson;
54
+ export declare function createStepsCommandJson(steps: TestStep[]): StepsCommandJson;
55
+ export declare function createNetworkCommandJson(entries: NetworkEntry[]): NetworkCommandJson;
56
+ export declare function createDomCommandJson(snapshots: ActionDomSnapshots[]): DomCommandJson;
57
+ export declare function createTimelineCommandJson(entries: TimelineEntry[]): TimelineCommandJson;
58
+ export declare function createScreenshotsCommandJson(screenshots: Screenshot[]): ScreenshotsCommandJson;
59
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/cli/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,uBAAuB,EAAG,CAAU,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,OAAO,uBAAuB,CAAC;IAC9C,OAAO,EAAE,UAAU,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,OAAO,uBAAuB,CAAC;IAC9C,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,OAAO,uBAAuB,CAAC;IAC9C,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,OAAO,uBAAuB,CAAC;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,OAAO,uBAAuB,CAAC;IAC9C,OAAO,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,MAA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+1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLI_JSON_SCHEMA_VERSION = void 0;
4
+ exports.createFailuresCommandJson = createFailuresCommandJson;
5
+ exports.createSummaryCommandJson = createSummaryCommandJson;
6
+ exports.createSlowStepsCommandJson = createSlowStepsCommandJson;
7
+ exports.createStepsCommandJson = createStepsCommandJson;
8
+ exports.createNetworkCommandJson = createNetworkCommandJson;
9
+ exports.createDomCommandJson = createDomCommandJson;
10
+ exports.createTimelineCommandJson = createTimelineCommandJson;
11
+ exports.createScreenshotsCommandJson = createScreenshotsCommandJson;
12
+ exports.CLI_JSON_SCHEMA_VERSION = 1;
13
+ function createFailuresCommandJson(failures) {
14
+ return {
15
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
16
+ command: 'failures',
17
+ count: failures.length,
18
+ failures,
19
+ };
20
+ }
21
+ function createSummaryCommandJson(summary) {
22
+ return {
23
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
24
+ command: 'summary',
25
+ summary,
26
+ };
27
+ }
28
+ function createSlowStepsCommandJson(steps) {
29
+ return {
30
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
31
+ command: 'slow-steps',
32
+ count: steps.length,
33
+ steps,
34
+ };
35
+ }
36
+ function createStepsCommandJson(steps) {
37
+ return {
38
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
39
+ command: 'steps',
40
+ count: steps.length,
41
+ steps,
42
+ };
43
+ }
44
+ function createNetworkCommandJson(entries) {
45
+ return {
46
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
47
+ command: 'network',
48
+ count: entries.length,
49
+ entries,
50
+ };
51
+ }
52
+ function createDomCommandJson(snapshots) {
53
+ return {
54
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
55
+ command: 'dom',
56
+ count: snapshots.length,
57
+ snapshots,
58
+ };
59
+ }
60
+ function createTimelineCommandJson(entries) {
61
+ return {
62
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
63
+ command: 'timeline',
64
+ count: entries.length,
65
+ entries,
66
+ };
67
+ }
68
+ function createScreenshotsCommandJson(screenshots) {
69
+ return {
70
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
71
+ command: 'screenshots',
72
+ count: screenshots.length,
73
+ screenshots,
74
+ };
75
+ }
76
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/cli/json.ts"],"names":[],"mappings":";;;AA4EA,8DAOC;AAED,4DAMC;AAED,gEAOC;AAED,wDAOC;AAED,4DAOC;AAED,oDAOC;AAED,8DAOC;AAED,oEAOC;AAxIY,QAAA,uBAAuB,GAAG,CAAU,CAAC;AAmElD,SAAgB,yBAAyB,CAAC,QAAwB;IAChE,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB,CAAC,OAAqB;IAC5D,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,SAAS;QAClB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAAC,KAAiB;IAC1D,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,KAAK;KACN,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CAAC,KAAiB;IACtD,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,KAAK;KACN,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB,CAAC,OAAuB;IAC9D,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,OAAO,CAAC,MAAM;QACrB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAAC,SAA+B;IAClE,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,SAAS,CAAC,MAAM;QACvB,SAAS;KACV,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB,CAAC,OAAwB;IAChE,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,OAAO,CAAC,MAAM;QACrB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,4BAA4B,CAAC,WAAyB;IACpE,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE,WAAW,CAAC,MAAM;QACzB,WAAW;KACZ,CAAC;AACJ,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ export interface CliIo {
3
+ stdout: (text: string) => void;
4
+ stderr: (text: string) => void;
5
+ }
6
+ export declare function runCli(argv: string[], io?: CliIo): Promise<number>;
3
7
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA0CA,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AA4JD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAenF"}