@andrii_kremlovskyi/playwright-traces-reader 2.4.0 → 2.5.1
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 +10 -7
- package/dist/cli/formatters.d.ts +2 -0
- package/dist/cli/formatters.d.ts.map +1 -1
- package/dist/cli/formatters.js +10 -1
- package/dist/cli/formatters.js.map +1 -1
- package/dist/cli/helpers.d.ts +2 -0
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/helpers.js +28 -1
- package/dist/cli/helpers.js.map +1 -1
- package/dist/cli/json.d.ts +9 -1
- package/dist/cli/json.d.ts.map +1 -1
- package/dist/cli/json.js +10 -0
- package/dist/cli/json.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +52 -0
- package/dist/cli.js.map +1 -1
- package/dist/docGenerator/actionTranslator.d.ts +15 -0
- package/dist/docGenerator/actionTranslator.d.ts.map +1 -0
- package/dist/docGenerator/actionTranslator.js +299 -0
- package/dist/docGenerator/actionTranslator.js.map +1 -0
- package/dist/docGenerator/copilotRenderer.d.ts +17 -0
- package/dist/docGenerator/copilotRenderer.d.ts.map +1 -0
- package/dist/docGenerator/copilotRenderer.js +247 -0
- package/dist/docGenerator/copilotRenderer.js.map +1 -0
- package/dist/docGenerator/featureLinker.d.ts +12 -0
- package/dist/docGenerator/featureLinker.d.ts.map +1 -0
- package/dist/docGenerator/featureLinker.js +117 -0
- package/dist/docGenerator/featureLinker.js.map +1 -0
- package/dist/docGenerator/index.d.ts +7 -0
- package/dist/docGenerator/index.d.ts.map +1 -0
- package/dist/docGenerator/index.js +19 -0
- package/dist/docGenerator/index.js.map +1 -0
- package/dist/docGenerator/markdownRenderer.d.ts +19 -0
- package/dist/docGenerator/markdownRenderer.d.ts.map +1 -0
- package/dist/docGenerator/markdownRenderer.js +214 -0
- package/dist/docGenerator/markdownRenderer.js.map +1 -0
- package/dist/docGenerator/types.d.ts +97 -0
- package/dist/docGenerator/types.d.ts.map +1 -0
- package/dist/docGenerator/types.js +3 -0
- package/dist/docGenerator/types.js.map +1 -0
- package/dist/docGenerator/vaultBuilder.d.ts +20 -0
- package/dist/docGenerator/vaultBuilder.d.ts.map +1 -0
- package/dist/docGenerator/vaultBuilder.js +437 -0
- package/dist/docGenerator/vaultBuilder.js.map +1 -0
- package/package.json +1 -1
- package/templates/skills/analyze-playwright-traces/SKILL.md +36 -6
|
@@ -0,0 +1,437 @@
|
|
|
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.generateVault = generateVault;
|
|
37
|
+
exports.cleanupVault = cleanupVault;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const parseTrace_1 = require("../parseTrace");
|
|
41
|
+
const extractors_1 = require("../extractors");
|
|
42
|
+
const actionTranslator_1 = require("./actionTranslator");
|
|
43
|
+
const markdownRenderer_1 = require("./markdownRenderer");
|
|
44
|
+
const featureLinker_1 = require("./featureLinker");
|
|
45
|
+
const copilotRenderer_1 = require("./copilotRenderer");
|
|
46
|
+
/**
|
|
47
|
+
* Orchestrates full vault generation from a Playwright HTML report.
|
|
48
|
+
*
|
|
49
|
+
* Flow: validate HTML report → parse report metadata → filter to passed + dedup retries
|
|
50
|
+
* → parse each trace → translate steps → render MD → write vault.
|
|
51
|
+
*/
|
|
52
|
+
async function generateVault(reportPath, options) {
|
|
53
|
+
// Validate HTML report structure.
|
|
54
|
+
const resolvedPath = path.resolve(reportPath);
|
|
55
|
+
const indexHtmlPath = path.join(resolvedPath, 'index.html');
|
|
56
|
+
const dataDir = path.join(resolvedPath, 'data');
|
|
57
|
+
if (!fs.existsSync(indexHtmlPath)) {
|
|
58
|
+
throw new Error(`Invalid HTML report: ${resolvedPath} does not contain index.html.`);
|
|
59
|
+
}
|
|
60
|
+
if (!fs.existsSync(dataDir)) {
|
|
61
|
+
throw new Error(`Invalid HTML report: ${resolvedPath} does not contain a data/ directory.`);
|
|
62
|
+
}
|
|
63
|
+
// Parse report metadata.
|
|
64
|
+
const meta = await (0, parseTrace_1.getReportMetadata)(resolvedPath);
|
|
65
|
+
if (!meta) {
|
|
66
|
+
throw new Error(`Could not parse report metadata from ${resolvedPath}.`);
|
|
67
|
+
}
|
|
68
|
+
// Load features mapping if provided.
|
|
69
|
+
const featureMappings = options.featuresMapPath
|
|
70
|
+
? await loadFeaturesMap(options.featuresMapPath)
|
|
71
|
+
: [];
|
|
72
|
+
// Collect passed tests with retry deduplication.
|
|
73
|
+
const passedTests = collectPassedTests(meta);
|
|
74
|
+
// Build output directories.
|
|
75
|
+
const outputDir = path.resolve(options.outputDir);
|
|
76
|
+
const testsDir = options.subPath
|
|
77
|
+
? path.join(outputDir, 'tests', options.subPath)
|
|
78
|
+
: path.join(outputDir, 'tests');
|
|
79
|
+
await fs.promises.mkdir(testsDir, { recursive: true });
|
|
80
|
+
// Start Copilot step renderer — required for doc generation.
|
|
81
|
+
const copilot = new copilotRenderer_1.CopilotStepRenderer();
|
|
82
|
+
const copilotReady = await copilot.start();
|
|
83
|
+
if (!copilotReady) {
|
|
84
|
+
const detail = copilot.startError ? `\n Error: ${copilot.startError}` : '';
|
|
85
|
+
throw new Error(`GitHub Copilot SDK failed to start.${detail}\n` +
|
|
86
|
+
' Ensure:\n' +
|
|
87
|
+
' 1. GitHub CLI is installed: brew install gh\n' +
|
|
88
|
+
' 2. You are authenticated: gh auth login\n' +
|
|
89
|
+
' 3. You have a Copilot license on your GitHub account');
|
|
90
|
+
}
|
|
91
|
+
// Generate test docs.
|
|
92
|
+
const entries = [];
|
|
93
|
+
const generatedFiles = [];
|
|
94
|
+
let totalSkipped = 0;
|
|
95
|
+
for (const file of meta.files) {
|
|
96
|
+
for (const test of file.tests) {
|
|
97
|
+
if (test.outcome !== 'expected') {
|
|
98
|
+
totalSkipped++;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const deduped = passedTests.get(test.testId);
|
|
102
|
+
if (!deduped)
|
|
103
|
+
continue;
|
|
104
|
+
// Only process the deduped entry once.
|
|
105
|
+
if (deduped.processed)
|
|
106
|
+
continue;
|
|
107
|
+
deduped.processed = true;
|
|
108
|
+
const traceSha1 = deduped.traceSha1;
|
|
109
|
+
if (!traceSha1)
|
|
110
|
+
continue;
|
|
111
|
+
const tracePath = resolveTracePath(dataDir, traceSha1);
|
|
112
|
+
if (!tracePath)
|
|
113
|
+
continue;
|
|
114
|
+
try {
|
|
115
|
+
const { entry, networkMap } = await buildDocEntry(test, tracePath, featureMappings);
|
|
116
|
+
entries.push(entry);
|
|
117
|
+
const preRenderedSteps = await copilot.renderSteps(entry.title, entry.steps, networkMap);
|
|
118
|
+
const fileName = `${(0, markdownRenderer_1.testDocFileName)(entry)}.md`;
|
|
119
|
+
const filePath = path.join(testsDir, fileName);
|
|
120
|
+
await fs.promises.writeFile(filePath, (0, markdownRenderer_1.renderTestDoc)(entry, preRenderedSteps ?? undefined), 'utf-8');
|
|
121
|
+
const relativePath = path.relative(outputDir, filePath);
|
|
122
|
+
generatedFiles.push(relativePath);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// Skip traces that can't be parsed — don't fail the entire command.
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Stop Copilot renderer.
|
|
131
|
+
await copilot.stop();
|
|
132
|
+
// Write index.
|
|
133
|
+
const generatedAt = new Date().toISOString();
|
|
134
|
+
const indexPath = path.join(outputDir, '_index.md');
|
|
135
|
+
await fs.promises.writeFile(indexPath, (0, markdownRenderer_1.renderIndexDoc)(entries, generatedAt), 'utf-8');
|
|
136
|
+
// Create feature stubs if features-map provided.
|
|
137
|
+
if (featureMappings.length > 0) {
|
|
138
|
+
const featuresDir = path.join(outputDir, 'features');
|
|
139
|
+
await (0, featureLinker_1.createFeatureStubs)(featuresDir, entries);
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
totalGenerated: entries.length,
|
|
143
|
+
totalSkipped,
|
|
144
|
+
generatedFiles,
|
|
145
|
+
outputDir,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Compares vault contents to a report and identifies stale/missing docs.
|
|
150
|
+
*/
|
|
151
|
+
async function cleanupVault(reportPath, options) {
|
|
152
|
+
const resolvedPath = path.resolve(reportPath);
|
|
153
|
+
const meta = await (0, parseTrace_1.getReportMetadata)(resolvedPath);
|
|
154
|
+
if (!meta) {
|
|
155
|
+
throw new Error(`Could not parse report metadata from ${resolvedPath}.`);
|
|
156
|
+
}
|
|
157
|
+
const outputDir = path.resolve(options.outputDir);
|
|
158
|
+
const testsDir = options.subPath
|
|
159
|
+
? path.join(outputDir, 'tests', options.subPath)
|
|
160
|
+
: path.join(outputDir, 'tests');
|
|
161
|
+
// Build expected file set from report (passed tests only).
|
|
162
|
+
const passedTests = collectPassedTests(meta);
|
|
163
|
+
const expectedFiles = new Set();
|
|
164
|
+
for (const file of meta.files) {
|
|
165
|
+
for (const test of file.tests) {
|
|
166
|
+
if (test.outcome !== 'expected')
|
|
167
|
+
continue;
|
|
168
|
+
const deduped = passedTests.get(test.testId);
|
|
169
|
+
if (!deduped || deduped.processed)
|
|
170
|
+
continue;
|
|
171
|
+
deduped.processed = true;
|
|
172
|
+
const entry = buildMinimalDocEntry(test);
|
|
173
|
+
expectedFiles.add(`${(0, markdownRenderer_1.testDocFileName)(entry)}.md`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Scan vault for existing generated files.
|
|
177
|
+
const existingFiles = new Map(); // fileName → fullPath
|
|
178
|
+
if (fs.existsSync(testsDir)) {
|
|
179
|
+
const files = await fs.promises.readdir(testsDir);
|
|
180
|
+
for (const fileName of files) {
|
|
181
|
+
if (!fileName.endsWith('.md'))
|
|
182
|
+
continue;
|
|
183
|
+
const fullPath = path.join(testsDir, fileName);
|
|
184
|
+
const content = await fs.promises.readFile(fullPath, 'utf-8');
|
|
185
|
+
// Only consider files with `generated: true` in frontmatter.
|
|
186
|
+
if (isGeneratedFile(content)) {
|
|
187
|
+
existingFiles.set(fileName, fullPath);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Compare.
|
|
192
|
+
const staleFiles = [];
|
|
193
|
+
const missingFiles = [];
|
|
194
|
+
let matchedCount = 0;
|
|
195
|
+
for (const [fileName, fullPath] of existingFiles) {
|
|
196
|
+
if (expectedFiles.has(fileName)) {
|
|
197
|
+
matchedCount++;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
staleFiles.push(path.relative(outputDir, fullPath));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
for (const expectedFile of expectedFiles) {
|
|
204
|
+
if (!existingFiles.has(expectedFile)) {
|
|
205
|
+
missingFiles.push(expectedFile);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Delete stale files if requested.
|
|
209
|
+
let deleted = false;
|
|
210
|
+
if (options.deleteStale && staleFiles.length > 0) {
|
|
211
|
+
for (const staleFile of staleFiles) {
|
|
212
|
+
const fullPath = path.join(outputDir, staleFile);
|
|
213
|
+
await fs.promises.unlink(fullPath);
|
|
214
|
+
}
|
|
215
|
+
deleted = true;
|
|
216
|
+
}
|
|
217
|
+
return { staleFiles, missingFiles, matchedCount, deleted };
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Collects passed tests from report metadata with retry deduplication.
|
|
221
|
+
* Only the last result's trace is used for each unique testId.
|
|
222
|
+
*/
|
|
223
|
+
function collectPassedTests(meta) {
|
|
224
|
+
const map = new Map();
|
|
225
|
+
for (const file of meta.files) {
|
|
226
|
+
for (const test of file.tests) {
|
|
227
|
+
if (test.outcome !== 'expected')
|
|
228
|
+
continue;
|
|
229
|
+
// Get the last result's trace SHA1 (retry deduplication).
|
|
230
|
+
const lastResult = test.results[test.results.length - 1];
|
|
231
|
+
const traceAttachment = lastResult?.attachments.find(a => a.name === 'trace' && a.path);
|
|
232
|
+
const traceSha1 = traceAttachment?.path
|
|
233
|
+
? path.basename(traceAttachment.path, '.zip')
|
|
234
|
+
: null;
|
|
235
|
+
// If duplicate testId, keep the later occurrence (unlikely for passed tests, but safe).
|
|
236
|
+
map.set(test.testId, { test, traceSha1, processed: false });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return map;
|
|
240
|
+
}
|
|
241
|
+
function resolveTracePath(dataDir, traceSha1) {
|
|
242
|
+
const dirPath = path.join(dataDir, traceSha1);
|
|
243
|
+
if (fs.existsSync(dirPath))
|
|
244
|
+
return dirPath;
|
|
245
|
+
const zipPath = `${dirPath}.zip`;
|
|
246
|
+
if (fs.existsSync(zipPath))
|
|
247
|
+
return zipPath;
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
async function buildDocEntry(test, tracePath, featureMappings) {
|
|
251
|
+
const traceContext = await (0, parseTrace_1.prepareTraceDir)(tracePath);
|
|
252
|
+
const [rawSteps, networkEntries] = await Promise.all([
|
|
253
|
+
(0, extractors_1.getTestSteps)(traceContext),
|
|
254
|
+
(0, extractors_1.getNetworkTraffic)(traceContext, { source: 'api' }),
|
|
255
|
+
]);
|
|
256
|
+
// Filter out infrastructure steps (hooks, fixtures, attachments).
|
|
257
|
+
const INFRA_TITLES = new Set([
|
|
258
|
+
'Before Hooks', 'After Hooks',
|
|
259
|
+
'Worker Cleanup', 'Worker Cleanup Hooks', 'Worker Setup',
|
|
260
|
+
]);
|
|
261
|
+
const steps = rawSteps.filter(s => !INFRA_TITLES.has(s.title) &&
|
|
262
|
+
!s.title.startsWith('Attach "') &&
|
|
263
|
+
!s.title.startsWith('Fixture "') &&
|
|
264
|
+
!s.title.startsWith('beforeEach hook') &&
|
|
265
|
+
!s.title.startsWith('afterEach hook'));
|
|
266
|
+
const translatedSteps = (0, actionTranslator_1.translateSteps)(steps);
|
|
267
|
+
const networkMap = buildStepNetworkMap(rawSteps, networkEntries);
|
|
268
|
+
const apiCalls = networkEntries.map(entry => ({
|
|
269
|
+
method: entry.method,
|
|
270
|
+
url: entry.url,
|
|
271
|
+
status: entry.status,
|
|
272
|
+
statusText: entry.statusText,
|
|
273
|
+
durationMs: entry.durationMs,
|
|
274
|
+
}));
|
|
275
|
+
const fullTitle = [...test.path, test.title].join(' › ');
|
|
276
|
+
const features = (0, featureLinker_1.resolveFeatures)(fullTitle, test.location.file, featureMappings);
|
|
277
|
+
return {
|
|
278
|
+
entry: {
|
|
279
|
+
title: test.title,
|
|
280
|
+
fullTitle,
|
|
281
|
+
testId: test.testId,
|
|
282
|
+
project: test.projectName,
|
|
283
|
+
tags: test.tags,
|
|
284
|
+
sourceFile: test.location.file,
|
|
285
|
+
sourceLine: test.location.line,
|
|
286
|
+
tracePath,
|
|
287
|
+
steps: translatedSteps,
|
|
288
|
+
apiCalls,
|
|
289
|
+
features,
|
|
290
|
+
},
|
|
291
|
+
networkMap,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Builds a Map from test.step callId → the API calls made within that step.
|
|
296
|
+
* Uses timestamp containment to correlate network calls to steps — this is reliable
|
|
297
|
+
* for both browser and pure-API tests (the relatedAction link is not used).
|
|
298
|
+
* Deduplicates retry/polling calls (same method + URL), keeping only the first occurrence's bodies.
|
|
299
|
+
*/
|
|
300
|
+
function buildStepNetworkMap(rawSteps, networkEntries) {
|
|
301
|
+
const spans = [];
|
|
302
|
+
function collectSpans(step) {
|
|
303
|
+
if ((step.method === 'test.step' || step.method === 'step') && step.startTime != null && step.endTime != null) {
|
|
304
|
+
spans.push({ callId: step.callId, startTime: step.startTime, endTime: step.endTime });
|
|
305
|
+
}
|
|
306
|
+
for (const child of step.children)
|
|
307
|
+
collectSpans(child);
|
|
308
|
+
}
|
|
309
|
+
for (const step of rawSteps)
|
|
310
|
+
collectSpans(step);
|
|
311
|
+
// Sort widest-first so each network call maps to its outermost (user-defined) test.step,
|
|
312
|
+
// not to a deeply nested framework wrapper (e.g. "Sending [post] request").
|
|
313
|
+
spans.sort((a, b) => (b.endTime - b.startTime) - (a.endTime - a.startTime));
|
|
314
|
+
// Assign each network entry to the narrowest test.step that contains its monotonic start time.
|
|
315
|
+
// monotonicTime is in the same scale as TestStep.startTime/endTime.
|
|
316
|
+
const grouped = new Map();
|
|
317
|
+
for (const entry of networkEntries) {
|
|
318
|
+
const entryTs = entry.monotonicTime;
|
|
319
|
+
if (entryTs == null)
|
|
320
|
+
continue;
|
|
321
|
+
const match = spans.find(s => entryTs >= s.startTime && entryTs <= s.endTime);
|
|
322
|
+
if (!match)
|
|
323
|
+
continue;
|
|
324
|
+
if (!grouped.has(match.callId))
|
|
325
|
+
grouped.set(match.callId, new Map());
|
|
326
|
+
const stepGroup = grouped.get(match.callId);
|
|
327
|
+
const key = `${entry.method}|${entry.url}`;
|
|
328
|
+
const existing = stepGroup.get(key);
|
|
329
|
+
if (existing) {
|
|
330
|
+
existing.count++;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
stepGroup.set(key, {
|
|
334
|
+
call: {
|
|
335
|
+
method: entry.method,
|
|
336
|
+
url: entry.url,
|
|
337
|
+
status: entry.status,
|
|
338
|
+
requestBody: entry.requestBody,
|
|
339
|
+
responseBody: entry.responseBody,
|
|
340
|
+
},
|
|
341
|
+
count: 1,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const result = new Map();
|
|
346
|
+
for (const [stepCallId, callMap] of grouped) {
|
|
347
|
+
const calls = [];
|
|
348
|
+
for (const { call, count } of callMap.values()) {
|
|
349
|
+
calls.push(count > 1 ? { ...call, retries: count - 1 } : call);
|
|
350
|
+
}
|
|
351
|
+
result.set(stepCallId, calls);
|
|
352
|
+
}
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Builds a minimal entry for file name generation only (used by cleanup).
|
|
357
|
+
*/
|
|
358
|
+
function buildMinimalDocEntry(test) {
|
|
359
|
+
return {
|
|
360
|
+
title: test.title,
|
|
361
|
+
sourceFile: test.location.file,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function isGeneratedFile(content) {
|
|
365
|
+
// Check for `generated: true` in the YAML frontmatter.
|
|
366
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
367
|
+
if (!frontmatterMatch)
|
|
368
|
+
return false;
|
|
369
|
+
return /^generated:\s*true$/m.test(frontmatterMatch[1]);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Loads a features.yml file — simple YAML parsing without external deps.
|
|
373
|
+
* Expected format: array of { pattern: string, feature: string }.
|
|
374
|
+
*/
|
|
375
|
+
async function loadFeaturesMap(filePath) {
|
|
376
|
+
const resolved = path.resolve(filePath);
|
|
377
|
+
if (!fs.existsSync(resolved)) {
|
|
378
|
+
throw new Error(`Features map not found: ${resolved}`);
|
|
379
|
+
}
|
|
380
|
+
const content = await fs.promises.readFile(resolved, 'utf-8');
|
|
381
|
+
return parseSimpleYamlArray(content);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Minimal YAML array parser for features.yml.
|
|
385
|
+
* Supports:
|
|
386
|
+
* ```yaml
|
|
387
|
+
* - pattern: "auth"
|
|
388
|
+
* feature: "Authentication"
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
function parseSimpleYamlArray(content) {
|
|
392
|
+
const mappings = [];
|
|
393
|
+
const lines = content.split('\n');
|
|
394
|
+
let current = {};
|
|
395
|
+
for (const line of lines) {
|
|
396
|
+
const trimmed = line.trim();
|
|
397
|
+
if (!trimmed || trimmed.startsWith('#'))
|
|
398
|
+
continue;
|
|
399
|
+
if (trimmed.startsWith('- ')) {
|
|
400
|
+
// Start of a new item — save previous if complete.
|
|
401
|
+
if (current.pattern && current.feature) {
|
|
402
|
+
mappings.push({ pattern: current.pattern, feature: current.feature });
|
|
403
|
+
}
|
|
404
|
+
current = {};
|
|
405
|
+
// This line may contain the first key.
|
|
406
|
+
const rest = trimmed.slice(2);
|
|
407
|
+
const kv = parseYamlKeyValue(rest);
|
|
408
|
+
if (kv) {
|
|
409
|
+
current[kv.key] = kv.value;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
const kv = parseYamlKeyValue(trimmed);
|
|
414
|
+
if (kv) {
|
|
415
|
+
current[kv.key] = kv.value;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
// Save last entry.
|
|
420
|
+
if (current.pattern && current.feature) {
|
|
421
|
+
mappings.push({ pattern: current.pattern, feature: current.feature });
|
|
422
|
+
}
|
|
423
|
+
return mappings;
|
|
424
|
+
}
|
|
425
|
+
function parseYamlKeyValue(line) {
|
|
426
|
+
const match = line.match(/^(\w+):\s*(.+)$/);
|
|
427
|
+
if (!match)
|
|
428
|
+
return null;
|
|
429
|
+
const key = match[1];
|
|
430
|
+
let value = match[2].trim();
|
|
431
|
+
// Strip surrounding quotes.
|
|
432
|
+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
433
|
+
value = value.slice(1, -1);
|
|
434
|
+
}
|
|
435
|
+
return { key, value };
|
|
436
|
+
}
|
|
437
|
+
//# sourceMappingURL=vaultBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vaultBuilder.js","sourceRoot":"","sources":["../../src/docGenerator/vaultBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,sCA+GC;AAKD,oCA4EC;AArND,uCAAyB;AACzB,2CAA6B;AAC7B,8CAKuB;AACvB,8CAAkG;AAClG,yDAAoD;AACpD,yDAAoF;AACpF,mDAAsE;AACtE,uDAAwD;AAGxD;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAAC,UAAkB,EAAE,OAA4B;IAClF,kCAAkC;IAClC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,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SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;IACtB,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;IAC7B,4BAA4B;IAC5B,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACrG,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -113,6 +113,42 @@ npx playwright-traces-reader failures <reportRootPath>
|
|
|
113
113
|
npx playwright-traces-reader summary <tracePath>
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
### Vault analysis files
|
|
117
|
+
|
|
118
|
+
Reports may have an associated markdown analysis file stored in the dashboard vault. When `search-reports` or `prepare-report` returns a report descriptor, the `analysisFile` field indicates whether a vault `.md` file exists for that report. If `analysisFile` is `null`, no analysis file is available.
|
|
119
|
+
|
|
120
|
+
Use `vault-read` to retrieve the content of an analysis file by name:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npx playwright-traces-reader vault-read <analysisFile>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- `--base-url <url>` points to the local `playwright-reports` hub. Default: `http://127.0.0.1:9333`.
|
|
127
|
+
- `-f, --format <format>` controls output format: `json` or `text` (default: `text`).
|
|
128
|
+
- `-o, --out <path>` writes content to a file instead of stdout. Use this when the analysis file may be large or when you need to read it with `read_file` afterwards.
|
|
129
|
+
|
|
130
|
+
Text format outputs the raw markdown content directly. JSON format wraps it in an envelope:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{ "schemaVersion": 1, "command": "vault-read", "filename": "...", "content": "...", "savedPath": null }
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Typical flow: discover a report, then read its analysis file if one exists.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npx playwright-traces-reader search-reports "UAT EU" --latest --limit 1
|
|
140
|
+
# → check analysisFile field in the response
|
|
141
|
+
npx playwright-traces-reader vault-read <analysisFile>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For large analysis files, save to a workspace file first, then read with `read_file`:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npx playwright-traces-reader vault-read <analysisFile> --out ./tmp/analysis.md
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The agent cannot access vault files directly with `read_file` because they are stored outside the workspace. Always use `vault-read` through the terminal to retrieve vault content, or use `--out` to save it into the workspace first.
|
|
151
|
+
|
|
116
152
|
### Report-level analysis
|
|
117
153
|
|
|
118
154
|
Use `failures` when the user wants all unique failing tests in a report.
|
|
@@ -340,7 +376,6 @@ npx playwright-traces-reader init-skills
|
|
|
340
376
|
## Output Guidance
|
|
341
377
|
|
|
342
378
|
- All CLI JSON outputs use versioned envelopes.
|
|
343
|
-
- See `CLI_JSON_CONTRACTS.md` in the package for payload structure.
|
|
344
379
|
- For screenshots, the JSON output contains file metadata, not image understanding.
|
|
345
380
|
|
|
346
381
|
## Example Prompts This Skill Covers
|
|
@@ -352,8 +387,3 @@ npx playwright-traces-reader init-skills
|
|
|
352
387
|
- Use the reports hub at `http://127.0.0.1:9333` to find the most recent smoke run.
|
|
353
388
|
- Find the trace for my passed "login" test and show me its summary.
|
|
354
389
|
- Show me traces for all flaky tests matching "checkout".
|
|
355
|
-
|
|
356
|
-
## More Documentation
|
|
357
|
-
|
|
358
|
-
- Use the CLI reference for detailed command docs: `CLI_REFERENCE.md`
|
|
359
|
-
- Use the library integration guide only for in-process integrations such as `playwright-reports`: `LIBRARY_INTEGRATION.md`
|