@empiricalrun/test-gen 0.79.3 → 0.79.5
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/CHANGELOG.md +17 -0
- package/dist/agent/browsing/run.d.ts +1 -1
- package/dist/agent/browsing/run.d.ts.map +1 -1
- package/dist/agent/browsing/utils.d.ts +0 -7
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +1 -56
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +21 -2
- package/dist/agent/chat/prompt/pw-utils-docs.d.ts +1 -1
- package/dist/agent/chat/prompt/pw-utils-docs.d.ts.map +1 -1
- package/dist/agent/chat/prompt/pw-utils-docs.js +1 -1
- package/dist/agent/chat/prompt/trace-utils-docs.d.ts +2 -0
- package/dist/agent/chat/prompt/trace-utils-docs.d.ts.map +1 -0
- package/dist/agent/chat/prompt/trace-utils-docs.js +208 -0
- package/dist/agent/code-review/index.d.ts +1 -1
- package/dist/agent/code-review/index.d.ts.map +1 -1
- package/dist/agent/code-review/index.js +4 -4
- package/dist/agent/code-review/{parser.d.ts → xml-parser.d.ts} +1 -1
- package/dist/agent/code-review/xml-parser.d.ts.map +1 -0
- package/dist/agent/code-review/{parser.js → xml-parser.js} +1 -1
- package/dist/agent/fast-triage/index.d.ts.map +1 -1
- package/dist/agent/fast-triage/index.js +31 -3
- package/dist/agent/master/element-annotation.d.ts.map +1 -1
- package/dist/agent/master/element-annotation.js +2 -19
- package/dist/agent/master/run.d.ts +1 -1
- package/dist/agent/master/run.d.ts.map +1 -1
- package/dist/agent/master/run.js +1 -1
- package/dist/bin/index.js +0 -2
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/dashboard/client.d.ts +2 -40
- package/dist/dashboard/client.d.ts.map +1 -1
- package/dist/dashboard/client.js +4 -206
- package/dist/dashboard/index.d.ts +2 -3
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +10 -10
- package/dist/dashboard/tool-response-from-sandbox.d.ts +2 -0
- package/dist/dashboard/tool-response-from-sandbox.d.ts.map +1 -0
- package/dist/dashboard/tool-response-from-sandbox.js +6 -0
- package/dist/dashboard/tool-response.d.ts +1 -4
- package/dist/dashboard/tool-response.d.ts.map +1 -1
- package/dist/dashboard/tool-response.js +5 -86
- package/dist/dashboard/types.d.ts +1 -8
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/dashboard/types.js +4 -14
- package/dist/file/server.d.ts +1 -1
- package/dist/file/server.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.js +9 -3
- package/dist/generate-summary/generate-error-stack-summary.js +1 -4
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts.map +1 -1
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.js +8 -8
- package/dist/generate-summary/generate-grouped-summary.js +1 -4
- package/dist/generate-summary/merge-summary.js +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/recorder/index.d.ts.map +1 -1
- package/dist/recorder/index.js +2 -2
- package/dist/telemetry/index.d.ts +3 -3
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +8 -5
- package/dist/tools/analyse-video/index.js +1 -1
- package/dist/tools/definitions/publish-markdown-report.d.ts +8 -0
- package/dist/tools/definitions/publish-markdown-report.d.ts.map +1 -0
- package/dist/tools/definitions/publish-markdown-report.js +29 -0
- package/dist/tools/diagnosis-fetcher.d.ts +5 -0
- package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
- package/dist/tools/diagnosis-fetcher.js +17 -12
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +2 -2
- package/dist/tools/fetch-file/index.d.ts.map +1 -1
- package/dist/tools/fetch-file/index.js +11 -10
- package/dist/tools/fetch-file/utils.d.ts +13 -1
- package/dist/tools/fetch-file/utils.d.ts.map +1 -1
- package/dist/tools/fetch-file/utils.js +44 -118
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +9 -5
- package/dist/tools/issues-v1/index.d.ts +0 -2
- package/dist/tools/issues-v1/index.d.ts.map +1 -1
- package/dist/tools/issues-v1/index.js +1 -5
- package/dist/tools/publish-markdown-report/index.d.ts +3 -0
- package/dist/tools/publish-markdown-report/index.d.ts.map +1 -0
- package/dist/tools/publish-markdown-report/index.js +196 -0
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +4 -4
- package/dist/tools/trace-dot-zip/index.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/index.js +19 -9
- package/dist/utils/model.d.ts.map +1 -1
- package/dist/utils/model.js +2 -6
- package/package.json +4 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/code-review/parser.d.ts.map +0 -1
- package/dist/agent/cua/computer.d.ts +0 -14
- package/dist/agent/cua/computer.d.ts.map +0 -1
- package/dist/agent/cua/computer.js +0 -191
- package/dist/agent/cua/index.d.ts +0 -22
- package/dist/agent/cua/index.d.ts.map +0 -1
- package/dist/agent/cua/index.js +0 -254
- package/dist/agent/cua/model.d.ts +0 -25
- package/dist/agent/cua/model.d.ts.map +0 -1
- package/dist/agent/cua/model.js +0 -66
- package/dist/agent/cua/pw-codegen/element-from-point.d.ts +0 -10
- package/dist/agent/cua/pw-codegen/element-from-point.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/element-from-point.js +0 -135
- package/dist/agent/cua/pw-codegen/factory.d.ts +0 -15
- package/dist/agent/cua/pw-codegen/factory.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/factory.js +0 -59
- package/dist/agent/cua/pw-codegen/index.d.ts +0 -7
- package/dist/agent/cua/pw-codegen/index.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/index.js +0 -14
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.d.ts +0 -43
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-event-sink/index.js +0 -250
- package/dist/agent/cua/pw-codegen/pw-pause/for-recorder.d.ts +0 -14
- package/dist/agent/cua/pw-codegen/pw-pause/for-recorder.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/for-recorder.js +0 -88
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts +0 -17
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.js +0 -117
- package/dist/agent/cua/pw-codegen/pw-pause/ipc.d.ts +0 -3
- package/dist/agent/cua/pw-codegen/pw-pause/ipc.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/ipc.js +0 -13
- package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts +0 -24
- package/dist/agent/cua/pw-codegen/pw-pause/patch.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/patch.js +0 -197
- package/dist/agent/cua/pw-codegen/pw-pause/types.d.ts +0 -14
- package/dist/agent/cua/pw-codegen/pw-pause/types.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/types.js +0 -2
- package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts +0 -2
- package/dist/agent/cua/pw-codegen/pw-pause/utils.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/pw-pause/utils.js +0 -6
- package/dist/agent/cua/pw-codegen/types.d.ts +0 -47
- package/dist/agent/cua/pw-codegen/types.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/types.js +0 -2
- package/dist/agent/cua/pw-codegen/version.d.ts +0 -25
- package/dist/agent/cua/pw-codegen/version.d.ts.map +0 -1
- package/dist/agent/cua/pw-codegen/version.js +0 -86
- package/dist/agent/master/icon-descriptor/index.d.ts +0 -22
- package/dist/agent/master/icon-descriptor/index.d.ts.map +0 -1
- package/dist/agent/master/icon-descriptor/index.js +0 -249
- package/dist/agent/master/icon-descriptor/normalize-svg.d.ts +0 -2
- package/dist/agent/master/icon-descriptor/normalize-svg.d.ts.map +0 -1
- package/dist/agent/master/icon-descriptor/normalize-svg.js +0 -247
- package/dist/tools/issues-v1/create-issue.d.ts +0 -3
- package/dist/tools/issues-v1/create-issue.d.ts.map +0 -1
- package/dist/tools/issues-v1/create-issue.js +0 -72
- package/dist/tools/issues-v1/update-issue.d.ts +0 -3
- package/dist/tools/issues-v1/update-issue.d.ts.map +0 -1
- package/dist/tools/issues-v1/update-issue.js +0 -74
- package/dist/trace-utils/cli.d.ts +0 -3
- package/dist/trace-utils/cli.d.ts.map +0 -1
- package/dist/trace-utils/cli.js +0 -302
- package/dist/trace-utils/console.d.ts +0 -11
- package/dist/trace-utils/console.d.ts.map +0 -1
- package/dist/trace-utils/console.js +0 -74
- package/dist/trace-utils/dom-snapshot.d.ts +0 -19
- package/dist/trace-utils/dom-snapshot.d.ts.map +0 -1
- package/dist/trace-utils/dom-snapshot.js +0 -328
- package/dist/trace-utils/index.d.ts +0 -12
- package/dist/trace-utils/index.d.ts.map +0 -1
- package/dist/trace-utils/index.js +0 -28
- package/dist/trace-utils/network.d.ts +0 -16
- package/dist/trace-utils/network.d.ts.map +0 -1
- package/dist/trace-utils/network.js +0 -178
- package/dist/trace-utils/normalize-trace-url.d.ts +0 -2
- package/dist/trace-utils/normalize-trace-url.d.ts.map +0 -1
- package/dist/trace-utils/normalize-trace-url.js +0 -15
- package/dist/trace-utils/screenshots.d.ts +0 -24
- package/dist/trace-utils/screenshots.d.ts.map +0 -1
- package/dist/trace-utils/screenshots.js +0 -197
- package/dist/trace-utils/steps.d.ts +0 -10
- package/dist/trace-utils/steps.d.ts.map +0 -1
- package/dist/trace-utils/steps.js +0 -126
- package/dist/trace-utils/types.d.ts +0 -51
- package/dist/trace-utils/types.d.ts.map +0 -1
- package/dist/trace-utils/types.js +0 -2
- package/dist/utils/playwright-report-parser.d.ts +0 -2
- package/dist/utils/playwright-report-parser.d.ts.map +0 -1
- package/dist/utils/playwright-report-parser.js +0 -10
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseTimeToMs = parseTimeToMs;
|
|
7
|
-
exports.extractScreenshots = extractScreenshots;
|
|
8
|
-
exports.saveScreenshotsToDir = saveScreenshotsToDir;
|
|
9
|
-
const buffer_1 = require("buffer");
|
|
10
|
-
const fs_1 = require("fs");
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const extract_zip_1 = require("../tools/trace-dot-zip/utils/extract-zip");
|
|
13
|
-
const normalize_trace_url_1 = require("./normalize-trace-url");
|
|
14
|
-
const steps_1 = require("./steps");
|
|
15
|
-
function parseTimeToMs(timeStr) {
|
|
16
|
-
const match = timeStr.match(/^(\d{2}):(\d{2}):(\d{2})\.(\d{3})$/);
|
|
17
|
-
if (!match) {
|
|
18
|
-
throw new Error(`Invalid time format: ${timeStr}. Expected HH:MM:SS.mmm (e.g., 00:02:06.434)`);
|
|
19
|
-
}
|
|
20
|
-
const [, hours, minutes, seconds, ms] = match;
|
|
21
|
-
return (parseInt(hours, 10) * 3600000 +
|
|
22
|
-
parseInt(minutes, 10) * 60000 +
|
|
23
|
-
parseInt(seconds, 10) * 1000 +
|
|
24
|
-
parseInt(ms, 10));
|
|
25
|
-
}
|
|
26
|
-
function isStepArgs(args) {
|
|
27
|
-
return "step" in args;
|
|
28
|
-
}
|
|
29
|
-
async function findPageIdForStep(zipUrl, stepId) {
|
|
30
|
-
const allFiles = await (0, extract_zip_1.getFilenamesInZip)(zipUrl);
|
|
31
|
-
const traceFiles = allFiles.filter((f) => f.endsWith(".trace") && f !== "test.trace");
|
|
32
|
-
let pageId;
|
|
33
|
-
await (0, extract_zip_1.extractFileFromZipFromUrl)({
|
|
34
|
-
zipUrl,
|
|
35
|
-
fileNames: traceFiles,
|
|
36
|
-
chunkProcessor: () => {
|
|
37
|
-
let tempBuffer = "";
|
|
38
|
-
return (chunk) => {
|
|
39
|
-
if (pageId)
|
|
40
|
-
return; // Already found
|
|
41
|
-
tempBuffer += chunk;
|
|
42
|
-
const lines = tempBuffer.split("\n");
|
|
43
|
-
lines.slice(0, -1).forEach((line) => {
|
|
44
|
-
if (pageId)
|
|
45
|
-
return;
|
|
46
|
-
try {
|
|
47
|
-
const event = JSON.parse(line);
|
|
48
|
-
if (event.type === "before" &&
|
|
49
|
-
event.stepId === stepId &&
|
|
50
|
-
event.pageId) {
|
|
51
|
-
pageId = event.pageId;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
// skip malformed lines
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
tempBuffer = lines[lines.length - 1] || "";
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
return pageId;
|
|
63
|
-
}
|
|
64
|
-
async function extractScreenshots(args) {
|
|
65
|
-
const zipUrl = (0, normalize_trace_url_1.normalizeTraceZipUrl)(args.file);
|
|
66
|
-
const maxScreenshots = args.max ?? 10;
|
|
67
|
-
if (isStepArgs(args)) {
|
|
68
|
-
const beforeMs = args.beforeMs ?? 2000;
|
|
69
|
-
const afterMs = args.afterMs ?? 2000;
|
|
70
|
-
const { steps } = await (0, steps_1.listSteps)({ file: args.file });
|
|
71
|
-
const step = steps.find((s) => s.callId === args.step);
|
|
72
|
-
if (!step) {
|
|
73
|
-
return { label: args.step, step: undefined, screenshots: [] };
|
|
74
|
-
}
|
|
75
|
-
// Find the pageId for this step from the action trace files
|
|
76
|
-
const pageId = await findPageIdForStep(zipUrl, args.step);
|
|
77
|
-
if (pageId) {
|
|
78
|
-
step.pageId = pageId;
|
|
79
|
-
}
|
|
80
|
-
const startTime = step.startTime - beforeMs;
|
|
81
|
-
const endTime = (step.endTime ?? step.startTime) + afterMs;
|
|
82
|
-
const screenshots = await extractScreenshotsInRange({
|
|
83
|
-
zipUrl,
|
|
84
|
-
startTime,
|
|
85
|
-
endTime,
|
|
86
|
-
maxScreenshots,
|
|
87
|
-
pageId,
|
|
88
|
-
});
|
|
89
|
-
return { label: step.apiName, step, screenshots };
|
|
90
|
-
}
|
|
91
|
-
const startTime = parseTimeToMs(args.start);
|
|
92
|
-
const endTime = parseTimeToMs(args.end);
|
|
93
|
-
const screenshots = await extractScreenshotsInRange({
|
|
94
|
-
zipUrl,
|
|
95
|
-
startTime,
|
|
96
|
-
endTime,
|
|
97
|
-
maxScreenshots,
|
|
98
|
-
});
|
|
99
|
-
return { label: `${args.start} → ${args.end}`, screenshots };
|
|
100
|
-
}
|
|
101
|
-
async function extractScreenshotsInRange(opts) {
|
|
102
|
-
const { zipUrl, startTime, endTime, maxScreenshots, pageId } = opts;
|
|
103
|
-
const frames = await extractScreencastFrames(zipUrl);
|
|
104
|
-
const relevantFrames = frames.filter((f) => {
|
|
105
|
-
const inTimeRange = f.timestamp >= startTime && f.timestamp <= endTime;
|
|
106
|
-
const matchesPage = !pageId || f.pageId === pageId;
|
|
107
|
-
return inTimeRange && matchesPage;
|
|
108
|
-
});
|
|
109
|
-
let selectedFrames = relevantFrames;
|
|
110
|
-
if (relevantFrames.length > maxScreenshots) {
|
|
111
|
-
selectedFrames = sampleFrames(relevantFrames, maxScreenshots);
|
|
112
|
-
}
|
|
113
|
-
const screenshots = await extractScreenshotImages(zipUrl, selectedFrames.map((f) => f.sha1));
|
|
114
|
-
return selectedFrames.map((f) => ({
|
|
115
|
-
sha1: f.sha1,
|
|
116
|
-
timestamp: f.timestamp,
|
|
117
|
-
width: f.width,
|
|
118
|
-
height: f.height,
|
|
119
|
-
base64: screenshots.get(f.sha1) || "",
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
async function extractScreencastFrames(zipUrl) {
|
|
123
|
-
const frames = [];
|
|
124
|
-
// Discover all .trace files (excluding test.trace)
|
|
125
|
-
const allFiles = await (0, extract_zip_1.getFilenamesInZip)(zipUrl);
|
|
126
|
-
const traceFiles = allFiles.filter((f) => f.endsWith(".trace") && f !== "test.trace");
|
|
127
|
-
if (traceFiles.length === 0) {
|
|
128
|
-
return frames;
|
|
129
|
-
}
|
|
130
|
-
// Extract screencast frames from all trace files
|
|
131
|
-
await (0, extract_zip_1.extractFileFromZipFromUrl)({
|
|
132
|
-
zipUrl,
|
|
133
|
-
fileNames: traceFiles,
|
|
134
|
-
chunkProcessor: () => {
|
|
135
|
-
let tempBuffer = "";
|
|
136
|
-
return (chunk) => {
|
|
137
|
-
tempBuffer += chunk;
|
|
138
|
-
const lines = tempBuffer.split("\n");
|
|
139
|
-
lines.slice(0, -1).forEach((line) => {
|
|
140
|
-
try {
|
|
141
|
-
const event = JSON.parse(line);
|
|
142
|
-
if (event.type === "screencast-frame") {
|
|
143
|
-
frames.push(event);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
// skip malformed lines
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
tempBuffer = lines[lines.length - 1] || "";
|
|
151
|
-
};
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
return frames;
|
|
155
|
-
}
|
|
156
|
-
async function extractScreenshotImages(zipUrl, sha1s) {
|
|
157
|
-
const results = new Map();
|
|
158
|
-
const fileNames = sha1s.map((sha1) => `resources/${sha1}`);
|
|
159
|
-
await (0, extract_zip_1.extractFileFromZipFromUrl)({
|
|
160
|
-
zipUrl,
|
|
161
|
-
fileNames,
|
|
162
|
-
chunkProcessor: (_, currentFile) => {
|
|
163
|
-
const sha1 = currentFile.replace("resources/", "");
|
|
164
|
-
const chunks = [];
|
|
165
|
-
return (chunk) => {
|
|
166
|
-
chunks.push(chunk);
|
|
167
|
-
const combined = buffer_1.Buffer.concat(chunks);
|
|
168
|
-
results.set(sha1, combined.toString("base64"));
|
|
169
|
-
};
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
|
-
return results;
|
|
173
|
-
}
|
|
174
|
-
function sampleFrames(frames, count) {
|
|
175
|
-
if (frames.length <= count)
|
|
176
|
-
return frames;
|
|
177
|
-
const result = [];
|
|
178
|
-
const step = (frames.length - 1) / (count - 1);
|
|
179
|
-
for (let i = 0; i < count; i++) {
|
|
180
|
-
const idx = Math.round(i * step);
|
|
181
|
-
result.push(frames[idx]);
|
|
182
|
-
}
|
|
183
|
-
return result;
|
|
184
|
-
}
|
|
185
|
-
async function saveScreenshotsToDir(screenshots, outputDir, filePrefix) {
|
|
186
|
-
await fs_1.promises.mkdir(outputDir, { recursive: true });
|
|
187
|
-
const savedPaths = [];
|
|
188
|
-
for (let i = 0; i < screenshots.length; i++) {
|
|
189
|
-
const s = screenshots[i];
|
|
190
|
-
const ext = s.sha1.endsWith(".jpeg") || s.sha1.endsWith(".jpg") ? "jpg" : "png";
|
|
191
|
-
const filename = `${filePrefix.replace(/[@:]/g, "-")}_${i + 1}.${ext}`;
|
|
192
|
-
const filePath = path_1.default.join(outputDir, filename);
|
|
193
|
-
await fs_1.promises.writeFile(filePath, buffer_1.Buffer.from(s.base64, "base64"));
|
|
194
|
-
savedPaths.push(filePath);
|
|
195
|
-
}
|
|
196
|
-
return savedPaths;
|
|
197
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { TraceStep } from "./types";
|
|
2
|
-
export type ListStepsArgs = {
|
|
3
|
-
file: string;
|
|
4
|
-
};
|
|
5
|
-
export type ListStepsResult = {
|
|
6
|
-
steps: TraceStep[];
|
|
7
|
-
};
|
|
8
|
-
export declare function listSteps(args: ListStepsArgs): Promise<ListStepsResult>;
|
|
9
|
-
export declare function formatStepsForDisplay(steps: TraceStep[]): string[];
|
|
10
|
-
//# sourceMappingURL=steps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/trace-utils/steps.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAezC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB,CAAC;AAEF,wBAAsB,SAAS,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAkD7E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CA0ClE"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listSteps = listSteps;
|
|
4
|
-
exports.formatStepsForDisplay = formatStepsForDisplay;
|
|
5
|
-
const extract_zip_1 = require("../tools/trace-dot-zip/utils/extract-zip");
|
|
6
|
-
const normalize_trace_url_1 = require("./normalize-trace-url");
|
|
7
|
-
async function listSteps(args) {
|
|
8
|
-
const zipUrl = (0, normalize_trace_url_1.normalizeTraceZipUrl)(args.file);
|
|
9
|
-
const beforeEvents = new Map();
|
|
10
|
-
const afterEvents = new Map();
|
|
11
|
-
await (0, extract_zip_1.extractFileFromZipFromUrl)({
|
|
12
|
-
zipUrl,
|
|
13
|
-
fileNames: ["test.trace"],
|
|
14
|
-
chunkProcessor: () => {
|
|
15
|
-
let tempBuffer = "";
|
|
16
|
-
return (chunk) => {
|
|
17
|
-
tempBuffer += chunk;
|
|
18
|
-
const lines = tempBuffer.split("\n");
|
|
19
|
-
lines.slice(0, -1).forEach((line) => {
|
|
20
|
-
try {
|
|
21
|
-
const event = JSON.parse(line);
|
|
22
|
-
if (event.type === "before" && event.callId) {
|
|
23
|
-
beforeEvents.set(event.callId, event);
|
|
24
|
-
}
|
|
25
|
-
else if (event.type === "after" && event.callId) {
|
|
26
|
-
afterEvents.set(event.callId, event);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
// skip malformed lines
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
tempBuffer = lines[lines.length - 1] || "";
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
const steps = [];
|
|
38
|
-
for (const [callId, before] of beforeEvents) {
|
|
39
|
-
const after = afterEvents.get(callId);
|
|
40
|
-
const apiName = before.apiName || before.title;
|
|
41
|
-
if (apiName) {
|
|
42
|
-
const skipParams = apiName === "Fulfill request";
|
|
43
|
-
steps.push({
|
|
44
|
-
callId,
|
|
45
|
-
apiName,
|
|
46
|
-
params: skipParams ? {} : before.params,
|
|
47
|
-
startTime: before.startTime ?? 0,
|
|
48
|
-
endTime: after?.endTime,
|
|
49
|
-
parentId: before.parentId,
|
|
50
|
-
error: after?.error?.message,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
steps.sort((a, b) => a.startTime - b.startTime);
|
|
55
|
-
return { steps };
|
|
56
|
-
}
|
|
57
|
-
function formatStepsForDisplay(steps) {
|
|
58
|
-
const lines = [];
|
|
59
|
-
const parentMap = new Map();
|
|
60
|
-
for (const step of steps) {
|
|
61
|
-
const key = step.parentId || "root";
|
|
62
|
-
if (!parentMap.has(key))
|
|
63
|
-
parentMap.set(key, []);
|
|
64
|
-
parentMap.get(key).push(step);
|
|
65
|
-
}
|
|
66
|
-
function renderStep(step, depth) {
|
|
67
|
-
const indent = " ".repeat(depth);
|
|
68
|
-
const failed = step.error ? " [FAILED]" : "";
|
|
69
|
-
const timeRange = formatTimeRange(step.startTime, step.endTime);
|
|
70
|
-
const mainParam = getMainParam(step);
|
|
71
|
-
const paramSuffix = mainParam ? ` ${mainParam}` : "";
|
|
72
|
-
lines.push(`${indent}[${step.callId}] ${step.apiName}${paramSuffix}${failed}`);
|
|
73
|
-
lines.push(`${indent} ${timeRange}`);
|
|
74
|
-
if (step.params) {
|
|
75
|
-
const extraParams = formatExtraParams(step.params);
|
|
76
|
-
for (const param of extraParams) {
|
|
77
|
-
lines.push(`${indent} ${param}`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const children = parentMap.get(step.callId) || [];
|
|
81
|
-
for (const child of children) {
|
|
82
|
-
renderStep(child, depth + 1);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const rootSteps = parentMap.get("root") || [];
|
|
86
|
-
for (const step of rootSteps) {
|
|
87
|
-
renderStep(step, 0);
|
|
88
|
-
}
|
|
89
|
-
return lines;
|
|
90
|
-
}
|
|
91
|
-
function formatTimeRange(startTime, endTime) {
|
|
92
|
-
const start = new Date(startTime).toISOString().slice(11, 23);
|
|
93
|
-
if (endTime) {
|
|
94
|
-
const end = new Date(endTime).toISOString().slice(11, 23);
|
|
95
|
-
const duration = Math.round(endTime - startTime);
|
|
96
|
-
return `${start} → ${end} (${duration}ms)`;
|
|
97
|
-
}
|
|
98
|
-
return `${start}`;
|
|
99
|
-
}
|
|
100
|
-
function getMainParam(step) {
|
|
101
|
-
if (!step.params)
|
|
102
|
-
return undefined;
|
|
103
|
-
const p = step.params;
|
|
104
|
-
if (p.url)
|
|
105
|
-
return p.url;
|
|
106
|
-
if (p.selector)
|
|
107
|
-
return p.selector;
|
|
108
|
-
if (p.text)
|
|
109
|
-
return `"${p.text}"`;
|
|
110
|
-
if (p.value)
|
|
111
|
-
return `"${p.value}"`;
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
114
|
-
function formatExtraParams(params) {
|
|
115
|
-
const mainKeys = ["url", "selector", "text", "value"];
|
|
116
|
-
const lines = [];
|
|
117
|
-
for (const [key, value] of Object.entries(params)) {
|
|
118
|
-
if (mainKeys.includes(key))
|
|
119
|
-
continue;
|
|
120
|
-
if (value === undefined || value === null)
|
|
121
|
-
continue;
|
|
122
|
-
const formatted = typeof value === "string" ? value : JSON.stringify(value);
|
|
123
|
-
lines.push(`${key}: ${formatted}`);
|
|
124
|
-
}
|
|
125
|
-
return lines;
|
|
126
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export type TraceStep = {
|
|
2
|
-
callId: string;
|
|
3
|
-
apiName: string;
|
|
4
|
-
params?: Record<string, any>;
|
|
5
|
-
startTime: number;
|
|
6
|
-
endTime?: number;
|
|
7
|
-
parentId?: string;
|
|
8
|
-
error?: string;
|
|
9
|
-
pageId?: string;
|
|
10
|
-
};
|
|
11
|
-
export type ExtractedScreenshot = {
|
|
12
|
-
sha1: string;
|
|
13
|
-
timestamp: number;
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
base64: string;
|
|
17
|
-
};
|
|
18
|
-
export type NetworkEntry = {
|
|
19
|
-
url: string;
|
|
20
|
-
method: string;
|
|
21
|
-
status: number;
|
|
22
|
-
timestamp: string;
|
|
23
|
-
durationMs: number;
|
|
24
|
-
monotonicTime?: number;
|
|
25
|
-
pageId?: string;
|
|
26
|
-
requestBody?: string;
|
|
27
|
-
responseBody?: string;
|
|
28
|
-
};
|
|
29
|
-
export type ConsoleLevel = "error" | "warning" | "info" | "debug";
|
|
30
|
-
export type ConsoleEntry = {
|
|
31
|
-
level: ConsoleLevel;
|
|
32
|
-
text: string;
|
|
33
|
-
timestamp: number;
|
|
34
|
-
location?: {
|
|
35
|
-
url: string;
|
|
36
|
-
lineNumber: number;
|
|
37
|
-
columnNumber: number;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export type DomSnapshot = {
|
|
41
|
-
callId: string;
|
|
42
|
-
snapshotName?: string;
|
|
43
|
-
frameUrl: string;
|
|
44
|
-
timestamp: number;
|
|
45
|
-
viewport: {
|
|
46
|
-
width: number;
|
|
47
|
-
height: number;
|
|
48
|
-
};
|
|
49
|
-
html: string;
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/trace-utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAElE,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playwright-report-parser.d.ts","sourceRoot":"","sources":["../../src/utils/playwright-report-parser.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,yBAAyB,EACzB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parsePlaywrightTestReport = exports.findTestInReport = exports.findTestInPlaywrightSummary = exports.findMatchingTest = exports.fetchAndFindTestCase = void 0;
|
|
4
|
-
// Re-export from @empiricalrun/reporter for backward compatibility
|
|
5
|
-
var reporter_1 = require("@empiricalrun/reporter");
|
|
6
|
-
Object.defineProperty(exports, "fetchAndFindTestCase", { enumerable: true, get: function () { return reporter_1.fetchAndFindTestCase; } });
|
|
7
|
-
Object.defineProperty(exports, "findMatchingTest", { enumerable: true, get: function () { return reporter_1.findMatchingTest; } });
|
|
8
|
-
Object.defineProperty(exports, "findTestInPlaywrightSummary", { enumerable: true, get: function () { return reporter_1.findTestInPlaywrightSummary; } });
|
|
9
|
-
Object.defineProperty(exports, "findTestInReport", { enumerable: true, get: function () { return reporter_1.findTestInReport; } });
|
|
10
|
-
Object.defineProperty(exports, "parsePlaywrightTestReport", { enumerable: true, get: function () { return reporter_1.parsePlaywrightTestReport; } });
|