@midscene/core 1.17.3-beta-20261029072240.0 → 1.17.3
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/dist/es/agent/task-builder.mjs +1 -2
- package/dist/es/agent/task-builder.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/dump/execution-recorder.mjs +70 -0
- package/dist/es/dump/execution-recorder.mjs.map +1 -0
- package/dist/es/dump/html-utils.mjs +51 -1
- package/dist/es/dump/html-utils.mjs.map +1 -1
- package/dist/es/dump/report-artifact-reader.mjs +85 -0
- package/dist/es/dump/report-artifact-reader.mjs.map +1 -0
- package/dist/es/dump/report-artifact-store.mjs +164 -0
- package/dist/es/dump/report-artifact-store.mjs.map +1 -0
- package/dist/es/dump/screenshot-store.mjs +40 -15
- package/dist/es/dump/screenshot-store.mjs.map +1 -1
- package/dist/es/dump/test-report-images.mjs +120 -0
- package/dist/es/dump/test-report-images.mjs.map +1 -0
- package/dist/es/report-cli.mjs +8 -7
- package/dist/es/report-cli.mjs.map +1 -1
- package/dist/es/report-generator.mjs +56 -47
- package/dist/es/report-generator.mjs.map +1 -1
- package/dist/es/report-html-template.mjs +1 -1
- package/dist/es/report.mjs +29 -55
- package/dist/es/report.mjs.map +1 -1
- package/dist/es/test-run-report.mjs.map +1 -1
- package/dist/es/utils.mjs +1 -1
- package/dist/lib/agent/task-builder.js +1 -2
- package/dist/lib/agent/task-builder.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/dump/execution-recorder.js +104 -0
- package/dist/lib/dump/execution-recorder.js.map +1 -0
- package/dist/lib/dump/html-utils.js +67 -5
- package/dist/lib/dump/html-utils.js.map +1 -1
- package/dist/lib/dump/report-artifact-reader.js +134 -0
- package/dist/lib/dump/report-artifact-reader.js.map +1 -0
- package/dist/lib/dump/report-artifact-store.js +204 -0
- package/dist/lib/dump/report-artifact-store.js.map +1 -0
- package/dist/lib/dump/screenshot-store.js +42 -14
- package/dist/lib/dump/screenshot-store.js.map +1 -1
- package/dist/lib/dump/test-report-images.js +154 -0
- package/dist/lib/dump/test-report-images.js.map +1 -0
- package/dist/lib/report-cli.js +8 -7
- package/dist/lib/report-cli.js.map +1 -1
- package/dist/lib/report-generator.js +54 -45
- package/dist/lib/report-generator.js.map +1 -1
- package/dist/lib/report-html-template.js +1 -1
- package/dist/lib/report.js +54 -56
- package/dist/lib/report.js.map +1 -1
- package/dist/lib/test-run-report.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/types/agent/task-builder.d.ts.map +1 -1
- package/dist/types/dump/execution-recorder.d.ts +23 -0
- package/dist/types/dump/execution-recorder.d.ts.map +1 -0
- package/dist/types/dump/html-utils.d.ts +9 -0
- package/dist/types/dump/html-utils.d.ts.map +1 -1
- package/dist/types/dump/report-artifact-reader.d.ts +19 -0
- package/dist/types/dump/report-artifact-reader.d.ts.map +1 -0
- package/dist/types/dump/report-artifact-store.d.ts +22 -0
- package/dist/types/dump/report-artifact-store.d.ts.map +1 -0
- package/dist/types/dump/screenshot-store.d.ts +6 -0
- package/dist/types/dump/screenshot-store.d.ts.map +1 -1
- package/dist/types/dump/test-report-images.d.ts +14 -0
- package/dist/types/dump/test-report-images.d.ts.map +1 -0
- package/dist/types/report-cli.d.ts.map +1 -1
- package/dist/types/report-generator.d.ts +4 -3
- package/dist/types/report-generator.d.ts.map +1 -1
- package/dist/types/report.d.ts +3 -0
- package/dist/types/report.d.ts.map +1 -1
- package/dist/types/test-run-report.d.ts +2 -0
- package/dist/types/test-run-report.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/lib/report.js
CHANGED
|
@@ -24,15 +24,23 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
readReportArtifactManifestAsync: ()=>report_artifact_reader_js_namespaceObject.readReportArtifactManifestAsync,
|
|
28
|
+
readReportDumpScripts: ()=>report_artifact_reader_js_namespaceObject.readReportDumpScripts,
|
|
27
29
|
ReportMergingTool: ()=>ReportMergingTool,
|
|
28
|
-
removeReportArtifact: ()=>removeReportArtifact,
|
|
29
|
-
collectDedupedExecutions: ()=>collectDedupedExecutions,
|
|
30
30
|
TestRunReportAssembler: ()=>TestRunReportAssembler,
|
|
31
|
+
collectDedupedExecutions: ()=>collectDedupedExecutions,
|
|
31
32
|
splitReportHtmlByExecution: ()=>splitReportHtmlByExecution,
|
|
33
|
+
streamReportDumpScripts: ()=>report_artifact_reader_js_namespaceObject.streamReportDumpScripts,
|
|
32
34
|
isDirectoryModeReport: ()=>isDirectoryModeReport,
|
|
33
35
|
dedupeExecutionsKeepLatest: ()=>dedupeExecutionsKeepLatest,
|
|
34
36
|
calculateTestRunHealth: ()=>external_test_run_health_js_namespaceObject.calculateTestRunHealth,
|
|
35
|
-
|
|
37
|
+
readReportActionDump: ()=>report_artifact_reader_js_namespaceObject.readReportActionDump,
|
|
38
|
+
removeReportArtifact: ()=>removeReportArtifact,
|
|
39
|
+
readReportRunnerDump: ()=>report_artifact_reader_js_namespaceObject.readReportRunnerDump,
|
|
40
|
+
ReportArtifactStore: ()=>report_artifact_store_js_namespaceObject.ReportArtifactStore,
|
|
41
|
+
classifyTestRunCase: ()=>external_test_run_health_js_namespaceObject.classifyTestRunCase,
|
|
42
|
+
readReportArtifactManifest: ()=>report_artifact_reader_js_namespaceObject.readReportArtifactManifest,
|
|
43
|
+
ExecutionRecorder: ()=>execution_recorder_js_namespaceObject.ExecutionRecorder
|
|
36
44
|
});
|
|
37
45
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
38
46
|
const promises_namespaceObject = require("node:fs/promises");
|
|
@@ -42,7 +50,11 @@ const utils_namespaceObject = require("@midscene/shared/utils");
|
|
|
42
50
|
const report_file_name_js_namespaceObject = require("./agent/report-file-name.js");
|
|
43
51
|
const html_utils_js_namespaceObject = require("./dump/html-utils.js");
|
|
44
52
|
const image_reference_js_namespaceObject = require("./dump/image-reference.js");
|
|
53
|
+
const report_artifact_reader_js_namespaceObject = require("./dump/report-artifact-reader.js");
|
|
45
54
|
const screenshot_store_js_namespaceObject = require("./dump/screenshot-store.js");
|
|
55
|
+
const execution_recorder_js_namespaceObject = require("./dump/execution-recorder.js");
|
|
56
|
+
const report_artifact_store_js_namespaceObject = require("./dump/report-artifact-store.js");
|
|
57
|
+
const test_report_images_js_namespaceObject = require("./dump/test-report-images.js");
|
|
46
58
|
const external_report_stats_js_namespaceObject = require("./report-stats.js");
|
|
47
59
|
const merge_report_js_namespaceObject = require("./test-runner/reporting/merge-report.js");
|
|
48
60
|
const metrics_js_namespaceObject = require("./test-runner/reporting/metrics.js");
|
|
@@ -73,6 +85,7 @@ function readDeclaredScreenshotMode(reportFilePath) {
|
|
|
73
85
|
return mode;
|
|
74
86
|
}
|
|
75
87
|
function isDirectoryModeReport(reportFilePath) {
|
|
88
|
+
if ((0, report_artifact_reader_js_namespaceObject.readReportArtifactManifest)(reportFilePath)) return true;
|
|
76
89
|
if ('index.html' !== external_node_path_namespaceObject.basename(reportFilePath)) return false;
|
|
77
90
|
const declared = readDeclaredScreenshotMode(reportFilePath);
|
|
78
91
|
if (declared) return 'directory' === declared;
|
|
@@ -99,7 +112,12 @@ function dedupeExecutionsKeepLatest(executions) {
|
|
|
99
112
|
}
|
|
100
113
|
function peekReportSdkVersion(reportFilePath) {
|
|
101
114
|
try {
|
|
102
|
-
|
|
115
|
+
let dump;
|
|
116
|
+
(0, report_artifact_reader_js_namespaceObject.streamReportDumpScripts)(reportFilePath, ({ content })=>{
|
|
117
|
+
dump = content;
|
|
118
|
+
return true;
|
|
119
|
+
});
|
|
120
|
+
dump ??= (0, html_utils_js_namespaceObject.extractLastDumpScriptSync)(reportFilePath) ?? void 0;
|
|
103
121
|
if (!dump) return;
|
|
104
122
|
const match = dump.match(/"sdkVersion"\s*:\s*"([^"]+)"/);
|
|
105
123
|
return match?.[1];
|
|
@@ -177,7 +195,7 @@ class ReportMergingTool {
|
|
|
177
195
|
(0, utils_namespaceObject.logMsg)('No reports to merge');
|
|
178
196
|
return null;
|
|
179
197
|
}
|
|
180
|
-
const runnerDumps = this.reportInfos.map((info)=>info.reportFilePath ? (0,
|
|
198
|
+
const runnerDumps = this.reportInfos.map((info)=>info.reportFilePath ? (0, report_artifact_reader_js_namespaceObject.readReportRunnerDump)(info.reportFilePath) : void 0);
|
|
181
199
|
const hasRunnerDump = runnerDumps.some(Boolean);
|
|
182
200
|
const targetDir = outputDir ? external_node_path_namespaceObject.resolve(outputDir) : (0, common_namespaceObject.getMidsceneRunSubDir)('report');
|
|
183
201
|
if (outputDir) (0, external_node_fs_namespaceObject.mkdirSync)(targetDir, {
|
|
@@ -231,7 +249,7 @@ class ReportMergingTool {
|
|
|
231
249
|
}
|
|
232
250
|
}
|
|
233
251
|
} else (0, html_utils_js_namespaceObject.streamImageScriptsToFile)(reportInfo.reportFilePath, outputFilePath, writtenInlineImageIds);
|
|
234
|
-
const allDumps = (0,
|
|
252
|
+
const allDumps = (0, report_artifact_reader_js_namespaceObject.readReportDumpScripts)(reportInfo.reportFilePath).filter((d)=>d.openTag.includes('data-group-id'));
|
|
235
253
|
const groupIdMatch = allDumps[0]?.openTag.match(/data-group-id="([^"]+)"/);
|
|
236
254
|
if (groupIdMatch && !hasRunnerDump) mergedGroupId = decodeURIComponent(groupIdMatch[1]);
|
|
237
255
|
const extractedDumpString = allDumps.length > 0 ? this.mergeDumpScripts(allDumps.map((d)=>d.content)) : (0, html_utils_js_namespaceObject.extractLastDumpScriptSync)(reportInfo.reportFilePath);
|
|
@@ -438,7 +456,6 @@ const prepareTestRunReportSources = (sources, loadedDumps)=>{
|
|
|
438
456
|
executionIds,
|
|
439
457
|
collection: source.collection,
|
|
440
458
|
dump,
|
|
441
|
-
directoryMode: !!source.dumpPath || isDirectoryModeReport(source.sourcePath),
|
|
442
459
|
...source.dumpPath ? {
|
|
443
460
|
dumpPath: source.dumpPath
|
|
444
461
|
} : {}
|
|
@@ -506,7 +523,7 @@ class TestRunReportAssembler {
|
|
|
506
523
|
diagnostics: prepared.diagnostics
|
|
507
524
|
});
|
|
508
525
|
if ('test-runner' !== dump.kind || 1 !== dump.schemaVersion) throw new Error('Invalid Runner report dump');
|
|
509
|
-
const directoryMode =
|
|
526
|
+
const directoryMode = 'html-and-external-assets' === options.outputFormat;
|
|
510
527
|
const outputDir = external_node_path_namespaceObject.resolve(options.outputDir);
|
|
511
528
|
await promises_namespaceObject.mkdir(outputDir, {
|
|
512
529
|
recursive: true
|
|
@@ -517,43 +534,17 @@ class TestRunReportAssembler {
|
|
|
517
534
|
const temporary = await promises_namespaceObject.mkdtemp(external_node_path_namespaceObject.join(outputDir, '.test-run-report-'));
|
|
518
535
|
const htmlPath = external_node_path_namespaceObject.join(temporary, 'index.html');
|
|
519
536
|
try {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
];
|
|
524
|
-
const imageIds = new Set();
|
|
537
|
+
await promises_namespaceObject.writeFile(htmlPath, (0, external_utils_js_namespaceObject.getReportTpl)());
|
|
538
|
+
if (directoryMode) await promises_namespaceObject.appendFile(htmlPath, (0, html_utils_js_namespaceObject.getBaseUrlFixScript)());
|
|
539
|
+
const images = new test_report_images_js_namespaceObject.TestReportImages(htmlPath, directoryMode);
|
|
525
540
|
const reports = [];
|
|
526
541
|
for (const source of new Map(prepared.sources.map((source)=>[
|
|
527
542
|
source.reportId,
|
|
528
543
|
source
|
|
529
544
|
])).values()){
|
|
530
|
-
const serialized = source.dump.serialize();
|
|
531
|
-
if (source.dumpPath) {
|
|
532
|
-
const refs = new Map();
|
|
533
|
-
JSON.parse(serialized, (_key, value)=>{
|
|
534
|
-
const ref = (0, image_reference_js_namespaceObject.normalizeStoredImageRef)(value);
|
|
535
|
-
if (ref) refs.set(ref.id, ref);
|
|
536
|
-
return value;
|
|
537
|
-
});
|
|
538
|
-
if (refs.size) await promises_namespaceObject.mkdir(external_node_path_namespaceObject.join(temporary, 'screenshots'), {
|
|
539
|
-
recursive: true
|
|
540
|
-
});
|
|
541
|
-
for (const ref of refs.values())if (!imageIds.has(ref.id)) {
|
|
542
|
-
if ('file' !== ref.storage || !ref.path) throw new Error(`Snapshot image ${ref.id} has no file source`);
|
|
543
|
-
await promises_namespaceObject.copyFile(external_node_path_namespaceObject.resolve(external_node_path_namespaceObject.dirname(source.dumpPath), ref.path), external_node_path_namespaceObject.join(temporary, 'screenshots', `${ref.id}.${(0, image_reference_js_namespaceObject.imageRefFileExtension)(ref)}`));
|
|
544
|
-
imageIds.add(ref.id);
|
|
545
|
-
}
|
|
546
|
-
} else if (source.directoryMode) {
|
|
547
|
-
const images = external_node_path_namespaceObject.join(external_node_path_namespaceObject.dirname(source.sourcePath), 'screenshots');
|
|
548
|
-
if ((0, external_node_fs_namespaceObject.existsSync)(images)) await promises_namespaceObject.cp(images, external_node_path_namespaceObject.join(temporary, 'screenshots'), {
|
|
549
|
-
recursive: true
|
|
550
|
-
});
|
|
551
|
-
} else {
|
|
552
|
-
const html = await promises_namespaceObject.readFile(source.sourcePath, 'utf8');
|
|
553
|
-
for (const match of html.matchAll(/<script\b([^>]*)>[\s\S]*?<\/script>/g))if (/(?:^|\s)type=["']midscene-image["']/.test(match[1])) parts.push(match[0]);
|
|
554
|
-
}
|
|
545
|
+
const serialized = await images.rewriteAsync(source.dump.serialize(), source.dumpPath ?? source.sourcePath);
|
|
555
546
|
reports.push(source.dump);
|
|
556
|
-
|
|
547
|
+
await promises_namespaceObject.appendFile(htmlPath, (0, external_utils_js_namespaceObject.reportHTMLContent)({
|
|
557
548
|
dumpString: serialized,
|
|
558
549
|
attributes: {
|
|
559
550
|
'data-group-id': source.reportId,
|
|
@@ -563,8 +554,7 @@ class TestRunReportAssembler {
|
|
|
563
554
|
}
|
|
564
555
|
}, void 0, void 0, false));
|
|
565
556
|
}
|
|
566
|
-
|
|
567
|
-
await promises_namespaceObject.writeFile(htmlPath, parts.join('\n'));
|
|
557
|
+
await promises_namespaceObject.appendFile(htmlPath, (0, html_utils_js_namespaceObject.generateTestRunReportScriptTag)(dump) + mergedAgentReportComment(reports));
|
|
568
558
|
if (options.overwrite) {
|
|
569
559
|
await promises_namespaceObject.rm(artifact, {
|
|
570
560
|
recursive: true,
|
|
@@ -606,7 +596,7 @@ class TestRunReportAssembler {
|
|
|
606
596
|
const runnerDump = options.buildRunnerDump(index);
|
|
607
597
|
if (1 !== runnerDump.schemaVersion || 'test-runner' !== runnerDump.kind) throw new Error('buildRunnerDump must return a Midscene Test report dump with schemaVersion 1 and kind "test-runner".');
|
|
608
598
|
JSON.stringify(runnerDump);
|
|
609
|
-
const directoryMode =
|
|
599
|
+
const directoryMode = 'html-and-external-assets' === options.outputFormat;
|
|
610
600
|
const finalArtifactPath = external_node_path_namespaceObject.join(outputDir, options.reportFileName);
|
|
611
601
|
const directoryReportPath = external_node_path_namespaceObject.join(finalArtifactPath, 'index.html');
|
|
612
602
|
const standaloneReportPath = `${finalArtifactPath}.html`;
|
|
@@ -628,24 +618,16 @@ class TestRunReportAssembler {
|
|
|
628
618
|
const htmlEndIndex = template.lastIndexOf(htmlEndTag);
|
|
629
619
|
(0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath, -1 === htmlEndIndex ? template : template.slice(0, htmlEndIndex));
|
|
630
620
|
if (directoryMode) (0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath, (0, html_utils_js_namespaceObject.getBaseUrlFixScript)());
|
|
621
|
+
const images = new test_report_images_js_namespaceObject.TestReportImages(temporaryReportPath, directoryMode);
|
|
631
622
|
const agentReports = [];
|
|
632
623
|
for (const source of new Map(prepared.sources.map((source)=>[
|
|
633
624
|
source.reportId,
|
|
634
625
|
source
|
|
635
626
|
])).values()){
|
|
636
|
-
|
|
637
|
-
const screenshotsDir = external_node_path_namespaceObject.join(external_node_path_namespaceObject.dirname(source.sourcePath), 'screenshots');
|
|
638
|
-
if ((0, external_node_fs_namespaceObject.existsSync)(screenshotsDir)) {
|
|
639
|
-
const targetScreenshotsDir = external_node_path_namespaceObject.join(external_node_path_namespaceObject.dirname(temporaryReportPath), 'screenshots');
|
|
640
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(targetScreenshotsDir, {
|
|
641
|
-
recursive: true
|
|
642
|
-
});
|
|
643
|
-
for (const file of (0, external_node_fs_namespaceObject.readdirSync)(screenshotsDir))(0, external_node_fs_namespaceObject.copyFileSync)(external_node_path_namespaceObject.join(screenshotsDir, file), external_node_path_namespaceObject.join(targetScreenshotsDir, file));
|
|
644
|
-
}
|
|
645
|
-
} else (0, html_utils_js_namespaceObject.streamImageScriptsToFile)(source.sourcePath, temporaryReportPath);
|
|
627
|
+
const serialized = images.rewriteSync(source.dump.serialize(), source.dumpPath ?? source.sourcePath);
|
|
646
628
|
agentReports.push(source.dump);
|
|
647
629
|
(0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath, `${(0, external_utils_js_namespaceObject.reportHTMLContent)({
|
|
648
|
-
dumpString:
|
|
630
|
+
dumpString: serialized,
|
|
649
631
|
attributes: {
|
|
650
632
|
'data-group-id': source.reportId,
|
|
651
633
|
'data-report-id': source.reportId,
|
|
@@ -682,7 +664,7 @@ function collectDedupedExecutions(htmlPath) {
|
|
|
682
664
|
let baseDump = null;
|
|
683
665
|
let executionSerial = 0;
|
|
684
666
|
const latestSerialByExecutionId = new Map();
|
|
685
|
-
(0,
|
|
667
|
+
(0, report_artifact_reader_js_namespaceObject.streamReportDumpScripts)(htmlPath, (dumpScript)=>{
|
|
686
668
|
if (!dumpScript.openTag.includes('data-group-id')) return false;
|
|
687
669
|
const groupedDump = external_types_js_namespaceObject.ReportActionDump.fromSerializedString((0, utils_namespaceObject.antiEscapeScriptTag)(dumpScript.content));
|
|
688
670
|
for (const execution of groupedDump.executions){
|
|
@@ -693,7 +675,7 @@ function collectDedupedExecutions(htmlPath) {
|
|
|
693
675
|
});
|
|
694
676
|
const executions = [];
|
|
695
677
|
executionSerial = 0;
|
|
696
|
-
(0,
|
|
678
|
+
(0, report_artifact_reader_js_namespaceObject.streamReportDumpScripts)(htmlPath, (dumpScript)=>{
|
|
697
679
|
if (!dumpScript.openTag.includes('data-group-id')) return false;
|
|
698
680
|
const groupedDump = external_types_js_namespaceObject.ReportActionDump.fromSerializedString((0, utils_namespaceObject.antiEscapeScriptTag)(dumpScript.content));
|
|
699
681
|
if (!baseDump) baseDump = groupedDump;
|
|
@@ -779,6 +761,8 @@ function splitReportHtmlByExecution(options) {
|
|
|
779
761
|
screenshotFiles: Array.from(writtenScreenshotFiles).sort().map((fileName)=>external_node_path_namespaceObject.join(screenshotsDir, fileName))
|
|
780
762
|
};
|
|
781
763
|
}
|
|
764
|
+
exports.ExecutionRecorder = __webpack_exports__.ExecutionRecorder;
|
|
765
|
+
exports.ReportArtifactStore = __webpack_exports__.ReportArtifactStore;
|
|
782
766
|
exports.ReportMergingTool = __webpack_exports__.ReportMergingTool;
|
|
783
767
|
exports.TestRunReportAssembler = __webpack_exports__.TestRunReportAssembler;
|
|
784
768
|
exports.calculateTestRunHealth = __webpack_exports__.calculateTestRunHealth;
|
|
@@ -786,9 +770,17 @@ exports.classifyTestRunCase = __webpack_exports__.classifyTestRunCase;
|
|
|
786
770
|
exports.collectDedupedExecutions = __webpack_exports__.collectDedupedExecutions;
|
|
787
771
|
exports.dedupeExecutionsKeepLatest = __webpack_exports__.dedupeExecutionsKeepLatest;
|
|
788
772
|
exports.isDirectoryModeReport = __webpack_exports__.isDirectoryModeReport;
|
|
773
|
+
exports.readReportActionDump = __webpack_exports__.readReportActionDump;
|
|
774
|
+
exports.readReportArtifactManifest = __webpack_exports__.readReportArtifactManifest;
|
|
775
|
+
exports.readReportArtifactManifestAsync = __webpack_exports__.readReportArtifactManifestAsync;
|
|
776
|
+
exports.readReportDumpScripts = __webpack_exports__.readReportDumpScripts;
|
|
777
|
+
exports.readReportRunnerDump = __webpack_exports__.readReportRunnerDump;
|
|
789
778
|
exports.removeReportArtifact = __webpack_exports__.removeReportArtifact;
|
|
790
779
|
exports.splitReportHtmlByExecution = __webpack_exports__.splitReportHtmlByExecution;
|
|
780
|
+
exports.streamReportDumpScripts = __webpack_exports__.streamReportDumpScripts;
|
|
791
781
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
782
|
+
"ExecutionRecorder",
|
|
783
|
+
"ReportArtifactStore",
|
|
792
784
|
"ReportMergingTool",
|
|
793
785
|
"TestRunReportAssembler",
|
|
794
786
|
"calculateTestRunHealth",
|
|
@@ -796,8 +788,14 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
796
788
|
"collectDedupedExecutions",
|
|
797
789
|
"dedupeExecutionsKeepLatest",
|
|
798
790
|
"isDirectoryModeReport",
|
|
791
|
+
"readReportActionDump",
|
|
792
|
+
"readReportArtifactManifest",
|
|
793
|
+
"readReportArtifactManifestAsync",
|
|
794
|
+
"readReportDumpScripts",
|
|
795
|
+
"readReportRunnerDump",
|
|
799
796
|
"removeReportArtifact",
|
|
800
|
-
"splitReportHtmlByExecution"
|
|
797
|
+
"splitReportHtmlByExecution",
|
|
798
|
+
"streamReportDumpScripts"
|
|
801
799
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
802
800
|
Object.defineProperty(exports, '__esModule', {
|
|
803
801
|
value: true
|
package/dist/lib/report.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../src/report.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\n appendFileSync,\n copyFileSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readFileSync,\n readdirSync,\n renameSync,\n rmSync,\n unlinkSync,\n writeFileSync,\n} from 'node:fs';\nimport * as fsAsync from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport { antiEscapeScriptTag, logMsg, uuid } from '@midscene/shared/utils';\nimport { getReportFileName } from './agent/report-file-name';\nimport {\n DATA_SCREENSHOT_MODE_ATTR,\n extractAllDumpScriptsSync,\n extractLastDumpScriptSync,\n extractTestRunReportDumpSync,\n generateAgentReportComment,\n getBaseUrlFixScript,\n generateTestRunReportScriptTag as runnerDumpScript,\n streamDumpScriptsSync,\n streamImageScriptsToFile,\n} from './dump/html-utils';\nimport {\n imageRefFileExtension,\n normalizeStoredImageRef,\n} from './dump/image-reference';\nimport {\n parseBase64ImageDataUrl,\n resolveImageSource,\n} from './dump/screenshot-store';\nimport { collectReportSummary } from './report-stats';\nimport type {\n AssembleTestRunReportOptions,\n IndexedTestRunReportSource,\n TestRunReportMetrics,\n TestRunReportSource,\n TestRunReportSourceIndex,\n} from './test-run-report';\nimport {\n type MergeTestRunReportSource,\n mergeTestRunReportDumps,\n} from './test-runner/reporting/merge-report';\nimport { collectTestRunReportMetrics } from './test-runner/reporting/metrics';\nimport {\n type ExecutionDump,\n type IExecutionDump,\n ReportActionDump,\n type ScreenshotMode,\n} from './types';\nimport type { ReportFileWithAttributes } from './types';\nimport { getReportTpl, getVersion, reportHTMLContent } from './utils';\n\nexport {\n calculateTestRunHealth,\n classifyTestRunCase,\n} from './test-run-health';\n\n/**\n * Read the screenshot storage mode a report declared at generation time.\n *\n * Reports written by current versions stamp `data-screenshot-mode` onto every\n * dump script tag, so we only need to peek at the first real dump script (the\n * template's bundled JS also references the dump type string, hence the\n * `data-group-id` filter) and can stop streaming immediately.\n *\n * Returns undefined for legacy reports that predate the attribute or for\n * unreadable files, letting the caller fall back to a filesystem heuristic.\n */\nconst screenshotModeAttrRegExp = new RegExp(\n `${DATA_SCREENSHOT_MODE_ATTR}=\"(inline|directory)\"`,\n);\n\nfunction readDeclaredScreenshotMode(\n reportFilePath: string,\n): ScreenshotMode | undefined {\n let mode: ScreenshotMode | undefined;\n try {\n streamDumpScriptsSync(reportFilePath, ({ openTag }) => {\n // Skip false matches from the template's bundled JS code.\n if (!openTag.includes('data-group-id')) return false;\n const match = openTag.match(screenshotModeAttrRegExp);\n mode = match?.[1] as ScreenshotMode | undefined;\n return true; // the first real dump script decides the mode\n });\n } catch {\n // Unreadable / non-existent file — let the caller fall back.\n }\n return mode;\n}\n\n/**\n * Check if a report is in directory mode (html-and-external-assets).\n * Directory mode reports: {name}/index.html + {name}/screenshots/\n *\n * The mode is read from the report's own `data-screenshot-mode` metadata, which\n * is authoritative regardless of whether the run happened to capture any\n * screenshots. For legacy reports without the attribute we fall back to the old\n * filesystem heuristic (an `index.html` that has a sibling `screenshots/` dir).\n */\nexport function isDirectoryModeReport(reportFilePath: string): boolean {\n // Directory-mode reports are always written as `{name}/index.html`, so any\n // other filename is inline. Short-circuit before touching the file so the\n // common inline case (`{name}.html`) costs nothing.\n if (path.basename(reportFilePath) !== 'index.html') return false;\n\n const declared = readDeclaredScreenshotMode(reportFilePath);\n if (declared) return declared === 'directory';\n\n // Legacy fallback for reports generated before screenshotMode was embedded.\n return existsSync(path.join(path.dirname(reportFilePath), 'screenshots'));\n}\n\n/**\n * Whether a report lives in its own dedicated directory (`{name}/index.html`)\n * rather than being a single standalone file (`{name}.html`).\n *\n * This is a structural fact about *where the report file sits*, independent of\n * how it stores screenshots: a directory report can keep screenshots external\n * (a `screenshots/` sibling) OR inline them into `index.html`. Deletion needs\n * this — not the screenshot mode — to decide whether to remove the whole\n * directory or just unlink a file, so that an inline-screenshot report nested in\n * its own folder still has the folder removed instead of being orphaned.\n */\nfunction isDirectoryBasedReport(reportFilePath: string): boolean {\n return path.basename(reportFilePath) === 'index.html';\n}\n\n/**\n * Remove a complete report artifact from disk.\n *\n * Standalone reports own only their HTML file, while directory-based reports\n * own the directory containing `index.html`. Callers must decide whether they\n * own the source artifact and should only invoke this after its replacement\n * has been produced successfully.\n *\n * @param reportFilePath Path to the standalone report or directory report's\n * `index.html` entry point.\n * @throws When the owned report artifact cannot be removed.\n */\nexport function removeReportArtifact(reportFilePath: string): void {\n if (isDirectoryBasedReport(reportFilePath)) {\n rmSync(path.dirname(reportFilePath), { recursive: true, force: true });\n return;\n }\n unlinkSync(reportFilePath);\n}\n\n/**\n * Deduplicate executions by stable id, keeping only the last occurrence.\n * Old-format executions without id are always preserved.\n */\nexport function dedupeExecutionsKeepLatest<T extends Pick<ExecutionDump, 'id'>>(\n executions: T[],\n): T[] {\n let noIdCounter = 0;\n const deduped = new Map<string, T>();\n for (const exec of executions) {\n const key = exec.id || `__no_id_${noIdCounter++}`;\n deduped.set(key, exec);\n }\n return Array.from(deduped.values());\n}\n/**\n * Peek at the first `sdkVersion` field embedded in a midscene_web_dump\n * script tag inside the given report file. Returns undefined if no\n * recognizable tag or sdkVersion is present.\n */\nfunction peekReportSdkVersion(reportFilePath: string): string | undefined {\n try {\n const dump = extractLastDumpScriptSync(reportFilePath);\n if (!dump) return undefined;\n const match = dump.match(/\"sdkVersion\"\\s*:\\s*\"([^\"]+)\"/);\n return match?.[1];\n } catch {\n return undefined;\n }\n}\n\nconst warnedMismatchedVersions = new Set<string>();\n\nfunction tryParseAgentReportDump(dumpString: string): ReportActionDump | null {\n const trimmed = dumpString.trimStart();\n if (!trimmed.startsWith('{') || !trimmed.includes('\"executions\"')) {\n return null;\n }\n\n try {\n return ReportActionDump.fromSerializedString(trimmed);\n } catch {\n return null;\n }\n}\n\nfunction mergedAgentReportComment(reports: ReportActionDump[]): string {\n if (reports.length === 0) {\n return '';\n }\n if (reports.length === 1) {\n return generateAgentReportComment(reports[0]);\n }\n\n const deviceTypes = Array.from(\n new Set(reports.map((report) => report.deviceType).filter(Boolean)),\n );\n const mergedReport = new ReportActionDump({\n sdkVersion: reports[0].sdkVersion || getVersion(),\n groupName: 'Merged Midscene Report',\n groupDescription: 'Agent-readable summary for merged report HTML',\n modelBriefs: reports.flatMap((report) => report.modelBriefs ?? []),\n deviceType: deviceTypes.length === 1 ? deviceTypes[0] : 'mixed',\n executions: dedupeExecutionsKeepLatest(\n reports.flatMap((report) => report.executions ?? []),\n ),\n });\n return generateAgentReportComment(mergedReport);\n}\n\nexport class ReportMergingTool {\n private reportInfos: ReportFileWithAttributes[] = [];\n\n private createEmptyDumpString(groupName: string, groupDescription?: string) {\n return new ReportActionDump({\n sdkVersion: '',\n groupName,\n groupDescription,\n modelBriefs: [],\n executions: [],\n }).serialize();\n }\n\n public append(reportInfo: ReportFileWithAttributes) {\n if (\n !reportInfo.reportFilePath &&\n reportInfo.reportAttributes.testStatus !== 'skipped'\n ) {\n throw new Error(\n 'reportFilePath is required unless reportAttributes.testStatus is \"skipped\"',\n );\n }\n\n if (reportInfo.reportFilePath) {\n const sourceVersion = peekReportSdkVersion(reportInfo.reportFilePath);\n const currentVersion = getVersion();\n if (\n sourceVersion &&\n currentVersion &&\n sourceVersion !== currentVersion &&\n !warnedMismatchedVersions.has(sourceVersion)\n ) {\n warnedMismatchedVersions.add(sourceVersion);\n logMsg(\n `[@midscene/core] ReportMergingTool version mismatch: source report was written by @midscene/core@${sourceVersion} but the merger is @midscene/core@${currentVersion}. This commonly means @midscene/core and the device package (e.g. @midscene/android) resolve to different versions in node_modules. Merged output may silently drop intermediate steps. Align the versions and reinstall (rm -rf node_modules package-lock.json && npm install).`,\n );\n }\n }\n this.reportInfos.push(reportInfo);\n }\n public clear() {\n this.reportInfos = [];\n }\n\n /**\n * Merge multiple dump script contents (from the same source report)\n * into a single serialized ReportActionDump string.\n * If there's only one dump, return it as-is. If multiple, merge\n * all executions into the first dump's group structure.\n */\n private mergeDumpScripts(contents: string[]): string {\n const unescaped = contents\n .map((c) => antiEscapeScriptTag(c))\n .filter((c) => c.length > 0);\n if (unescaped.length === 0) return '';\n if (unescaped.length === 1) return unescaped[0];\n\n // Parse all dumps and collect executions, deduplicating by id (keep last).\n // Only executions with a stable id are deduped; old-format entries without\n // id are always kept (they may be distinct despite sharing the same name).\n const base = ReportActionDump.fromSerializedString(unescaped[0]);\n const allExecutions = [...base.executions];\n for (let i = 1; i < unescaped.length; i++) {\n const other = ReportActionDump.fromSerializedString(unescaped[i]);\n allExecutions.push(...other.executions);\n }\n base.executions = dedupeExecutionsKeepLatest(allExecutions);\n return base.serialize();\n }\n\n public mergeReports(\n reportFileName: 'AUTO' | string = 'AUTO',\n opts?: {\n rmOriginalReports?: boolean;\n overwrite?: boolean;\n outputDir?: string;\n },\n ): string | null {\n const {\n rmOriginalReports = false,\n overwrite = false,\n outputDir,\n } = opts ?? {};\n\n if (this.reportInfos.length === 0) {\n logMsg('No reports to merge');\n return null;\n }\n\n const runnerDumps = this.reportInfos.map((info) =>\n info.reportFilePath\n ? extractTestRunReportDumpSync(info.reportFilePath)\n : undefined,\n );\n const hasRunnerDump = runnerDumps.some(Boolean);\n\n const targetDir = outputDir\n ? path.resolve(outputDir)\n : getMidsceneRunSubDir('report');\n if (outputDir) {\n mkdirSync(targetDir, { recursive: true });\n }\n\n // Resolve each report's screenshot mode exactly once. isDirectoryModeReport\n // reads the file to find the authoritative metadata, so recomputing it for\n // both the output-path decision and the per-report merge loop would re-scan\n // every report twice.\n const isDirModeByIndex = this.reportInfos.map((info) =>\n Boolean(\n info.reportFilePath && isDirectoryModeReport(info.reportFilePath),\n ),\n );\n const hasDirectoryModeReport = isDirModeByIndex.some(Boolean);\n\n const resolvedName =\n reportFileName === 'AUTO'\n ? getReportFileName('merged-report')\n : reportFileName;\n\n // Directory mode: output as {name}/index.html to keep relative paths working\n // Inline mode: output as {name}.html (single file)\n const outputFilePath = hasDirectoryModeReport\n ? path.resolve(targetDir, resolvedName, 'index.html')\n : path.resolve(targetDir, `${resolvedName}.html`);\n\n if (reportFileName !== 'AUTO' && existsSync(outputFilePath)) {\n if (!overwrite) {\n throw new Error(\n `Report file already exists: ${outputFilePath}\\nSet overwrite to true to overwrite this file.`,\n );\n }\n if (hasDirectoryModeReport) {\n rmSync(path.dirname(outputFilePath), { recursive: true, force: true });\n } else {\n unlinkSync(outputFilePath);\n }\n }\n\n if (hasDirectoryModeReport) {\n mkdirSync(path.dirname(outputFilePath), { recursive: true });\n }\n\n logMsg(\n `Start merging ${this.reportInfos.length} reports...\\nCreating template file...`,\n );\n\n try {\n // Write template without closing </html> tag so we can append\n // dump scripts before it. The closing tag is added at the end.\n const htmlEndTag = '</html>';\n const tpl = getReportTpl();\n const htmlEndIdx = tpl.lastIndexOf(htmlEndTag);\n const tplWithoutClose =\n htmlEndIdx !== -1 ? tpl.slice(0, htmlEndIdx) : tpl;\n appendFileSync(outputFilePath, tplWithoutClose);\n\n // For directory-mode output, inject base URL fix script\n if (hasDirectoryModeReport) {\n appendFileSync(outputFilePath, getBaseUrlFixScript());\n }\n\n const agentReports: ReportActionDump[] = [];\n const runnerSources: MergeTestRunReportSource[] = [];\n const writtenInlineImageIds = new Set<string>();\n\n // Process all reports one by one\n for (let i = 0; i < this.reportInfos.length; i++) {\n const reportInfo = this.reportInfos[i];\n logMsg(`Processing report ${i + 1}/${this.reportInfos.length}`);\n\n const { reportAttributes } = reportInfo;\n let dumpString = this.createEmptyDumpString(\n reportAttributes.testTitle,\n reportAttributes.testDescription,\n );\n let mergedGroupId = `merged-group-${i}`;\n\n if (reportInfo.reportFilePath) {\n if (isDirModeByIndex[i]) {\n // Directory mode: copy external screenshot files. A directory-mode\n // report can legitimately have no screenshots/ dir (a run that\n // captured nothing), so only copy when the source dir exists.\n const reportDir = path.dirname(reportInfo.reportFilePath);\n const screenshotsDir = path.join(reportDir, 'screenshots');\n if (existsSync(screenshotsDir)) {\n const mergedScreenshotsDir = path.join(\n path.dirname(outputFilePath),\n 'screenshots',\n );\n mkdirSync(mergedScreenshotsDir, { recursive: true });\n for (const file of readdirSync(screenshotsDir)) {\n const src = path.join(screenshotsDir, file);\n const dest = path.join(mergedScreenshotsDir, file);\n copyFileSync(src, dest);\n }\n }\n } else {\n // Inline mode: stream image scripts to output file\n streamImageScriptsToFile(\n reportInfo.reportFilePath,\n outputFilePath,\n writtenInlineImageIds,\n );\n }\n\n // Extract all dump scripts from the source report.\n // After the per-execution append refactor, a single source report\n // may contain multiple <script type=\"midscene_web_dump\"> tags\n // (one per execution). We merge them into a single ReportActionDump.\n // Filter by data-group-id to exclude false matches from the template's\n // bundled JS code, which also references the midscene_web_dump type string.\n const allDumps = extractAllDumpScriptsSync(\n reportInfo.reportFilePath,\n ).filter((d) => d.openTag.includes('data-group-id'));\n const groupIdMatch = allDumps[0]?.openTag.match(\n /data-group-id=\"([^\"]+)\"/,\n );\n if (groupIdMatch && !hasRunnerDump) {\n mergedGroupId = decodeURIComponent(groupIdMatch[1]);\n }\n const extractedDumpString =\n allDumps.length > 0\n ? this.mergeDumpScripts(allDumps.map((d) => d.content))\n : extractLastDumpScriptSync(reportInfo.reportFilePath);\n if (extractedDumpString) {\n dumpString = extractedDumpString;\n }\n }\n\n const agentReport = tryParseAgentReportDump(dumpString);\n if (agentReport) {\n agentReports.push(agentReport);\n }\n if (hasRunnerDump)\n runnerSources.push({\n reportId: mergedGroupId,\n sourcePath: reportInfo.reportFilePath ?? '<skipped-agent-report>',\n attributes: reportAttributes,\n dump: runnerDumps[i],\n timing: agentReport\n ? agentReportTiming(agentReport, reportAttributes.testDuration)\n : undefined,\n });\n\n const reportHtmlStr = `${reportHTMLContent(\n {\n dumpString,\n attributes: {\n 'data-group-id': mergedGroupId,\n ...(hasRunnerDump ? { 'data-report-id': mergedGroupId } : {}),\n [DATA_SCREENSHOT_MODE_ATTR]: hasDirectoryModeReport\n ? 'directory'\n : 'inline',\n playwright_test_duration: reportAttributes.testDuration,\n playwright_test_status: reportAttributes.testStatus,\n playwright_test_title: reportAttributes.testTitle,\n playwright_test_id: reportAttributes.testId,\n playwright_test_description: reportAttributes.testDescription,\n is_merged: true,\n },\n },\n undefined,\n undefined,\n false,\n )}\\n`;\n\n appendFileSync(outputFilePath, reportHtmlStr);\n }\n\n if (hasRunnerDump) {\n const executions = dedupeExecutionsKeepLatest(\n agentReports.flatMap((report) => report.executions),\n );\n const metrics = collectTestRunReportMetrics({ executions });\n const executionMetrics = Object.fromEntries(\n executions.flatMap((execution) =>\n execution.id\n ? [\n [\n execution.id,\n collectTestRunReportMetrics({ executions: [execution] }),\n ],\n ]\n : [],\n ),\n );\n appendFileSync(\n outputFilePath,\n runnerDumpScript(\n mergeTestRunReportDumps(\n runnerSources,\n metrics,\n uuid(),\n executionMetrics,\n ),\n ),\n );\n }\n\n const agentComment = mergedAgentReportComment(agentReports);\n if (agentComment) {\n appendFileSync(outputFilePath, agentComment);\n }\n\n // Close the HTML document\n appendFileSync(outputFilePath, `${htmlEndTag}\\n`);\n\n logMsg(`Successfully merged new report: ${outputFilePath}`);\n\n // Remove original reports if needed\n if (rmOriginalReports) {\n let removedReportCount = 0;\n let reportCountWithFilePath = 0;\n for (const info of this.reportInfos) {\n if (!info.reportFilePath) continue;\n reportCountWithFilePath += 1;\n try {\n removeReportArtifact(info.reportFilePath);\n removedReportCount += 1;\n } catch (error) {\n logMsg(`Error deleting report ${info.reportFilePath}: ${error}`);\n }\n }\n logMsg(\n `Removed ${removedReportCount}/${reportCountWithFilePath} original reports`,\n );\n }\n return outputFilePath;\n } catch (error) {\n logMsg(`Error in mergeReports: ${error}`);\n throw error;\n }\n }\n}\n\nfunction agentReportTiming(\n report: ReportActionDump,\n durationMs: number,\n): MergeTestRunReportSource['timing'] {\n const timing = collectReportSummary(report).timing;\n const executionTimes = report.executions\n .map((execution) => execution.logTime)\n .filter(\n (value): value is number =>\n typeof value === 'number' && Number.isFinite(value),\n );\n const started =\n timing.wallTimeStart ??\n (executionTimes.length ? Math.min(...executionTimes) : undefined);\n if (started === undefined) return undefined;\n const ended =\n timing.wallTimeEnd ??\n Math.max(\n ...executionTimes,\n started + (Number.isFinite(durationMs) ? Math.max(0, durationMs) : 0),\n );\n return {\n startedAt: new Date(started).toISOString(),\n endedAt: new Date(ended).toISOString(),\n durationMs: Math.max(0, ended - started),\n };\n}\n\ninterface PreparedTestRunReportSource extends IndexedTestRunReportSource {\n dump: ReportActionDump;\n directoryMode: boolean;\n dumpPath?: string;\n}\n\nconst validateTestRunReportFileName = (fileName: string): void => {\n if (\n !fileName ||\n fileName === '.' ||\n fileName === '..' ||\n path.basename(fileName) !== fileName ||\n fileName.endsWith('.html')\n ) {\n throw new Error(\n `Midscene Test reportFileName must be one path segment without an extension: ${fileName}`,\n );\n }\n};\n\nconst uniqueTestRunReportSources = (\n sources: readonly TestRunReportSource[],\n): TestRunReportSource[] => {\n const unique = new Map<string, TestRunReportSource>();\n\n for (const source of sources) {\n const scopeId = source.scopeId.trim();\n const sourcePath = path.resolve(source.sourcePath);\n if (!scopeId) {\n throw new Error('Midscene Test report source scopeId must not be empty.');\n }\n\n unique.set(`${scopeId}\\u0000${source.dumpPath ?? sourcePath}`, {\n ...source,\n scopeId,\n sourcePath,\n });\n }\n\n return [...unique.values()];\n};\n\nconst prepareTestRunReportSources = (\n sources: readonly TestRunReportSource[],\n loadedDumps?: ReadonlyMap<string, string | Error>,\n): {\n sources: PreparedTestRunReportSource[];\n metrics: TestRunReportMetrics;\n capturedMetrics: TestRunReportMetrics;\n executionMetrics: Record<string, TestRunReportMetrics>;\n diagnostics: import('./test-run-report').TestRunReportDiagnostic[];\n} => {\n const prepared: PreparedTestRunReportSource[] = [];\n const diagnostics: import('./test-run-report').TestRunReportDiagnostic[] = [];\n const ownerByScopedExecution = new Map<string, string>();\n const preparedByPath = new Map<string, PreparedTestRunReportSource>();\n\n for (const [sourceIndex, source] of uniqueTestRunReportSources(\n sources,\n ).entries()) {\n let baseDump: ReportActionDump;\n let executions: IExecutionDump[];\n try {\n if (source.dumpPath) {\n const contents =\n loadedDumps?.get(source.dumpPath) ??\n readFileSync(source.dumpPath, 'utf8');\n if (contents instanceof Error) throw contents;\n baseDump = ReportActionDump.fromSerializedString(contents);\n executions = baseDump.executions;\n } else {\n if (!existsSync(source.sourcePath))\n throw new Error(`Agent report does not exist: ${source.sourcePath}`);\n const sourceVersion = peekReportSdkVersion(source.sourcePath);\n const currentVersion = getVersion();\n if (\n sourceVersion &&\n currentVersion &&\n sourceVersion !== currentVersion &&\n !warnedMismatchedVersions.has(sourceVersion)\n ) {\n warnedMismatchedVersions.add(sourceVersion);\n logMsg(\n `[@midscene/core] TestRunReportAssembler version mismatch: source report was written by @midscene/core@${sourceVersion} but the assembler is @midscene/core@${currentVersion}. Align the workspace package versions before generating the Midscene Test report.`,\n );\n }\n ({ baseDump, executions } = collectDedupedExecutions(\n source.sourcePath,\n ));\n }\n } catch (error) {\n diagnostics.push({\n level: 'warning',\n code: 'agent-source-unavailable',\n scopeId: source.scopeId,\n sourcePaths: [source.sourcePath],\n message: `Agent source could not be collected: ${String(error)}`,\n });\n continue;\n }\n // A borrowed Agent can serve several sequential test scopes. Reuse its\n // report group and metrics while indexing each scope's execution links.\n const sourceKey = source.sourcePath;\n const shared = preparedByPath.get(sourceKey);\n if (shared) {\n if (source.dumpPath) {\n shared.dump.executions = dedupeExecutionsKeepLatest([\n ...shared.dump.executions,\n ...baseDump.executions,\n ]);\n }\n const scoped = prepared.find(\n (item) =>\n item.reportId === shared.reportId && item.scopeId === source.scopeId,\n );\n const executionIds = [\n ...new Set([\n ...(scoped?.executionIds ?? []),\n ...executions.flatMap((execution) =>\n execution.id ? [execution.id] : [],\n ),\n ]),\n ];\n for (const executionId of executionIds) {\n const key = `${source.scopeId}\\u0000${executionId}`;\n const owner = ownerByScopedExecution.get(key);\n if (owner && owner !== shared.reportId)\n throw new Error(\n `Agent execution ${executionId} is present in multiple reports for test scope ${source.scopeId}: ${owner}, ${shared.reportId}`,\n );\n ownerByScopedExecution.set(key, shared.reportId);\n }\n if (scoped) {\n scoped.executionIds = executionIds;\n const partial = [scoped.collection, source.collection].find(\n (collection) => collection?.status === 'partial',\n );\n scoped.collection = partial ?? source.collection ?? scoped.collection;\n } else\n prepared.push({\n ...shared,\n scopeId: source.scopeId,\n executionIds,\n collection: source.collection,\n });\n continue;\n }\n const reportId = `runner-report-${sourceIndex + 1}`;\n const executionIds: string[] = [];\n for (const execution of executions) {\n if (!execution.id) continue;\n const scopedExecution = `${source.scopeId}\\u0000${execution.id}`;\n const previousOwner = ownerByScopedExecution.get(scopedExecution);\n if (previousOwner && previousOwner !== reportId) {\n throw new Error(\n `Agent execution ${execution.id} is present in multiple reports for test scope ${source.scopeId}: ${previousOwner}, ${reportId}`,\n );\n }\n ownerByScopedExecution.set(scopedExecution, reportId);\n executionIds.push(execution.id);\n }\n\n const dump = new ReportActionDump({\n sdkVersion: baseDump.sdkVersion,\n groupName: baseDump.groupName,\n groupDescription: baseDump.groupDescription,\n modelBriefs: baseDump.modelBriefs,\n deviceType: baseDump.deviceType,\n executions,\n });\n const preparedSource = {\n reportId,\n scopeId: source.scopeId,\n sourcePath: source.sourcePath,\n executionIds,\n collection: source.collection,\n dump,\n directoryMode:\n !!source.dumpPath || isDirectoryModeReport(source.sourcePath),\n ...(source.dumpPath ? { dumpPath: source.dumpPath } : {}),\n };\n prepared.push(preparedSource);\n preparedByPath.set(sourceKey, preparedSource);\n }\n\n // A legacy invocation can preserve a snapshot of an Agent also used by\n // native scopes. Count stable executions once across both paths.\n const executions = dedupeExecutionsKeepLatest(\n [...preparedByPath.values()].flatMap((source) => source.dump.executions),\n );\n const metrics = collectTestRunReportMetrics({ executions });\n const executionMetrics = Object.fromEntries(\n executions.flatMap((execution) =>\n execution.id\n ? [\n [\n execution.id,\n collectTestRunReportMetrics({ executions: [execution] }),\n ],\n ]\n : [],\n ),\n );\n return {\n sources: prepared,\n diagnostics,\n capturedMetrics: metrics,\n executionMetrics,\n metrics: {\n ...metrics,\n collection: {\n ...metrics.collection!,\n fields: Object.fromEntries(\n Object.entries(metrics.collection!.fields!).map(([field, status]) => [\n field,\n diagnostics.length\n ? prepared.length === 0\n ? 'unknown'\n : status === 'complete'\n ? 'partial'\n : status\n : status,\n ]),\n ) as NonNullable<\n NonNullable<TestRunReportMetrics['collection']>['fields']\n >,\n status: diagnostics.length\n ? prepared.length\n ? 'partial'\n : 'unknown'\n : metrics.collection!.status,\n expectedExecutionCount: 0,\n capturedExecutionCount: 0,\n reasons: [\n ...metrics.collection!.reasons,\n ...diagnostics.map((diagnostic) => diagnostic.message),\n ],\n },\n },\n };\n};\n\n/**\n * Build a self-contained Midscene Test report while preserving the existing\n * Agent dump format consumed by the Report App.\n *\n * Test hierarchy and status live in `midscene_test_run_dump`; Agent reports\n * remain independent `midscene_web_dump` groups addressed by `data-report-id`.\n */\nexport class TestRunReportAssembler {\n /** Runtime publisher: current Agent snapshots avoid parsing HTML or copying unused images. */\n public async assembleAsync(\n options: AssembleTestRunReportOptions,\n ): Promise<string> {\n validateTestRunReportFileName(options.reportFileName);\n const loaded = new Map<string, string | Error>();\n await Promise.all(\n options.sources.map(async (source) => {\n if (source.dumpPath) {\n try {\n loaded.set(\n source.dumpPath,\n await fsAsync.readFile(source.dumpPath, 'utf8'),\n );\n } catch (error) {\n loaded.set(\n source.dumpPath,\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n }\n }),\n );\n const prepared = prepareTestRunReportSources(options.sources, loaded);\n const dump = options.buildRunnerDump({\n sources: prepared.sources,\n metrics: prepared.metrics,\n capturedMetrics: prepared.capturedMetrics,\n executionMetrics: prepared.executionMetrics,\n diagnostics: prepared.diagnostics,\n });\n if (dump.kind !== 'test-runner' || dump.schemaVersion !== 1)\n throw new Error('Invalid Runner report dump');\n const directoryMode = prepared.sources.some(\n (source) => source.directoryMode,\n );\n const outputDir = path.resolve(options.outputDir);\n await fsAsync.mkdir(outputDir, { recursive: true });\n const artifact = path.join(outputDir, options.reportFileName);\n const finalPath = directoryMode\n ? path.join(artifact, 'index.html')\n : `${artifact}.html`;\n if (\n !options.overwrite &&\n (existsSync(artifact) || existsSync(`${artifact}.html`))\n )\n throw new Error(`Report artifact already exists: ${artifact}`);\n const temporary = await fsAsync.mkdtemp(\n path.join(outputDir, '.test-run-report-'),\n );\n const htmlPath = path.join(temporary, 'index.html');\n try {\n const parts = [\n getReportTpl(),\n directoryMode ? getBaseUrlFixScript() : '',\n ];\n const imageIds = new Set<string>();\n const reports: ReportActionDump[] = [];\n for (const source of new Map(\n prepared.sources.map((source) => [source.reportId, source]),\n ).values()) {\n const serialized = source.dump.serialize();\n if (source.dumpPath) {\n const refs = new Map<\n string,\n ReturnType<typeof normalizeStoredImageRef> & {}\n >();\n JSON.parse(serialized, (_key, value) => {\n const ref = normalizeStoredImageRef(value);\n if (ref) refs.set(ref.id, ref);\n return value;\n });\n if (refs.size)\n await fsAsync.mkdir(path.join(temporary, 'screenshots'), {\n recursive: true,\n });\n for (const ref of refs.values()) {\n if (imageIds.has(ref.id)) continue;\n if (ref.storage !== 'file' || !ref.path)\n throw new Error(`Snapshot image ${ref.id} has no file source`);\n await fsAsync.copyFile(\n path.resolve(path.dirname(source.dumpPath), ref.path),\n path.join(\n temporary,\n 'screenshots',\n `${ref.id}.${imageRefFileExtension(ref)}`,\n ),\n );\n imageIds.add(ref.id);\n }\n } else {\n // An explicit external provider may still return a finalized HTML artifact.\n // This is a public provider contract, not a second execution/serialization schema.\n if (source.directoryMode) {\n const images = path.join(\n path.dirname(source.sourcePath),\n 'screenshots',\n );\n if (existsSync(images))\n await fsAsync.cp(images, path.join(temporary, 'screenshots'), {\n recursive: true,\n });\n } else {\n const html = await fsAsync.readFile(source.sourcePath, 'utf8');\n for (const match of html.matchAll(\n /<script\\b([^>]*)>[\\s\\S]*?<\\/script>/g,\n )) {\n if (/(?:^|\\s)type=[\"']midscene-image[\"']/.test(match[1]))\n parts.push(match[0]);\n }\n }\n }\n reports.push(source.dump);\n parts.push(\n reportHTMLContent(\n {\n dumpString: serialized,\n attributes: {\n 'data-group-id': source.reportId,\n 'data-report-id': source.reportId,\n 'data-runner-scope-id': source.scopeId,\n [DATA_SCREENSHOT_MODE_ATTR]: directoryMode\n ? 'directory'\n : 'inline',\n },\n },\n undefined,\n undefined,\n false,\n ),\n );\n }\n parts.push(runnerDumpScript(dump), mergedAgentReportComment(reports));\n await fsAsync.writeFile(htmlPath, parts.join('\\n'));\n if (options.overwrite) {\n await fsAsync.rm(artifact, { recursive: true, force: true });\n await fsAsync.rm(`${artifact}.html`, { force: true });\n }\n await fsAsync.rename(\n directoryMode ? temporary : htmlPath,\n directoryMode ? artifact : finalPath,\n );\n return finalPath;\n } finally {\n await fsAsync.rm(temporary, { recursive: true, force: true });\n }\n }\n\n public assemble(options: AssembleTestRunReportOptions): string {\n validateTestRunReportFileName(options.reportFileName);\n const outputDir = path.resolve(options.outputDir);\n mkdirSync(outputDir, { recursive: true });\n\n const prepared = prepareTestRunReportSources(options.sources);\n const index: TestRunReportSourceIndex = {\n sources: prepared.sources.map(\n ({ reportId, scopeId, sourcePath, executionIds, collection }) => ({\n reportId,\n scopeId,\n sourcePath,\n executionIds,\n collection,\n }),\n ),\n metrics: prepared.metrics,\n capturedMetrics: prepared.capturedMetrics,\n executionMetrics: prepared.executionMetrics,\n diagnostics: prepared.diagnostics,\n };\n const runnerDump = options.buildRunnerDump(index);\n if (runnerDump.schemaVersion !== 1 || runnerDump.kind !== 'test-runner') {\n throw new Error(\n 'buildRunnerDump must return a Midscene Test report dump with schemaVersion 1 and kind \"test-runner\".',\n );\n }\n // Validate serializability before creating any output artifact.\n JSON.stringify(runnerDump);\n\n const directoryMode = prepared.sources.some(\n (source) => source.directoryMode,\n );\n const finalArtifactPath = path.join(outputDir, options.reportFileName);\n const directoryReportPath = path.join(finalArtifactPath, 'index.html');\n const standaloneReportPath = `${finalArtifactPath}.html`;\n const finalReportPath = directoryMode\n ? directoryReportPath\n : standaloneReportPath;\n const existingArtifacts = [finalArtifactPath, standaloneReportPath].filter(\n existsSync,\n );\n if (existingArtifacts.length > 0 && !options.overwrite) {\n throw new Error(\n `Report artifact already exists: ${existingArtifacts[0]}\\nSet overwrite to true to overwrite this report.`,\n );\n }\n\n const temporaryRoot = mkdtempSync(\n path.join(outputDir, '.test-run-report-'),\n );\n const temporaryArtifactPath = path.join(\n temporaryRoot,\n options.reportFileName,\n );\n const temporaryReportPath = directoryMode\n ? path.join(temporaryArtifactPath, 'index.html')\n : `${temporaryArtifactPath}.html`;\n\n try {\n if (directoryMode) {\n mkdirSync(temporaryArtifactPath, { recursive: true });\n }\n\n const htmlEndTag = '</html>';\n const template = getReportTpl();\n const htmlEndIndex = template.lastIndexOf(htmlEndTag);\n appendFileSync(\n temporaryReportPath,\n htmlEndIndex === -1 ? template : template.slice(0, htmlEndIndex),\n );\n if (directoryMode) {\n appendFileSync(temporaryReportPath, getBaseUrlFixScript());\n }\n\n const agentReports: ReportActionDump[] = [];\n for (const source of new Map(\n prepared.sources.map((source) => [source.reportId, source]),\n ).values()) {\n if (source.directoryMode) {\n const screenshotsDir = path.join(\n path.dirname(source.sourcePath),\n 'screenshots',\n );\n if (existsSync(screenshotsDir)) {\n const targetScreenshotsDir = path.join(\n path.dirname(temporaryReportPath),\n 'screenshots',\n );\n mkdirSync(targetScreenshotsDir, { recursive: true });\n for (const file of readdirSync(screenshotsDir)) {\n copyFileSync(\n path.join(screenshotsDir, file),\n path.join(targetScreenshotsDir, file),\n );\n }\n }\n } else {\n streamImageScriptsToFile(source.sourcePath, temporaryReportPath);\n }\n\n agentReports.push(source.dump);\n appendFileSync(\n temporaryReportPath,\n `${reportHTMLContent(\n {\n dumpString: source.dump.serialize(),\n attributes: {\n 'data-group-id': source.reportId,\n 'data-report-id': source.reportId,\n 'data-runner-scope-id': source.scopeId,\n [DATA_SCREENSHOT_MODE_ATTR]: directoryMode\n ? 'directory'\n : 'inline',\n },\n },\n undefined,\n undefined,\n false,\n )}\\n`,\n );\n }\n\n appendFileSync(temporaryReportPath, runnerDumpScript(runnerDump));\n const agentComment = mergedAgentReportComment(agentReports);\n if (agentComment) {\n appendFileSync(temporaryReportPath, agentComment);\n }\n appendFileSync(temporaryReportPath, `${htmlEndTag}\\n`);\n\n if (existsSync(finalArtifactPath)) {\n rmSync(finalArtifactPath, { recursive: true, force: true });\n }\n if (existsSync(standaloneReportPath)) {\n unlinkSync(standaloneReportPath);\n }\n renameSync(\n directoryMode ? temporaryArtifactPath : temporaryReportPath,\n directoryMode ? finalArtifactPath : standaloneReportPath,\n );\n rmSync(temporaryRoot, { recursive: true, force: true });\n return finalReportPath;\n } catch (error) {\n rmSync(temporaryRoot, { recursive: true, force: true });\n throw error;\n }\n }\n}\n\nexport interface SplitReportHtmlOptions {\n htmlPath: string;\n outputDir: string;\n}\n\nexport interface SplitReportHtmlResult {\n executionJsonFiles: string[];\n screenshotFiles: string[];\n}\n\nexport interface CollectedReportExecutions {\n baseDump: ReportActionDump;\n executions: IExecutionDump[];\n}\n\n/**\n * Collect executions from a report HTML, deduplicating by stable id while\n * keeping only the latest occurrence. Old-format executions without id are\n * always preserved.\n */\nexport function collectDedupedExecutions(\n htmlPath: string,\n): CollectedReportExecutions {\n let baseDump: ReportActionDump | null = null;\n let executionSerial = 0;\n const latestSerialByExecutionId = new Map<string, number>();\n\n streamDumpScriptsSync(htmlPath, (dumpScript) => {\n if (!dumpScript.openTag.includes('data-group-id')) {\n return false;\n }\n const groupedDump = ReportActionDump.fromSerializedString(\n antiEscapeScriptTag(dumpScript.content),\n );\n for (const execution of groupedDump.executions) {\n executionSerial += 1;\n if (execution.id) {\n latestSerialByExecutionId.set(execution.id, executionSerial);\n }\n }\n return false;\n });\n\n const executions: IExecutionDump[] = [];\n executionSerial = 0;\n streamDumpScriptsSync(htmlPath, (dumpScript) => {\n if (!dumpScript.openTag.includes('data-group-id')) {\n return false;\n }\n\n const groupedDump = ReportActionDump.fromSerializedString(\n antiEscapeScriptTag(dumpScript.content),\n );\n if (!baseDump) {\n baseDump = groupedDump;\n }\n\n for (const execution of groupedDump.executions) {\n executionSerial += 1;\n if (\n execution.id &&\n latestSerialByExecutionId.get(execution.id) !== executionSerial\n ) {\n continue;\n }\n executions.push(execution);\n }\n\n return false;\n });\n\n if (!baseDump) {\n throw new Error(`No report dump scripts found in ${htmlPath}`);\n }\n\n return {\n baseDump,\n executions,\n };\n}\n\nfunction externalizeImagesInExecution(\n execution: IExecutionDump,\n opts: {\n htmlPath: string;\n screenshotsDir: string;\n writtenFiles: Set<string>;\n },\n): void {\n const visit = (node: unknown): void => {\n if (Array.isArray(node)) {\n for (const item of node) {\n visit(item);\n }\n return;\n }\n\n if (typeof node !== 'object' || node === null) return;\n\n const ref = normalizeStoredImageRef(node);\n if (ref) {\n const ext = imageRefFileExtension(ref);\n const fileName = `${ref.id}.${ext}`;\n const relativePath = `./screenshots/${fileName}`;\n const absolutePath = path.join(opts.screenshotsDir, fileName);\n\n if (!opts.writtenFiles.has(fileName)) {\n const resolved = resolveImageSource(ref, {\n reportPath: opts.htmlPath,\n });\n if (resolved.type === 'data-uri') {\n const { rawBase64 } = parseBase64ImageDataUrl(resolved.dataUri);\n writeFileSync(absolutePath, Buffer.from(rawBase64, 'base64'));\n } else {\n copyFileSync(resolved.filePath, absolutePath);\n }\n opts.writtenFiles.add(fileName);\n }\n\n ref.storage = 'file';\n ref.path = relativePath;\n return;\n }\n\n for (const value of Object.values(node)) {\n visit(value);\n }\n };\n\n visit(execution);\n}\n\n/**\n * Reverse parse a Midscene report HTML into per-execution JSON files and\n * externalized screenshots.\n */\nexport function splitReportHtmlByExecution(\n options: SplitReportHtmlOptions,\n): SplitReportHtmlResult {\n const { htmlPath, outputDir } = options;\n const screenshotsDir = path.join(outputDir, 'screenshots');\n\n mkdirSync(outputDir, { recursive: true });\n mkdirSync(screenshotsDir, { recursive: true });\n\n const executionJsonFiles: string[] = [];\n const writtenScreenshotFiles = new Set<string>();\n const { baseDump, executions } = collectDedupedExecutions(htmlPath);\n\n let fileIndex = 0;\n for (const execution of executions) {\n fileIndex += 1;\n externalizeImagesInExecution(execution, {\n htmlPath,\n screenshotsDir,\n writtenFiles: writtenScreenshotFiles,\n });\n const singleExecutionDump = new ReportActionDump({\n sdkVersion: baseDump.sdkVersion,\n groupName: baseDump.groupName,\n groupDescription: baseDump.groupDescription,\n modelBriefs: baseDump.modelBriefs,\n deviceType: baseDump.deviceType,\n executions: [execution],\n });\n\n const jsonFilePath = path.join(outputDir, `${fileIndex}.execution.json`);\n writeFileSync(jsonFilePath, singleExecutionDump.serialize(2), 'utf-8');\n executionJsonFiles.push(jsonFilePath);\n }\n\n return {\n executionJsonFiles,\n screenshotFiles: Array.from(writtenScreenshotFiles)\n .sort()\n .map((fileName) => path.join(screenshotsDir, fileName)),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","screenshotModeAttrRegExp","RegExp","DATA_SCREENSHOT_MODE_ATTR","readDeclaredScreenshotMode","reportFilePath","mode","streamDumpScriptsSync","openTag","match","isDirectoryModeReport","path","declared","existsSync","isDirectoryBasedReport","removeReportArtifact","rmSync","unlinkSync","dedupeExecutionsKeepLatest","executions","noIdCounter","deduped","Map","exec","Array","peekReportSdkVersion","dump","extractLastDumpScriptSync","warnedMismatchedVersions","Set","tryParseAgentReportDump","dumpString","trimmed","ReportActionDump","mergedAgentReportComment","reports","generateAgentReportComment","deviceTypes","report","Boolean","mergedReport","getVersion","ReportMergingTool","groupName","groupDescription","reportInfo","Error","sourceVersion","currentVersion","logMsg","contents","unescaped","c","antiEscapeScriptTag","base","allExecutions","i","other","reportFileName","opts","rmOriginalReports","overwrite","outputDir","runnerDumps","info","extractTestRunReportDumpSync","undefined","hasRunnerDump","targetDir","getMidsceneRunSubDir","mkdirSync","isDirModeByIndex","hasDirectoryModeReport","resolvedName","getReportFileName","outputFilePath","htmlEndTag","tpl","getReportTpl","htmlEndIdx","tplWithoutClose","appendFileSync","getBaseUrlFixScript","agentReports","runnerSources","writtenInlineImageIds","reportAttributes","mergedGroupId","reportDir","screenshotsDir","mergedScreenshotsDir","file","readdirSync","src","dest","copyFileSync","streamImageScriptsToFile","allDumps","extractAllDumpScriptsSync","d","groupIdMatch","decodeURIComponent","extractedDumpString","agentReport","agentReportTiming","reportHtmlStr","reportHTMLContent","metrics","collectTestRunReportMetrics","executionMetrics","execution","runnerDumpScript","mergeTestRunReportDumps","uuid","agentComment","removedReportCount","reportCountWithFilePath","error","durationMs","timing","collectReportSummary","executionTimes","value","Number","started","Math","ended","Date","validateTestRunReportFileName","fileName","uniqueTestRunReportSources","sources","unique","source","scopeId","sourcePath","prepareTestRunReportSources","loadedDumps","prepared","diagnostics","ownerByScopedExecution","preparedByPath","sourceIndex","baseDump","readFileSync","collectDedupedExecutions","String","sourceKey","shared","scoped","item","executionIds","executionId","owner","partial","collection","reportId","scopedExecution","previousOwner","preparedSource","field","status","diagnostic","TestRunReportAssembler","options","loaded","Promise","fsAsync","directoryMode","artifact","finalPath","temporary","htmlPath","parts","imageIds","serialized","refs","JSON","_key","ref","normalizeStoredImageRef","imageRefFileExtension","images","html","index","runnerDump","finalArtifactPath","directoryReportPath","standaloneReportPath","finalReportPath","existingArtifacts","temporaryRoot","mkdtempSync","temporaryArtifactPath","temporaryReportPath","template","htmlEndIndex","targetScreenshotsDir","renameSync","executionSerial","latestSerialByExecutionId","dumpScript","groupedDump","externalizeImagesInExecution","visit","node","ext","relativePath","absolutePath","resolved","resolveImageSource","rawBase64","parseBase64ImageDataUrl","writeFileSync","Buffer","splitReportHtmlByExecution","executionJsonFiles","writtenScreenshotFiles","fileIndex","singleExecutionDump","jsonFilePath"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;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CAAC8E,gBAAgBwC;IACjD;AACF"}
|
|
1
|
+
{"version":3,"file":"report.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../src/report.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\n appendFileSync,\n copyFileSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readFileSync,\n readdirSync,\n renameSync,\n rmSync,\n unlinkSync,\n writeFileSync,\n} from 'node:fs';\nimport * as fsAsync from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport { antiEscapeScriptTag, logMsg, uuid } from '@midscene/shared/utils';\nimport { getReportFileName } from './agent/report-file-name';\nimport {\n DATA_SCREENSHOT_MODE_ATTR,\n extractLastDumpScriptSync,\n generateAgentReportComment,\n getBaseUrlFixScript,\n generateTestRunReportScriptTag as runnerDumpScript,\n streamDumpScriptsSync,\n streamImageScriptsToFile,\n} from './dump/html-utils';\nimport {\n imageRefFileExtension,\n normalizeStoredImageRef,\n} from './dump/image-reference';\nimport {\n readReportArtifactManifest,\n readReportDumpScripts,\n readReportRunnerDump,\n streamReportDumpScripts,\n} from './dump/report-artifact-reader';\nimport {\n parseBase64ImageDataUrl,\n resolveImageSource,\n} from './dump/screenshot-store';\nexport {\n readReportActionDump,\n readReportArtifactManifestAsync,\n readReportArtifactManifest,\n readReportDumpScripts,\n readReportRunnerDump,\n streamReportDumpScripts,\n} from './dump/report-artifact-reader';\nexport { ExecutionRecorder } from './dump/execution-recorder';\nexport { ReportArtifactStore } from './dump/report-artifact-store';\nimport { TestReportImages } from './dump/test-report-images';\nimport { collectReportSummary } from './report-stats';\nimport type {\n AssembleTestRunReportOptions,\n IndexedTestRunReportSource,\n TestRunReportMetrics,\n TestRunReportSource,\n TestRunReportSourceIndex,\n} from './test-run-report';\nimport {\n type MergeTestRunReportSource,\n mergeTestRunReportDumps,\n} from './test-runner/reporting/merge-report';\nimport { collectTestRunReportMetrics } from './test-runner/reporting/metrics';\nimport {\n type ExecutionDump,\n type IExecutionDump,\n ReportActionDump,\n type ScreenshotMode,\n} from './types';\nimport type { ReportFileWithAttributes } from './types';\nimport { getReportTpl, getVersion, reportHTMLContent } from './utils';\n\nexport {\n calculateTestRunHealth,\n classifyTestRunCase,\n} from './test-run-health';\n\n/**\n * Read the screenshot storage mode a report declared at generation time.\n *\n * Reports written by current versions stamp `data-screenshot-mode` onto every\n * dump script tag, so we only need to peek at the first real dump script (the\n * template's bundled JS also references the dump type string, hence the\n * `data-group-id` filter) and can stop streaming immediately.\n *\n * Returns undefined for legacy reports that predate the attribute or for\n * unreadable files, letting the caller fall back to a filesystem heuristic.\n */\nconst screenshotModeAttrRegExp = new RegExp(\n `${DATA_SCREENSHOT_MODE_ATTR}=\"(inline|directory)\"`,\n);\n\nfunction readDeclaredScreenshotMode(\n reportFilePath: string,\n): ScreenshotMode | undefined {\n let mode: ScreenshotMode | undefined;\n try {\n streamDumpScriptsSync(reportFilePath, ({ openTag }) => {\n // Skip false matches from the template's bundled JS code.\n if (!openTag.includes('data-group-id')) return false;\n const match = openTag.match(screenshotModeAttrRegExp);\n mode = match?.[1] as ScreenshotMode | undefined;\n return true; // the first real dump script decides the mode\n });\n } catch {\n // Unreadable / non-existent file — let the caller fall back.\n }\n return mode;\n}\n\n/**\n * Check if a report is in directory mode (html-and-external-assets).\n * Directory mode reports: {name}/index.html + {name}/screenshots/\n *\n * The mode is read from the report's own `data-screenshot-mode` metadata, which\n * is authoritative regardless of whether the run happened to capture any\n * screenshots. For legacy reports without the attribute we fall back to the old\n * filesystem heuristic (an `index.html` that has a sibling `screenshots/` dir).\n */\nexport function isDirectoryModeReport(reportFilePath: string): boolean {\n if (readReportArtifactManifest(reportFilePath)) return true;\n // Agent directory reports use index.html by default. Reports without the\n // versioned manifest use the existing metadata and layout heuristic.\n if (path.basename(reportFilePath) !== 'index.html') return false;\n\n const declared = readDeclaredScreenshotMode(reportFilePath);\n if (declared) return declared === 'directory';\n\n // Legacy fallback for reports generated before screenshotMode was embedded.\n return existsSync(path.join(path.dirname(reportFilePath), 'screenshots'));\n}\n\n/**\n * Whether a report lives in its own dedicated directory (`{name}/index.html`)\n * rather than being a single standalone file (`{name}.html`).\n *\n * This is a structural fact about *where the report file sits*, independent of\n * how it stores screenshots: a directory report can keep screenshots external\n * (a `screenshots/` sibling) OR inline them into `index.html`. Deletion needs\n * this — not the screenshot mode — to decide whether to remove the whole\n * directory or just unlink a file, so that an inline-screenshot report nested in\n * its own folder still has the folder removed instead of being orphaned.\n */\nfunction isDirectoryBasedReport(reportFilePath: string): boolean {\n return path.basename(reportFilePath) === 'index.html';\n}\n\n/**\n * Remove a complete report artifact from disk.\n *\n * Standalone reports own only their HTML file, while directory-based reports\n * own the directory containing `index.html`. Callers must decide whether they\n * own the source artifact and should only invoke this after its replacement\n * has been produced successfully.\n *\n * @param reportFilePath Path to the standalone report or directory report's\n * `index.html` entry point.\n * @throws When the owned report artifact cannot be removed.\n */\nexport function removeReportArtifact(reportFilePath: string): void {\n if (isDirectoryBasedReport(reportFilePath)) {\n rmSync(path.dirname(reportFilePath), { recursive: true, force: true });\n return;\n }\n unlinkSync(reportFilePath);\n}\n\n/**\n * Deduplicate executions by stable id, keeping only the last occurrence.\n * Old-format executions without id are always preserved.\n */\nexport function dedupeExecutionsKeepLatest<T extends Pick<ExecutionDump, 'id'>>(\n executions: T[],\n): T[] {\n let noIdCounter = 0;\n const deduped = new Map<string, T>();\n for (const exec of executions) {\n const key = exec.id || `__no_id_${noIdCounter++}`;\n deduped.set(key, exec);\n }\n return Array.from(deduped.values());\n}\n/**\n * Peek at the first `sdkVersion` field embedded in a midscene_web_dump\n * script tag inside the given report file. Returns undefined if no\n * recognizable tag or sdkVersion is present.\n */\nfunction peekReportSdkVersion(reportFilePath: string): string | undefined {\n try {\n let dump: string | undefined;\n streamReportDumpScripts(reportFilePath, ({ content }) => {\n dump = content;\n return true;\n });\n dump ??= extractLastDumpScriptSync(reportFilePath) ?? undefined;\n if (!dump) return undefined;\n const match = dump.match(/\"sdkVersion\"\\s*:\\s*\"([^\"]+)\"/);\n return match?.[1];\n } catch {\n return undefined;\n }\n}\n\nconst warnedMismatchedVersions = new Set<string>();\n\nfunction tryParseAgentReportDump(dumpString: string): ReportActionDump | null {\n const trimmed = dumpString.trimStart();\n if (!trimmed.startsWith('{') || !trimmed.includes('\"executions\"')) {\n return null;\n }\n\n try {\n return ReportActionDump.fromSerializedString(trimmed);\n } catch {\n return null;\n }\n}\n\nfunction mergedAgentReportComment(reports: ReportActionDump[]): string {\n if (reports.length === 0) {\n return '';\n }\n if (reports.length === 1) {\n return generateAgentReportComment(reports[0]);\n }\n\n const deviceTypes = Array.from(\n new Set(reports.map((report) => report.deviceType).filter(Boolean)),\n );\n const mergedReport = new ReportActionDump({\n sdkVersion: reports[0].sdkVersion || getVersion(),\n groupName: 'Merged Midscene Report',\n groupDescription: 'Agent-readable summary for merged report HTML',\n modelBriefs: reports.flatMap((report) => report.modelBriefs ?? []),\n deviceType: deviceTypes.length === 1 ? deviceTypes[0] : 'mixed',\n executions: dedupeExecutionsKeepLatest(\n reports.flatMap((report) => report.executions ?? []),\n ),\n });\n return generateAgentReportComment(mergedReport);\n}\n\nexport class ReportMergingTool {\n private reportInfos: ReportFileWithAttributes[] = [];\n\n private createEmptyDumpString(groupName: string, groupDescription?: string) {\n return new ReportActionDump({\n sdkVersion: '',\n groupName,\n groupDescription,\n modelBriefs: [],\n executions: [],\n }).serialize();\n }\n\n public append(reportInfo: ReportFileWithAttributes) {\n if (\n !reportInfo.reportFilePath &&\n reportInfo.reportAttributes.testStatus !== 'skipped'\n ) {\n throw new Error(\n 'reportFilePath is required unless reportAttributes.testStatus is \"skipped\"',\n );\n }\n\n if (reportInfo.reportFilePath) {\n const sourceVersion = peekReportSdkVersion(reportInfo.reportFilePath);\n const currentVersion = getVersion();\n if (\n sourceVersion &&\n currentVersion &&\n sourceVersion !== currentVersion &&\n !warnedMismatchedVersions.has(sourceVersion)\n ) {\n warnedMismatchedVersions.add(sourceVersion);\n logMsg(\n `[@midscene/core] ReportMergingTool version mismatch: source report was written by @midscene/core@${sourceVersion} but the merger is @midscene/core@${currentVersion}. This commonly means @midscene/core and the device package (e.g. @midscene/android) resolve to different versions in node_modules. Merged output may silently drop intermediate steps. Align the versions and reinstall (rm -rf node_modules package-lock.json && npm install).`,\n );\n }\n }\n this.reportInfos.push(reportInfo);\n }\n public clear() {\n this.reportInfos = [];\n }\n\n /**\n * Merge multiple dump script contents (from the same source report)\n * into a single serialized ReportActionDump string.\n * If there's only one dump, return it as-is. If multiple, merge\n * all executions into the first dump's group structure.\n */\n private mergeDumpScripts(contents: string[]): string {\n const unescaped = contents\n .map((c) => antiEscapeScriptTag(c))\n .filter((c) => c.length > 0);\n if (unescaped.length === 0) return '';\n if (unescaped.length === 1) return unescaped[0];\n\n // Parse all dumps and collect executions, deduplicating by id (keep last).\n // Only executions with a stable id are deduped; old-format entries without\n // id are always kept (they may be distinct despite sharing the same name).\n const base = ReportActionDump.fromSerializedString(unescaped[0]);\n const allExecutions = [...base.executions];\n for (let i = 1; i < unescaped.length; i++) {\n const other = ReportActionDump.fromSerializedString(unescaped[i]);\n allExecutions.push(...other.executions);\n }\n base.executions = dedupeExecutionsKeepLatest(allExecutions);\n return base.serialize();\n }\n\n public mergeReports(\n reportFileName: 'AUTO' | string = 'AUTO',\n opts?: {\n rmOriginalReports?: boolean;\n overwrite?: boolean;\n outputDir?: string;\n },\n ): string | null {\n const {\n rmOriginalReports = false,\n overwrite = false,\n outputDir,\n } = opts ?? {};\n\n if (this.reportInfos.length === 0) {\n logMsg('No reports to merge');\n return null;\n }\n\n const runnerDumps = this.reportInfos.map((info) =>\n info.reportFilePath\n ? readReportRunnerDump(info.reportFilePath)\n : undefined,\n );\n const hasRunnerDump = runnerDumps.some(Boolean);\n\n const targetDir = outputDir\n ? path.resolve(outputDir)\n : getMidsceneRunSubDir('report');\n if (outputDir) {\n mkdirSync(targetDir, { recursive: true });\n }\n\n // Resolve each report's screenshot mode exactly once. isDirectoryModeReport\n // reads the file to find the authoritative metadata, so recomputing it for\n // both the output-path decision and the per-report merge loop would re-scan\n // every report twice.\n const isDirModeByIndex = this.reportInfos.map((info) =>\n Boolean(\n info.reportFilePath && isDirectoryModeReport(info.reportFilePath),\n ),\n );\n const hasDirectoryModeReport = isDirModeByIndex.some(Boolean);\n\n const resolvedName =\n reportFileName === 'AUTO'\n ? getReportFileName('merged-report')\n : reportFileName;\n\n // Directory mode: output as {name}/index.html to keep relative paths working\n // Inline mode: output as {name}.html (single file)\n const outputFilePath = hasDirectoryModeReport\n ? path.resolve(targetDir, resolvedName, 'index.html')\n : path.resolve(targetDir, `${resolvedName}.html`);\n\n if (reportFileName !== 'AUTO' && existsSync(outputFilePath)) {\n if (!overwrite) {\n throw new Error(\n `Report file already exists: ${outputFilePath}\\nSet overwrite to true to overwrite this file.`,\n );\n }\n if (hasDirectoryModeReport) {\n rmSync(path.dirname(outputFilePath), { recursive: true, force: true });\n } else {\n unlinkSync(outputFilePath);\n }\n }\n\n if (hasDirectoryModeReport) {\n mkdirSync(path.dirname(outputFilePath), { recursive: true });\n }\n\n logMsg(\n `Start merging ${this.reportInfos.length} reports...\\nCreating template file...`,\n );\n\n try {\n // Write template without closing </html> tag so we can append\n // dump scripts before it. The closing tag is added at the end.\n const htmlEndTag = '</html>';\n const tpl = getReportTpl();\n const htmlEndIdx = tpl.lastIndexOf(htmlEndTag);\n const tplWithoutClose =\n htmlEndIdx !== -1 ? tpl.slice(0, htmlEndIdx) : tpl;\n appendFileSync(outputFilePath, tplWithoutClose);\n\n // For directory-mode output, inject base URL fix script\n if (hasDirectoryModeReport) {\n appendFileSync(outputFilePath, getBaseUrlFixScript());\n }\n\n const agentReports: ReportActionDump[] = [];\n const runnerSources: MergeTestRunReportSource[] = [];\n const writtenInlineImageIds = new Set<string>();\n\n // Process all reports one by one\n for (let i = 0; i < this.reportInfos.length; i++) {\n const reportInfo = this.reportInfos[i];\n logMsg(`Processing report ${i + 1}/${this.reportInfos.length}`);\n\n const { reportAttributes } = reportInfo;\n let dumpString = this.createEmptyDumpString(\n reportAttributes.testTitle,\n reportAttributes.testDescription,\n );\n let mergedGroupId = `merged-group-${i}`;\n\n if (reportInfo.reportFilePath) {\n if (isDirModeByIndex[i]) {\n // Directory mode: copy external screenshot files. A directory-mode\n // report can legitimately have no screenshots/ dir (a run that\n // captured nothing), so only copy when the source dir exists.\n const reportDir = path.dirname(reportInfo.reportFilePath);\n const screenshotsDir = path.join(reportDir, 'screenshots');\n if (existsSync(screenshotsDir)) {\n const mergedScreenshotsDir = path.join(\n path.dirname(outputFilePath),\n 'screenshots',\n );\n mkdirSync(mergedScreenshotsDir, { recursive: true });\n for (const file of readdirSync(screenshotsDir)) {\n const src = path.join(screenshotsDir, file);\n const dest = path.join(mergedScreenshotsDir, file);\n copyFileSync(src, dest);\n }\n }\n } else {\n // Inline mode: stream image scripts to output file\n streamImageScriptsToFile(\n reportInfo.reportFilePath,\n outputFilePath,\n writtenInlineImageIds,\n );\n }\n\n // Extract all dump scripts from the source report.\n // After the per-execution append refactor, a single source report\n // may contain multiple <script type=\"midscene_web_dump\"> tags\n // (one per execution). We merge them into a single ReportActionDump.\n // Filter by data-group-id to exclude false matches from the template's\n // bundled JS code, which also references the midscene_web_dump type string.\n const allDumps = readReportDumpScripts(\n reportInfo.reportFilePath,\n ).filter((d) => d.openTag.includes('data-group-id'));\n const groupIdMatch = allDumps[0]?.openTag.match(\n /data-group-id=\"([^\"]+)\"/,\n );\n if (groupIdMatch && !hasRunnerDump) {\n mergedGroupId = decodeURIComponent(groupIdMatch[1]);\n }\n const extractedDumpString =\n allDumps.length > 0\n ? this.mergeDumpScripts(allDumps.map((d) => d.content))\n : extractLastDumpScriptSync(reportInfo.reportFilePath);\n if (extractedDumpString) {\n dumpString = extractedDumpString;\n }\n }\n\n const agentReport = tryParseAgentReportDump(dumpString);\n if (agentReport) {\n agentReports.push(agentReport);\n }\n if (hasRunnerDump)\n runnerSources.push({\n reportId: mergedGroupId,\n sourcePath: reportInfo.reportFilePath ?? '<skipped-agent-report>',\n attributes: reportAttributes,\n dump: runnerDumps[i],\n timing: agentReport\n ? agentReportTiming(agentReport, reportAttributes.testDuration)\n : undefined,\n });\n\n const reportHtmlStr = `${reportHTMLContent(\n {\n dumpString,\n attributes: {\n 'data-group-id': mergedGroupId,\n ...(hasRunnerDump ? { 'data-report-id': mergedGroupId } : {}),\n [DATA_SCREENSHOT_MODE_ATTR]: hasDirectoryModeReport\n ? 'directory'\n : 'inline',\n playwright_test_duration: reportAttributes.testDuration,\n playwright_test_status: reportAttributes.testStatus,\n playwright_test_title: reportAttributes.testTitle,\n playwright_test_id: reportAttributes.testId,\n playwright_test_description: reportAttributes.testDescription,\n is_merged: true,\n },\n },\n undefined,\n undefined,\n false,\n )}\\n`;\n\n appendFileSync(outputFilePath, reportHtmlStr);\n }\n\n if (hasRunnerDump) {\n const executions = dedupeExecutionsKeepLatest(\n agentReports.flatMap((report) => report.executions),\n );\n const metrics = collectTestRunReportMetrics({ executions });\n const executionMetrics = Object.fromEntries(\n executions.flatMap((execution) =>\n execution.id\n ? [\n [\n execution.id,\n collectTestRunReportMetrics({ executions: [execution] }),\n ],\n ]\n : [],\n ),\n );\n appendFileSync(\n outputFilePath,\n runnerDumpScript(\n mergeTestRunReportDumps(\n runnerSources,\n metrics,\n uuid(),\n executionMetrics,\n ),\n ),\n );\n }\n\n const agentComment = mergedAgentReportComment(agentReports);\n if (agentComment) {\n appendFileSync(outputFilePath, agentComment);\n }\n\n // Close the HTML document\n appendFileSync(outputFilePath, `${htmlEndTag}\\n`);\n\n logMsg(`Successfully merged new report: ${outputFilePath}`);\n\n // Remove original reports if needed\n if (rmOriginalReports) {\n let removedReportCount = 0;\n let reportCountWithFilePath = 0;\n for (const info of this.reportInfos) {\n if (!info.reportFilePath) continue;\n reportCountWithFilePath += 1;\n try {\n removeReportArtifact(info.reportFilePath);\n removedReportCount += 1;\n } catch (error) {\n logMsg(`Error deleting report ${info.reportFilePath}: ${error}`);\n }\n }\n logMsg(\n `Removed ${removedReportCount}/${reportCountWithFilePath} original reports`,\n );\n }\n return outputFilePath;\n } catch (error) {\n logMsg(`Error in mergeReports: ${error}`);\n throw error;\n }\n }\n}\n\nfunction agentReportTiming(\n report: ReportActionDump,\n durationMs: number,\n): MergeTestRunReportSource['timing'] {\n const timing = collectReportSummary(report).timing;\n const executionTimes = report.executions\n .map((execution) => execution.logTime)\n .filter(\n (value): value is number =>\n typeof value === 'number' && Number.isFinite(value),\n );\n const started =\n timing.wallTimeStart ??\n (executionTimes.length ? Math.min(...executionTimes) : undefined);\n if (started === undefined) return undefined;\n const ended =\n timing.wallTimeEnd ??\n Math.max(\n ...executionTimes,\n started + (Number.isFinite(durationMs) ? Math.max(0, durationMs) : 0),\n );\n return {\n startedAt: new Date(started).toISOString(),\n endedAt: new Date(ended).toISOString(),\n durationMs: Math.max(0, ended - started),\n };\n}\n\ninterface PreparedTestRunReportSource extends IndexedTestRunReportSource {\n dump: ReportActionDump;\n dumpPath?: string;\n}\n\nconst validateTestRunReportFileName = (fileName: string): void => {\n if (\n !fileName ||\n fileName === '.' ||\n fileName === '..' ||\n path.basename(fileName) !== fileName ||\n fileName.endsWith('.html')\n ) {\n throw new Error(\n `Midscene Test reportFileName must be one path segment without an extension: ${fileName}`,\n );\n }\n};\n\nconst uniqueTestRunReportSources = (\n sources: readonly TestRunReportSource[],\n): TestRunReportSource[] => {\n const unique = new Map<string, TestRunReportSource>();\n\n for (const source of sources) {\n const scopeId = source.scopeId.trim();\n const sourcePath = path.resolve(source.sourcePath);\n if (!scopeId) {\n throw new Error('Midscene Test report source scopeId must not be empty.');\n }\n\n unique.set(`${scopeId}\\u0000${source.dumpPath ?? sourcePath}`, {\n ...source,\n scopeId,\n sourcePath,\n });\n }\n\n return [...unique.values()];\n};\n\nconst prepareTestRunReportSources = (\n sources: readonly TestRunReportSource[],\n loadedDumps?: ReadonlyMap<string, string | Error>,\n): {\n sources: PreparedTestRunReportSource[];\n metrics: TestRunReportMetrics;\n capturedMetrics: TestRunReportMetrics;\n executionMetrics: Record<string, TestRunReportMetrics>;\n diagnostics: import('./test-run-report').TestRunReportDiagnostic[];\n} => {\n const prepared: PreparedTestRunReportSource[] = [];\n const diagnostics: import('./test-run-report').TestRunReportDiagnostic[] = [];\n const ownerByScopedExecution = new Map<string, string>();\n const preparedByPath = new Map<string, PreparedTestRunReportSource>();\n\n for (const [sourceIndex, source] of uniqueTestRunReportSources(\n sources,\n ).entries()) {\n let baseDump: ReportActionDump;\n let executions: IExecutionDump[];\n try {\n if (source.dumpPath) {\n const contents =\n loadedDumps?.get(source.dumpPath) ??\n readFileSync(source.dumpPath, 'utf8');\n if (contents instanceof Error) throw contents;\n baseDump = ReportActionDump.fromSerializedString(contents);\n executions = baseDump.executions;\n } else {\n if (!existsSync(source.sourcePath))\n throw new Error(`Agent report does not exist: ${source.sourcePath}`);\n const sourceVersion = peekReportSdkVersion(source.sourcePath);\n const currentVersion = getVersion();\n if (\n sourceVersion &&\n currentVersion &&\n sourceVersion !== currentVersion &&\n !warnedMismatchedVersions.has(sourceVersion)\n ) {\n warnedMismatchedVersions.add(sourceVersion);\n logMsg(\n `[@midscene/core] TestRunReportAssembler version mismatch: source report was written by @midscene/core@${sourceVersion} but the assembler is @midscene/core@${currentVersion}. Align the workspace package versions before generating the Midscene Test report.`,\n );\n }\n ({ baseDump, executions } = collectDedupedExecutions(\n source.sourcePath,\n ));\n }\n } catch (error) {\n diagnostics.push({\n level: 'warning',\n code: 'agent-source-unavailable',\n scopeId: source.scopeId,\n sourcePaths: [source.sourcePath],\n message: `Agent source could not be collected: ${String(error)}`,\n });\n continue;\n }\n // A borrowed Agent can serve several sequential test scopes. Reuse its\n // report group and metrics while indexing each scope's execution links.\n const sourceKey = source.sourcePath;\n const shared = preparedByPath.get(sourceKey);\n if (shared) {\n if (source.dumpPath) {\n shared.dump.executions = dedupeExecutionsKeepLatest([\n ...shared.dump.executions,\n ...baseDump.executions,\n ]);\n }\n const scoped = prepared.find(\n (item) =>\n item.reportId === shared.reportId && item.scopeId === source.scopeId,\n );\n const executionIds = [\n ...new Set([\n ...(scoped?.executionIds ?? []),\n ...executions.flatMap((execution) =>\n execution.id ? [execution.id] : [],\n ),\n ]),\n ];\n for (const executionId of executionIds) {\n const key = `${source.scopeId}\\u0000${executionId}`;\n const owner = ownerByScopedExecution.get(key);\n if (owner && owner !== shared.reportId)\n throw new Error(\n `Agent execution ${executionId} is present in multiple reports for test scope ${source.scopeId}: ${owner}, ${shared.reportId}`,\n );\n ownerByScopedExecution.set(key, shared.reportId);\n }\n if (scoped) {\n scoped.executionIds = executionIds;\n const partial = [scoped.collection, source.collection].find(\n (collection) => collection?.status === 'partial',\n );\n scoped.collection = partial ?? source.collection ?? scoped.collection;\n } else\n prepared.push({\n ...shared,\n scopeId: source.scopeId,\n executionIds,\n collection: source.collection,\n });\n continue;\n }\n const reportId = `runner-report-${sourceIndex + 1}`;\n const executionIds: string[] = [];\n for (const execution of executions) {\n if (!execution.id) continue;\n const scopedExecution = `${source.scopeId}\\u0000${execution.id}`;\n const previousOwner = ownerByScopedExecution.get(scopedExecution);\n if (previousOwner && previousOwner !== reportId) {\n throw new Error(\n `Agent execution ${execution.id} is present in multiple reports for test scope ${source.scopeId}: ${previousOwner}, ${reportId}`,\n );\n }\n ownerByScopedExecution.set(scopedExecution, reportId);\n executionIds.push(execution.id);\n }\n\n const dump = new ReportActionDump({\n sdkVersion: baseDump.sdkVersion,\n groupName: baseDump.groupName,\n groupDescription: baseDump.groupDescription,\n modelBriefs: baseDump.modelBriefs,\n deviceType: baseDump.deviceType,\n executions,\n });\n const preparedSource = {\n reportId,\n scopeId: source.scopeId,\n sourcePath: source.sourcePath,\n executionIds,\n collection: source.collection,\n dump,\n ...(source.dumpPath ? { dumpPath: source.dumpPath } : {}),\n };\n prepared.push(preparedSource);\n preparedByPath.set(sourceKey, preparedSource);\n }\n\n // A legacy invocation can preserve a snapshot of an Agent also used by\n // native scopes. Count stable executions once across both paths.\n const executions = dedupeExecutionsKeepLatest(\n [...preparedByPath.values()].flatMap((source) => source.dump.executions),\n );\n const metrics = collectTestRunReportMetrics({ executions });\n const executionMetrics = Object.fromEntries(\n executions.flatMap((execution) =>\n execution.id\n ? [\n [\n execution.id,\n collectTestRunReportMetrics({ executions: [execution] }),\n ],\n ]\n : [],\n ),\n );\n return {\n sources: prepared,\n diagnostics,\n capturedMetrics: metrics,\n executionMetrics,\n metrics: {\n ...metrics,\n collection: {\n ...metrics.collection!,\n fields: Object.fromEntries(\n Object.entries(metrics.collection!.fields!).map(([field, status]) => [\n field,\n diagnostics.length\n ? prepared.length === 0\n ? 'unknown'\n : status === 'complete'\n ? 'partial'\n : status\n : status,\n ]),\n ) as NonNullable<\n NonNullable<TestRunReportMetrics['collection']>['fields']\n >,\n status: diagnostics.length\n ? prepared.length\n ? 'partial'\n : 'unknown'\n : metrics.collection!.status,\n expectedExecutionCount: 0,\n capturedExecutionCount: 0,\n reasons: [\n ...metrics.collection!.reasons,\n ...diagnostics.map((diagnostic) => diagnostic.message),\n ],\n },\n },\n };\n};\n\n/**\n * Build a self-contained Midscene Test report while preserving the existing\n * Agent dump format consumed by the Report App.\n *\n * Test hierarchy and status live in `midscene_test_run_dump`; Agent reports\n * remain independent `midscene_web_dump` groups addressed by `data-report-id`.\n */\nexport class TestRunReportAssembler {\n /** Runtime publisher: current Agent snapshots avoid parsing HTML or copying unused images. */\n public async assembleAsync(\n options: AssembleTestRunReportOptions,\n ): Promise<string> {\n validateTestRunReportFileName(options.reportFileName);\n const loaded = new Map<string, string | Error>();\n await Promise.all(\n options.sources.map(async (source) => {\n if (source.dumpPath) {\n try {\n loaded.set(\n source.dumpPath,\n await fsAsync.readFile(source.dumpPath, 'utf8'),\n );\n } catch (error) {\n loaded.set(\n source.dumpPath,\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n }\n }),\n );\n const prepared = prepareTestRunReportSources(options.sources, loaded);\n const dump = options.buildRunnerDump({\n sources: prepared.sources,\n metrics: prepared.metrics,\n capturedMetrics: prepared.capturedMetrics,\n executionMetrics: prepared.executionMetrics,\n diagnostics: prepared.diagnostics,\n });\n if (dump.kind !== 'test-runner' || dump.schemaVersion !== 1)\n throw new Error('Invalid Runner report dump');\n const directoryMode = options.outputFormat === 'html-and-external-assets';\n const outputDir = path.resolve(options.outputDir);\n await fsAsync.mkdir(outputDir, { recursive: true });\n const artifact = path.join(outputDir, options.reportFileName);\n const finalPath = directoryMode\n ? path.join(artifact, 'index.html')\n : `${artifact}.html`;\n if (\n !options.overwrite &&\n (existsSync(artifact) || existsSync(`${artifact}.html`))\n )\n throw new Error(`Report artifact already exists: ${artifact}`);\n const temporary = await fsAsync.mkdtemp(\n path.join(outputDir, '.test-run-report-'),\n );\n const htmlPath = path.join(temporary, 'index.html');\n try {\n await fsAsync.writeFile(htmlPath, getReportTpl());\n if (directoryMode)\n await fsAsync.appendFile(htmlPath, getBaseUrlFixScript());\n const images = new TestReportImages(htmlPath, directoryMode);\n const reports: ReportActionDump[] = [];\n for (const source of new Map(\n prepared.sources.map((source) => [source.reportId, source]),\n ).values()) {\n const serialized = await images.rewriteAsync(\n source.dump.serialize(),\n source.dumpPath ?? source.sourcePath,\n );\n reports.push(source.dump);\n await fsAsync.appendFile(\n htmlPath,\n reportHTMLContent(\n {\n dumpString: serialized,\n attributes: {\n 'data-group-id': source.reportId,\n 'data-report-id': source.reportId,\n 'data-runner-scope-id': source.scopeId,\n [DATA_SCREENSHOT_MODE_ATTR]: directoryMode\n ? 'directory'\n : 'inline',\n },\n },\n undefined,\n undefined,\n false,\n ),\n );\n }\n await fsAsync.appendFile(\n htmlPath,\n runnerDumpScript(dump) + mergedAgentReportComment(reports),\n );\n if (options.overwrite) {\n await fsAsync.rm(artifact, { recursive: true, force: true });\n await fsAsync.rm(`${artifact}.html`, { force: true });\n }\n await fsAsync.rename(\n directoryMode ? temporary : htmlPath,\n directoryMode ? artifact : finalPath,\n );\n return finalPath;\n } finally {\n await fsAsync.rm(temporary, { recursive: true, force: true });\n }\n }\n\n public assemble(options: AssembleTestRunReportOptions): string {\n validateTestRunReportFileName(options.reportFileName);\n const outputDir = path.resolve(options.outputDir);\n mkdirSync(outputDir, { recursive: true });\n\n const prepared = prepareTestRunReportSources(options.sources);\n const index: TestRunReportSourceIndex = {\n sources: prepared.sources.map(\n ({ reportId, scopeId, sourcePath, executionIds, collection }) => ({\n reportId,\n scopeId,\n sourcePath,\n executionIds,\n collection,\n }),\n ),\n metrics: prepared.metrics,\n capturedMetrics: prepared.capturedMetrics,\n executionMetrics: prepared.executionMetrics,\n diagnostics: prepared.diagnostics,\n };\n const runnerDump = options.buildRunnerDump(index);\n if (runnerDump.schemaVersion !== 1 || runnerDump.kind !== 'test-runner') {\n throw new Error(\n 'buildRunnerDump must return a Midscene Test report dump with schemaVersion 1 and kind \"test-runner\".',\n );\n }\n // Validate serializability before creating any output artifact.\n JSON.stringify(runnerDump);\n\n const directoryMode = options.outputFormat === 'html-and-external-assets';\n const finalArtifactPath = path.join(outputDir, options.reportFileName);\n const directoryReportPath = path.join(finalArtifactPath, 'index.html');\n const standaloneReportPath = `${finalArtifactPath}.html`;\n const finalReportPath = directoryMode\n ? directoryReportPath\n : standaloneReportPath;\n const existingArtifacts = [finalArtifactPath, standaloneReportPath].filter(\n existsSync,\n );\n if (existingArtifacts.length > 0 && !options.overwrite) {\n throw new Error(\n `Report artifact already exists: ${existingArtifacts[0]}\\nSet overwrite to true to overwrite this report.`,\n );\n }\n\n const temporaryRoot = mkdtempSync(\n path.join(outputDir, '.test-run-report-'),\n );\n const temporaryArtifactPath = path.join(\n temporaryRoot,\n options.reportFileName,\n );\n const temporaryReportPath = directoryMode\n ? path.join(temporaryArtifactPath, 'index.html')\n : `${temporaryArtifactPath}.html`;\n\n try {\n if (directoryMode) {\n mkdirSync(temporaryArtifactPath, { recursive: true });\n }\n\n const htmlEndTag = '</html>';\n const template = getReportTpl();\n const htmlEndIndex = template.lastIndexOf(htmlEndTag);\n appendFileSync(\n temporaryReportPath,\n htmlEndIndex === -1 ? template : template.slice(0, htmlEndIndex),\n );\n if (directoryMode) {\n appendFileSync(temporaryReportPath, getBaseUrlFixScript());\n }\n\n const images = new TestReportImages(temporaryReportPath, directoryMode);\n const agentReports: ReportActionDump[] = [];\n for (const source of new Map(\n prepared.sources.map((source) => [source.reportId, source]),\n ).values()) {\n const serialized = images.rewriteSync(\n source.dump.serialize(),\n source.dumpPath ?? source.sourcePath,\n );\n\n agentReports.push(source.dump);\n appendFileSync(\n temporaryReportPath,\n `${reportHTMLContent(\n {\n dumpString: serialized,\n attributes: {\n 'data-group-id': source.reportId,\n 'data-report-id': source.reportId,\n 'data-runner-scope-id': source.scopeId,\n [DATA_SCREENSHOT_MODE_ATTR]: directoryMode\n ? 'directory'\n : 'inline',\n },\n },\n undefined,\n undefined,\n false,\n )}\\n`,\n );\n }\n\n appendFileSync(temporaryReportPath, runnerDumpScript(runnerDump));\n const agentComment = mergedAgentReportComment(agentReports);\n if (agentComment) {\n appendFileSync(temporaryReportPath, agentComment);\n }\n appendFileSync(temporaryReportPath, `${htmlEndTag}\\n`);\n\n if (existsSync(finalArtifactPath)) {\n rmSync(finalArtifactPath, { recursive: true, force: true });\n }\n if (existsSync(standaloneReportPath)) {\n unlinkSync(standaloneReportPath);\n }\n renameSync(\n directoryMode ? temporaryArtifactPath : temporaryReportPath,\n directoryMode ? finalArtifactPath : standaloneReportPath,\n );\n rmSync(temporaryRoot, { recursive: true, force: true });\n return finalReportPath;\n } catch (error) {\n rmSync(temporaryRoot, { recursive: true, force: true });\n throw error;\n }\n }\n}\n\nexport interface SplitReportHtmlOptions {\n htmlPath: string;\n outputDir: string;\n}\n\nexport interface SplitReportHtmlResult {\n executionJsonFiles: string[];\n screenshotFiles: string[];\n}\n\nexport interface CollectedReportExecutions {\n baseDump: ReportActionDump;\n executions: IExecutionDump[];\n}\n\n/**\n * Collect executions from a report HTML, deduplicating by stable id while\n * keeping only the latest occurrence. Old-format executions without id are\n * always preserved.\n */\nexport function collectDedupedExecutions(\n htmlPath: string,\n): CollectedReportExecutions {\n let baseDump: ReportActionDump | null = null;\n let executionSerial = 0;\n const latestSerialByExecutionId = new Map<string, number>();\n\n streamReportDumpScripts(htmlPath, (dumpScript) => {\n if (!dumpScript.openTag.includes('data-group-id')) {\n return false;\n }\n const groupedDump = ReportActionDump.fromSerializedString(\n antiEscapeScriptTag(dumpScript.content),\n );\n for (const execution of groupedDump.executions) {\n executionSerial += 1;\n if (execution.id) {\n latestSerialByExecutionId.set(execution.id, executionSerial);\n }\n }\n return false;\n });\n\n const executions: IExecutionDump[] = [];\n executionSerial = 0;\n streamReportDumpScripts(htmlPath, (dumpScript) => {\n if (!dumpScript.openTag.includes('data-group-id')) {\n return false;\n }\n\n const groupedDump = ReportActionDump.fromSerializedString(\n antiEscapeScriptTag(dumpScript.content),\n );\n if (!baseDump) {\n baseDump = groupedDump;\n }\n\n for (const execution of groupedDump.executions) {\n executionSerial += 1;\n if (\n execution.id &&\n latestSerialByExecutionId.get(execution.id) !== executionSerial\n ) {\n continue;\n }\n executions.push(execution);\n }\n\n return false;\n });\n\n if (!baseDump) {\n throw new Error(`No report dump scripts found in ${htmlPath}`);\n }\n\n return {\n baseDump,\n executions,\n };\n}\n\nfunction externalizeImagesInExecution(\n execution: IExecutionDump,\n opts: {\n htmlPath: string;\n screenshotsDir: string;\n writtenFiles: Set<string>;\n },\n): void {\n const visit = (node: unknown): void => {\n if (Array.isArray(node)) {\n for (const item of node) {\n visit(item);\n }\n return;\n }\n\n if (typeof node !== 'object' || node === null) return;\n\n const ref = normalizeStoredImageRef(node);\n if (ref) {\n const ext = imageRefFileExtension(ref);\n const fileName = `${ref.id}.${ext}`;\n const relativePath = `./screenshots/${fileName}`;\n const absolutePath = path.join(opts.screenshotsDir, fileName);\n\n if (!opts.writtenFiles.has(fileName)) {\n const resolved = resolveImageSource(ref, {\n reportPath: opts.htmlPath,\n });\n if (resolved.type === 'data-uri') {\n const { rawBase64 } = parseBase64ImageDataUrl(resolved.dataUri);\n writeFileSync(absolutePath, Buffer.from(rawBase64, 'base64'));\n } else {\n copyFileSync(resolved.filePath, absolutePath);\n }\n opts.writtenFiles.add(fileName);\n }\n\n ref.storage = 'file';\n ref.path = relativePath;\n return;\n }\n\n for (const value of Object.values(node)) {\n visit(value);\n }\n };\n\n visit(execution);\n}\n\n/**\n * Reverse parse a Midscene report HTML into per-execution JSON files and\n * externalized screenshots.\n */\nexport function splitReportHtmlByExecution(\n options: SplitReportHtmlOptions,\n): SplitReportHtmlResult {\n const { htmlPath, outputDir } = options;\n const screenshotsDir = path.join(outputDir, 'screenshots');\n\n mkdirSync(outputDir, { recursive: true });\n mkdirSync(screenshotsDir, { recursive: true });\n\n const executionJsonFiles: string[] = [];\n const writtenScreenshotFiles = new Set<string>();\n const { baseDump, executions } = collectDedupedExecutions(htmlPath);\n\n let fileIndex = 0;\n for (const execution of executions) {\n fileIndex += 1;\n externalizeImagesInExecution(execution, {\n htmlPath,\n screenshotsDir,\n writtenFiles: writtenScreenshotFiles,\n });\n const singleExecutionDump = new ReportActionDump({\n sdkVersion: baseDump.sdkVersion,\n groupName: baseDump.groupName,\n groupDescription: baseDump.groupDescription,\n modelBriefs: baseDump.modelBriefs,\n deviceType: baseDump.deviceType,\n executions: [execution],\n });\n\n const jsonFilePath = path.join(outputDir, `${fileIndex}.execution.json`);\n writeFileSync(jsonFilePath, singleExecutionDump.serialize(2), 'utf-8');\n executionJsonFiles.push(jsonFilePath);\n }\n\n return {\n executionJsonFiles,\n screenshotFiles: Array.from(writtenScreenshotFiles)\n .sort()\n .map((fileName) => path.join(screenshotsDir, fileName)),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","screenshotModeAttrRegExp","RegExp","DATA_SCREENSHOT_MODE_ATTR","readDeclaredScreenshotMode","reportFilePath","mode","streamDumpScriptsSync","openTag","match","isDirectoryModeReport","readReportArtifactManifest","path","declared","existsSync","isDirectoryBasedReport","removeReportArtifact","rmSync","unlinkSync","dedupeExecutionsKeepLatest","executions","noIdCounter","deduped","Map","exec","Array","peekReportSdkVersion","dump","streamReportDumpScripts","content","extractLastDumpScriptSync","undefined","warnedMismatchedVersions","Set","tryParseAgentReportDump","dumpString","trimmed","ReportActionDump","mergedAgentReportComment","reports","generateAgentReportComment","deviceTypes","report","Boolean","mergedReport","getVersion","ReportMergingTool","groupName","groupDescription","reportInfo","Error","sourceVersion","currentVersion","logMsg","contents","unescaped","c","antiEscapeScriptTag","base","allExecutions","i","other","reportFileName","opts","rmOriginalReports","overwrite","outputDir","runnerDumps","info","readReportRunnerDump","hasRunnerDump","targetDir","getMidsceneRunSubDir","mkdirSync","isDirModeByIndex","hasDirectoryModeReport","resolvedName","getReportFileName","outputFilePath","htmlEndTag","tpl","getReportTpl","htmlEndIdx","tplWithoutClose","appendFileSync","getBaseUrlFixScript","agentReports","runnerSources","writtenInlineImageIds","reportAttributes","mergedGroupId","reportDir","screenshotsDir","mergedScreenshotsDir","file","readdirSync","src","dest","copyFileSync","streamImageScriptsToFile","allDumps","readReportDumpScripts","d","groupIdMatch","decodeURIComponent","extractedDumpString","agentReport","agentReportTiming","reportHtmlStr","reportHTMLContent","metrics","collectTestRunReportMetrics","executionMetrics","execution","runnerDumpScript","mergeTestRunReportDumps","uuid","agentComment","removedReportCount","reportCountWithFilePath","error","durationMs","timing","collectReportSummary","executionTimes","value","Number","started","Math","ended","Date","validateTestRunReportFileName","fileName","uniqueTestRunReportSources","sources","unique","source","scopeId","sourcePath","prepareTestRunReportSources","loadedDumps","prepared","diagnostics","ownerByScopedExecution","preparedByPath","sourceIndex","baseDump","readFileSync","collectDedupedExecutions","String","sourceKey","shared","scoped","item","executionIds","executionId","owner","partial","collection","reportId","scopedExecution","previousOwner","preparedSource","field","status","diagnostic","TestRunReportAssembler","options","loaded","Promise","fsAsync","directoryMode","artifact","finalPath","temporary","htmlPath","images","TestReportImages","serialized","index","runnerDump","JSON","finalArtifactPath","directoryReportPath","standaloneReportPath","finalReportPath","existingArtifacts","temporaryRoot","mkdtempSync","temporaryArtifactPath","temporaryReportPath","template","htmlEndIndex","renameSync","executionSerial","latestSerialByExecutionId","dumpScript","groupedDump","externalizeImagesInExecution","visit","node","ref","normalizeStoredImageRef","ext","imageRefFileExtension","relativePath","absolutePath","resolved","resolveImageSource","rawBase64","parseBase64ImageDataUrl","writeFileSync","Buffer","splitReportHtmlByExecution","executionJsonFiles","writtenScreenshotFiles","fileIndex","singleExecutionDump","jsonFilePath"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IA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