@midscene/core 1.12.10-beta-20260920031616.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/agent/agent.mjs +103 -6
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/index.mjs +4 -3
- package/dist/es/agent/tasks.mjs +2 -2
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/test-runner-nodes.mjs +291 -40
- package/dist/es/agent/test-runner-nodes.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/device/index.mjs +15 -2
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/dump/html-utils.mjs +37 -4
- package/dist/es/dump/html-utils.mjs.map +1 -1
- package/dist/es/dump/screenshot-store.mjs +8 -1
- package/dist/es/dump/screenshot-store.mjs.map +1 -1
- package/dist/es/report-cli.mjs +9 -4
- package/dist/es/report-cli.mjs.map +1 -1
- package/dist/es/report-generator.mjs +117 -4
- package/dist/es/report-generator.mjs.map +1 -1
- package/dist/es/report-html-template.mjs +1 -1
- package/dist/es/report.mjs +190 -41
- package/dist/es/report.mjs.map +1 -1
- package/dist/es/test-run-report.mjs.map +1 -1
- package/dist/es/test-runner/engine/case-runner.mjs +52 -0
- package/dist/es/test-runner/engine/case-runner.mjs.map +1 -0
- package/dist/es/test-runner/engine/document-runtime.mjs +273 -0
- package/dist/es/test-runner/engine/document-runtime.mjs.map +1 -0
- package/dist/es/test-runner/engine/execute-step.mjs +177 -0
- package/dist/es/test-runner/engine/execute-step.mjs.map +1 -0
- package/dist/es/test-runner/engine/execution-failure.mjs +39 -0
- package/dist/es/test-runner/engine/execution-failure.mjs.map +1 -0
- package/dist/es/test-runner/engine/index.mjs +12 -0
- package/dist/es/test-runner/engine/project-runtime.mjs +142 -0
- package/dist/es/test-runner/engine/project-runtime.mjs.map +1 -0
- package/dist/es/test-runner/engine/registry.mjs +61 -0
- package/dist/es/test-runner/engine/registry.mjs.map +1 -0
- package/dist/es/test-runner/engine/resource-operations.mjs +211 -0
- package/dist/es/test-runner/engine/resource-operations.mjs.map +1 -0
- package/dist/es/test-runner/engine/run-collected-case.mjs +193 -0
- package/dist/es/test-runner/engine/run-collected-case.mjs.map +1 -0
- package/dist/es/test-runner/engine/run-workflow-document.mjs +155 -0
- package/dist/es/test-runner/engine/run-workflow-document.mjs.map +1 -0
- package/dist/es/test-runner/engine/scheduler.mjs +27 -0
- package/dist/es/test-runner/engine/scheduler.mjs.map +1 -0
- package/dist/es/test-runner/engine/scope-teardown.mjs +16 -0
- package/dist/es/test-runner/engine/scope-teardown.mjs.map +1 -0
- package/dist/es/test-runner/engine/types.mjs +0 -0
- package/dist/es/test-runner/errors.mjs +201 -0
- package/dist/es/test-runner/errors.mjs.map +1 -0
- package/dist/es/test-runner/execution-record.mjs +83 -0
- package/dist/es/test-runner/execution-record.mjs.map +1 -0
- package/dist/es/test-runner/index.mjs +12 -0
- package/dist/es/test-runner/node/define-node.mjs +44 -0
- package/dist/es/test-runner/node/define-node.mjs.map +1 -0
- package/dist/es/test-runner/node/index.mjs +2 -0
- package/dist/es/test-runner/node/types.mjs +0 -0
- package/dist/es/test-runner/parser/document-format.mjs +21 -0
- package/dist/es/test-runner/parser/document-format.mjs.map +1 -0
- package/dist/es/test-runner/parser/normalize.mjs +87 -0
- package/dist/es/test-runner/parser/normalize.mjs.map +1 -0
- package/dist/es/test-runner/parser/types.mjs +0 -0
- package/dist/es/test-runner/project.mjs +0 -0
- package/dist/es/test-runner/reporting/agent-report.mjs +23 -0
- package/dist/es/test-runner/reporting/agent-report.mjs.map +1 -0
- package/dist/es/test-runner/reporting/execution-record.mjs +73 -0
- package/dist/es/test-runner/reporting/execution-record.mjs.map +1 -0
- package/dist/es/test-runner/reporting/merge-report.mjs +231 -0
- package/dist/es/test-runner/reporting/merge-report.mjs.map +1 -0
- package/dist/es/test-runner/reporting/sanitize.mjs +162 -0
- package/dist/es/test-runner/reporting/sanitize.mjs.map +1 -0
- package/dist/es/test-runner/reporting/test-run-report.mjs +327 -0
- package/dist/es/test-runner/reporting/test-run-report.mjs.map +1 -0
- package/dist/es/test-runner/reporting/types.mjs +0 -0
- package/dist/es/utils.mjs +1 -1
- package/dist/es/yaml/execution-context.node.mjs +6 -0
- package/dist/es/yaml/execution-context.node.mjs.map +1 -0
- package/dist/es/yaml/execution-context.stub.mjs +8 -0
- package/dist/es/yaml/execution-context.stub.mjs.map +1 -0
- package/dist/es/yaml/execution-session.mjs +90 -0
- package/dist/es/yaml/execution-session.mjs.map +1 -0
- package/dist/es/yaml/index.mjs +2 -1
- package/dist/es/yaml/legacy-yaml-execution-record.mjs +47 -0
- package/dist/es/yaml/legacy-yaml-execution-record.mjs.map +1 -0
- package/dist/es/yaml/legacy-yaml-report.mjs +52 -0
- package/dist/es/yaml/legacy-yaml-report.mjs.map +1 -0
- package/dist/es/yaml/legacy-yaml-runtime.mjs +119 -0
- package/dist/es/yaml/legacy-yaml-runtime.mjs.map +1 -0
- package/dist/es/yaml/player-state.mjs +15 -0
- package/dist/es/yaml/player-state.mjs.map +1 -0
- package/dist/es/yaml/player.mjs +214 -348
- package/dist/es/yaml/player.mjs.map +1 -1
- package/dist/es/yaml/report-policy.mjs +7 -0
- package/dist/es/yaml/report-policy.mjs.map +1 -0
- package/dist/es/yaml/test-runner-compat.mjs +301 -0
- package/dist/es/yaml/test-runner-compat.mjs.map +1 -0
- package/dist/es/yaml/test-runner-nodes.mjs +147 -0
- package/dist/es/yaml/test-runner-nodes.mjs.map +1 -0
- package/dist/es/yaml/utils.mjs +12 -1
- package/dist/es/yaml/utils.mjs.map +1 -1
- package/dist/es/yaml-runtime.mjs +7 -0
- package/dist/es/yaml.mjs.map +1 -1
- package/dist/lib/agent/agent.js +103 -6
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/index.js +37 -3
- package/dist/lib/agent/tasks.js +2 -2
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/test-runner-nodes.js +329 -45
- package/dist/lib/agent/test-runner-nodes.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/device/index.js +15 -2
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/dump/html-utils.js +43 -4
- package/dist/lib/dump/html-utils.js.map +1 -1
- package/dist/lib/dump/screenshot-store.js +8 -1
- package/dist/lib/dump/screenshot-store.js.map +1 -1
- package/dist/lib/report-cli.js +8 -3
- package/dist/lib/report-cli.js.map +1 -1
- package/dist/lib/report-generator.js +114 -1
- package/dist/lib/report-generator.js.map +1 -1
- package/dist/lib/report-html-template.js +1 -1
- package/dist/lib/report.js +187 -38
- package/dist/lib/report.js.map +1 -1
- package/dist/lib/test-run-report.js.map +1 -1
- package/dist/lib/test-runner/engine/case-runner.js +89 -0
- package/dist/lib/test-runner/engine/case-runner.js.map +1 -0
- package/dist/lib/test-runner/engine/document-runtime.js +307 -0
- package/dist/lib/test-runner/engine/document-runtime.js.map +1 -0
- package/dist/lib/test-runner/engine/execute-step.js +211 -0
- package/dist/lib/test-runner/engine/execute-step.js.map +1 -0
- package/dist/lib/test-runner/engine/execution-failure.js +79 -0
- package/dist/lib/test-runner/engine/execution-failure.js.map +1 -0
- package/dist/lib/test-runner/engine/index.js +137 -0
- package/dist/lib/test-runner/engine/index.js.map +1 -0
- package/dist/lib/test-runner/engine/project-runtime.js +176 -0
- package/dist/lib/test-runner/engine/project-runtime.js.map +1 -0
- package/dist/lib/test-runner/engine/registry.js +95 -0
- package/dist/lib/test-runner/engine/registry.js.map +1 -0
- package/dist/lib/test-runner/engine/resource-operations.js +272 -0
- package/dist/lib/test-runner/engine/resource-operations.js.map +1 -0
- package/dist/lib/test-runner/engine/run-collected-case.js +227 -0
- package/dist/lib/test-runner/engine/run-collected-case.js.map +1 -0
- package/dist/lib/test-runner/engine/run-workflow-document.js +189 -0
- package/dist/lib/test-runner/engine/run-workflow-document.js.map +1 -0
- package/dist/lib/test-runner/engine/scheduler.js +64 -0
- package/dist/lib/test-runner/engine/scheduler.js.map +1 -0
- package/dist/lib/test-runner/engine/scope-teardown.js +50 -0
- package/dist/lib/test-runner/engine/scope-teardown.js.map +1 -0
- package/dist/lib/test-runner/engine/types.js +20 -0
- package/dist/lib/test-runner/engine/types.js.map +1 -0
- package/dist/lib/test-runner/errors.js +283 -0
- package/dist/lib/test-runner/errors.js.map +1 -0
- package/dist/lib/test-runner/execution-record.js +123 -0
- package/dist/lib/test-runner/execution-record.js.map +1 -0
- package/dist/lib/test-runner/index.js +137 -0
- package/dist/lib/test-runner/index.js.map +1 -0
- package/dist/lib/test-runner/node/define-node.js +78 -0
- package/dist/lib/test-runner/node/define-node.js.map +1 -0
- package/dist/lib/test-runner/node/index.js +67 -0
- package/dist/lib/test-runner/node/index.js.map +1 -0
- package/dist/lib/test-runner/node/types.js +20 -0
- package/dist/lib/test-runner/node/types.js.map +1 -0
- package/dist/lib/test-runner/parser/document-format.js +58 -0
- package/dist/lib/test-runner/parser/document-format.js.map +1 -0
- package/dist/lib/test-runner/parser/normalize.js +124 -0
- package/dist/lib/test-runner/parser/normalize.js.map +1 -0
- package/dist/lib/test-runner/parser/types.js +20 -0
- package/dist/lib/test-runner/parser/types.js.map +1 -0
- package/dist/lib/test-runner/project.js +20 -0
- package/dist/lib/test-runner/project.js.map +1 -0
- package/dist/lib/test-runner/reporting/agent-report.js +57 -0
- package/dist/lib/test-runner/reporting/agent-report.js.map +1 -0
- package/dist/lib/test-runner/reporting/execution-record.js +107 -0
- package/dist/lib/test-runner/reporting/execution-record.js.map +1 -0
- package/dist/lib/test-runner/reporting/merge-report.js +265 -0
- package/dist/lib/test-runner/reporting/merge-report.js.map +1 -0
- package/dist/lib/test-runner/reporting/sanitize.js +202 -0
- package/dist/lib/test-runner/reporting/sanitize.js.map +1 -0
- package/dist/lib/test-runner/reporting/test-run-report.js +364 -0
- package/dist/lib/test-runner/reporting/test-run-report.js.map +1 -0
- package/dist/lib/test-runner/reporting/types.js +20 -0
- package/dist/lib/test-runner/reporting/types.js.map +1 -0
- package/dist/lib/utils.js +1 -1
- package/dist/lib/yaml/execution-context.node.js +43 -0
- package/dist/lib/yaml/execution-context.node.js.map +1 -0
- package/dist/lib/yaml/execution-context.stub.js +45 -0
- package/dist/lib/yaml/execution-context.stub.js.map +1 -0
- package/dist/lib/yaml/execution-session.js +136 -0
- package/dist/lib/yaml/execution-session.js.map +1 -0
- package/dist/lib/yaml/index.js +49 -7
- package/dist/lib/yaml/legacy-yaml-execution-record.js +81 -0
- package/dist/lib/yaml/legacy-yaml-execution-record.js.map +1 -0
- package/dist/lib/yaml/legacy-yaml-report.js +86 -0
- package/dist/lib/yaml/legacy-yaml-report.js.map +1 -0
- package/dist/lib/yaml/legacy-yaml-runtime.js +156 -0
- package/dist/lib/yaml/legacy-yaml-runtime.js.map +1 -0
- package/dist/lib/yaml/player-state.js +52 -0
- package/dist/lib/yaml/player-state.js.map +1 -0
- package/dist/lib/yaml/player.js +213 -347
- package/dist/lib/yaml/player.js.map +1 -1
- package/dist/lib/yaml/report-policy.js +41 -0
- package/dist/lib/yaml/report-policy.js.map +1 -0
- package/dist/lib/yaml/test-runner-compat.js +344 -0
- package/dist/lib/yaml/test-runner-compat.js.map +1 -0
- package/dist/lib/yaml/test-runner-nodes.js +184 -0
- package/dist/lib/yaml/test-runner-nodes.js.map +1 -0
- package/dist/lib/yaml/utils.js +18 -1
- package/dist/lib/yaml/utils.js.map +1 -1
- package/dist/lib/yaml-runtime.js +67 -0
- package/dist/lib/yaml-runtime.js.map +1 -0
- package/dist/lib/yaml.js.map +1 -1
- package/dist/types/agent/agent.d.ts +14 -1
- package/dist/types/agent/agent.d.ts.map +1 -1
- package/dist/types/agent/index.d.ts +4 -3
- package/dist/types/agent/index.d.ts.map +1 -1
- package/dist/types/agent/tasks.d.ts +1 -1
- package/dist/types/agent/tasks.d.ts.map +1 -1
- package/dist/types/agent/test-runner-nodes.d.ts +226 -0
- package/dist/types/agent/test-runner-nodes.d.ts.map +1 -1
- package/dist/types/device/index.d.ts +1 -1
- package/dist/types/device/index.d.ts.map +1 -1
- package/dist/types/dump/html-utils.d.ts +4 -0
- package/dist/types/dump/html-utils.d.ts.map +1 -1
- package/dist/types/dump/screenshot-store.d.ts +2 -1
- package/dist/types/dump/screenshot-store.d.ts.map +1 -1
- package/dist/types/report-cli.d.ts.map +1 -1
- package/dist/types/report-generator.d.ts +10 -0
- package/dist/types/report-generator.d.ts.map +1 -1
- package/dist/types/report.d.ts +3 -1
- package/dist/types/report.d.ts.map +1 -1
- package/dist/types/test-run-report.d.ts +18 -2
- package/dist/types/test-run-report.d.ts.map +1 -1
- package/dist/types/test-runner/engine/case-runner.d.ts +13 -0
- package/dist/types/test-runner/engine/case-runner.d.ts.map +1 -0
- package/dist/types/test-runner/engine/document-runtime.d.ts +4 -0
- package/dist/types/test-runner/engine/document-runtime.d.ts.map +1 -0
- package/dist/types/test-runner/engine/execute-step.d.ts +17 -0
- package/dist/types/test-runner/engine/execute-step.d.ts.map +1 -0
- package/dist/types/test-runner/engine/execution-failure.d.ts +13 -0
- package/dist/types/test-runner/engine/execution-failure.d.ts.map +1 -0
- package/dist/types/test-runner/engine/index.d.ts +13 -0
- package/dist/types/test-runner/engine/index.d.ts.map +1 -0
- package/dist/types/test-runner/engine/project-runtime.d.ts +3 -0
- package/dist/types/test-runner/engine/project-runtime.d.ts.map +1 -0
- package/dist/types/test-runner/engine/registry.d.ts +12 -0
- package/dist/types/test-runner/engine/registry.d.ts.map +1 -0
- package/dist/types/test-runner/engine/resource-operations.d.ts +32 -0
- package/dist/types/test-runner/engine/resource-operations.d.ts.map +1 -0
- package/dist/types/test-runner/engine/run-collected-case.d.ts +4 -0
- package/dist/types/test-runner/engine/run-collected-case.d.ts.map +1 -0
- package/dist/types/test-runner/engine/run-workflow-document.d.ts +4 -0
- package/dist/types/test-runner/engine/run-workflow-document.d.ts.map +1 -0
- package/dist/types/test-runner/engine/scheduler.d.ts +12 -0
- package/dist/types/test-runner/engine/scheduler.d.ts.map +1 -0
- package/dist/types/test-runner/engine/scope-teardown.d.ts +3 -0
- package/dist/types/test-runner/engine/scope-teardown.d.ts.map +1 -0
- package/dist/types/test-runner/engine/types.d.ts +226 -0
- package/dist/types/test-runner/engine/types.d.ts.map +1 -0
- package/dist/types/test-runner/errors.d.ts +79 -0
- package/dist/types/test-runner/errors.d.ts.map +1 -0
- package/dist/types/test-runner/execution-record.d.ts +43 -0
- package/dist/types/test-runner/execution-record.d.ts.map +1 -0
- package/dist/types/test-runner/index.d.ts +20 -0
- package/dist/types/test-runner/index.d.ts.map +1 -0
- package/dist/types/test-runner/node/define-node.d.ts +4 -0
- package/dist/types/test-runner/node/define-node.d.ts.map +1 -0
- package/dist/types/test-runner/node/index.d.ts +3 -0
- package/dist/types/test-runner/node/index.d.ts.map +1 -0
- package/dist/types/test-runner/node/types.d.ts +66 -0
- package/dist/types/test-runner/node/types.d.ts.map +1 -0
- package/dist/types/test-runner/parser/document-format.d.ts +8 -0
- package/dist/types/test-runner/parser/document-format.d.ts.map +1 -0
- package/dist/types/test-runner/parser/normalize.d.ts +9 -0
- package/dist/types/test-runner/parser/normalize.d.ts.map +1 -0
- package/dist/types/test-runner/parser/types.d.ts +69 -0
- package/dist/types/test-runner/parser/types.d.ts.map +1 -0
- package/dist/types/test-runner/project.d.ts +75 -0
- package/dist/types/test-runner/project.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/agent-report.d.ts +9 -0
- package/dist/types/test-runner/reporting/agent-report.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/execution-record.d.ts +9 -0
- package/dist/types/test-runner/reporting/execution-record.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/merge-report.d.ts +15 -0
- package/dist/types/test-runner/reporting/merge-report.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/sanitize.d.ts +6 -0
- package/dist/types/test-runner/reporting/sanitize.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/test-run-report.d.ts +5 -0
- package/dist/types/test-runner/reporting/test-run-report.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/types.d.ts +34 -0
- package/dist/types/test-runner/reporting/types.d.ts.map +1 -0
- package/dist/types/yaml/execution-context.node.d.ts +4 -0
- package/dist/types/yaml/execution-context.node.d.ts.map +1 -0
- package/dist/types/yaml/execution-context.stub.d.ts +6 -0
- package/dist/types/yaml/execution-context.stub.d.ts.map +1 -0
- package/dist/types/yaml/execution-session.d.ts +17 -0
- package/dist/types/yaml/execution-session.d.ts.map +1 -0
- package/dist/types/yaml/index.d.ts +1 -1
- package/dist/types/yaml/index.d.ts.map +1 -1
- package/dist/types/yaml/legacy-yaml-execution-record.d.ts +24 -0
- package/dist/types/yaml/legacy-yaml-execution-record.d.ts.map +1 -0
- package/dist/types/yaml/legacy-yaml-report.d.ts +19 -0
- package/dist/types/yaml/legacy-yaml-report.d.ts.map +1 -0
- package/dist/types/yaml/legacy-yaml-runtime.d.ts +23 -0
- package/dist/types/yaml/legacy-yaml-runtime.d.ts.map +1 -0
- package/dist/types/yaml/player-state.d.ts +11 -0
- package/dist/types/yaml/player-state.d.ts.map +1 -0
- package/dist/types/yaml/player.d.ts +11 -3
- package/dist/types/yaml/player.d.ts.map +1 -1
- package/dist/types/yaml/report-policy.d.ts +4 -0
- package/dist/types/yaml/report-policy.d.ts.map +1 -0
- package/dist/types/yaml/test-runner-compat.d.ts +17 -0
- package/dist/types/yaml/test-runner-compat.d.ts.map +1 -0
- package/dist/types/yaml/test-runner-nodes.d.ts +6 -0
- package/dist/types/yaml/test-runner-nodes.d.ts.map +1 -0
- package/dist/types/yaml/utils.d.ts +9 -0
- package/dist/types/yaml/utils.d.ts.map +1 -1
- package/dist/types/yaml-runtime.d.ts +13 -0
- package/dist/types/yaml-runtime.d.ts.map +1 -0
- package/dist/types/yaml.d.ts +25 -7
- package/dist/types/yaml.d.ts.map +1 -1
- package/package.json +28 -2
package/dist/lib/report.js
CHANGED
|
@@ -33,6 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
TestRunReportAssembler: ()=>TestRunReportAssembler
|
|
34
34
|
});
|
|
35
35
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
36
|
+
const promises_namespaceObject = require("node:fs/promises");
|
|
36
37
|
const external_node_path_namespaceObject = require("node:path");
|
|
37
38
|
const common_namespaceObject = require("@midscene/shared/common");
|
|
38
39
|
const utils_namespaceObject = require("@midscene/shared/utils");
|
|
@@ -41,7 +42,7 @@ const html_utils_js_namespaceObject = require("./dump/html-utils.js");
|
|
|
41
42
|
const image_reference_js_namespaceObject = require("./dump/image-reference.js");
|
|
42
43
|
const screenshot_store_js_namespaceObject = require("./dump/screenshot-store.js");
|
|
43
44
|
const external_report_stats_js_namespaceObject = require("./report-stats.js");
|
|
44
|
-
const
|
|
45
|
+
const merge_report_js_namespaceObject = require("./test-runner/reporting/merge-report.js");
|
|
45
46
|
const external_types_js_namespaceObject = require("./types.js");
|
|
46
47
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
47
48
|
function _define_property(obj, key, value) {
|
|
@@ -122,7 +123,7 @@ function mergedAgentReportComment(reports) {
|
|
|
122
123
|
groupDescription: 'Agent-readable summary for merged report HTML',
|
|
123
124
|
modelBriefs: reports.flatMap((report)=>report.modelBriefs ?? []),
|
|
124
125
|
deviceType: 1 === deviceTypes.length ? deviceTypes[0] : 'mixed',
|
|
125
|
-
executions: reports.flatMap((report)=>report.executions ?? [])
|
|
126
|
+
executions: dedupeExecutionsKeepLatest(reports.flatMap((report)=>report.executions ?? []))
|
|
126
127
|
});
|
|
127
128
|
return (0, html_utils_js_namespaceObject.generateAgentReportComment)(mergedReport);
|
|
128
129
|
}
|
|
@@ -172,6 +173,8 @@ class ReportMergingTool {
|
|
|
172
173
|
(0, utils_namespaceObject.logMsg)('No reports to merge');
|
|
173
174
|
return null;
|
|
174
175
|
}
|
|
176
|
+
const runnerDumps = this.reportInfos.map((info)=>info.reportFilePath ? (0, html_utils_js_namespaceObject.extractTestRunReportDumpSync)(info.reportFilePath) : void 0);
|
|
177
|
+
const hasRunnerDump = runnerDumps.some(Boolean);
|
|
175
178
|
const targetDir = outputDir ? external_node_path_namespaceObject.resolve(outputDir) : (0, common_namespaceObject.getMidsceneRunSubDir)('report');
|
|
176
179
|
if (outputDir) (0, external_node_fs_namespaceObject.mkdirSync)(targetDir, {
|
|
177
180
|
recursive: true
|
|
@@ -200,6 +203,7 @@ class ReportMergingTool {
|
|
|
200
203
|
(0, external_node_fs_namespaceObject.appendFileSync)(outputFilePath, tplWithoutClose);
|
|
201
204
|
if (hasDirectoryModeReport) (0, external_node_fs_namespaceObject.appendFileSync)(outputFilePath, (0, html_utils_js_namespaceObject.getBaseUrlFixScript)());
|
|
202
205
|
const agentReports = [];
|
|
206
|
+
const runnerSources = [];
|
|
203
207
|
const writtenInlineImageIds = new Set();
|
|
204
208
|
for(let i = 0; i < this.reportInfos.length; i++){
|
|
205
209
|
const reportInfo = this.reportInfos[i];
|
|
@@ -225,16 +229,26 @@ class ReportMergingTool {
|
|
|
225
229
|
} else (0, html_utils_js_namespaceObject.streamImageScriptsToFile)(reportInfo.reportFilePath, outputFilePath, writtenInlineImageIds);
|
|
226
230
|
const allDumps = (0, html_utils_js_namespaceObject.extractAllDumpScriptsSync)(reportInfo.reportFilePath).filter((d)=>d.openTag.includes('data-group-id'));
|
|
227
231
|
const groupIdMatch = allDumps[0]?.openTag.match(/data-group-id="([^"]+)"/);
|
|
228
|
-
if (groupIdMatch) mergedGroupId = decodeURIComponent(groupIdMatch[1]);
|
|
232
|
+
if (groupIdMatch && !hasRunnerDump) mergedGroupId = decodeURIComponent(groupIdMatch[1]);
|
|
229
233
|
const extractedDumpString = allDumps.length > 0 ? this.mergeDumpScripts(allDumps.map((d)=>d.content)) : (0, html_utils_js_namespaceObject.extractLastDumpScriptSync)(reportInfo.reportFilePath);
|
|
230
234
|
if (extractedDumpString) dumpString = extractedDumpString;
|
|
231
235
|
}
|
|
232
236
|
const agentReport = tryParseAgentReportDump(dumpString);
|
|
233
237
|
if (agentReport) agentReports.push(agentReport);
|
|
238
|
+
if (hasRunnerDump) runnerSources.push({
|
|
239
|
+
reportId: mergedGroupId,
|
|
240
|
+
sourcePath: reportInfo.reportFilePath ?? '<skipped-agent-report>',
|
|
241
|
+
attributes: reportAttributes,
|
|
242
|
+
dump: runnerDumps[i],
|
|
243
|
+
timing: agentReport ? agentReportTiming(agentReport, reportAttributes.testDuration) : void 0
|
|
244
|
+
});
|
|
234
245
|
const reportHtmlStr = `${(0, external_utils_js_namespaceObject.reportHTMLContent)({
|
|
235
246
|
dumpString,
|
|
236
247
|
attributes: {
|
|
237
248
|
'data-group-id': mergedGroupId,
|
|
249
|
+
...hasRunnerDump ? {
|
|
250
|
+
'data-report-id': mergedGroupId
|
|
251
|
+
} : {},
|
|
238
252
|
[html_utils_js_namespaceObject.DATA_SCREENSHOT_MODE_ATTR]: hasDirectoryModeReport ? 'directory' : 'inline',
|
|
239
253
|
playwright_test_duration: reportAttributes.testDuration,
|
|
240
254
|
playwright_test_status: reportAttributes.testStatus,
|
|
@@ -246,6 +260,16 @@ class ReportMergingTool {
|
|
|
246
260
|
}, void 0, void 0, false)}\n`;
|
|
247
261
|
(0, external_node_fs_namespaceObject.appendFileSync)(outputFilePath, reportHtmlStr);
|
|
248
262
|
}
|
|
263
|
+
if (hasRunnerDump) {
|
|
264
|
+
const summary = (0, external_report_stats_js_namespaceObject.collectReportSummary)({
|
|
265
|
+
executions: dedupeExecutionsKeepLatest(agentReports.flatMap((report)=>report.executions))
|
|
266
|
+
});
|
|
267
|
+
(0, external_node_fs_namespaceObject.appendFileSync)(outputFilePath, (0, html_utils_js_namespaceObject.generateTestRunReportScriptTag)((0, merge_report_js_namespaceObject.mergeTestRunReportDumps)(runnerSources, {
|
|
268
|
+
modelCallCount: summary.timing.modelCallCount,
|
|
269
|
+
modelTimeMs: summary.timing.modelCallTimeMs,
|
|
270
|
+
...summary.tokens
|
|
271
|
+
}, (0, utils_namespaceObject.uuid)())));
|
|
272
|
+
}
|
|
249
273
|
const agentComment = mergedAgentReportComment(agentReports);
|
|
250
274
|
if (agentComment) (0, external_node_fs_namespaceObject.appendFileSync)(outputFilePath, agentComment);
|
|
251
275
|
(0, external_node_fs_namespaceObject.appendFileSync)(outputFilePath, `${htmlEndTag}\n`);
|
|
@@ -274,28 +298,29 @@ class ReportMergingTool {
|
|
|
274
298
|
_define_property(this, "reportInfos", []);
|
|
275
299
|
}
|
|
276
300
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
301
|
+
function agentReportTiming(report, durationMs) {
|
|
302
|
+
const timing = (0, external_report_stats_js_namespaceObject.collectReportSummary)(report).timing;
|
|
303
|
+
const executionTimes = report.executions.map((execution)=>execution.logTime).filter((value)=>'number' == typeof value && Number.isFinite(value));
|
|
304
|
+
const started = timing.wallTimeStart ?? (executionTimes.length ? Math.min(...executionTimes) : void 0);
|
|
305
|
+
if (void 0 === started) return;
|
|
306
|
+
const ended = timing.wallTimeEnd ?? Math.max(...executionTimes, started + (Number.isFinite(durationMs) ? Math.max(0, durationMs) : 0));
|
|
307
|
+
return {
|
|
308
|
+
startedAt: new Date(started).toISOString(),
|
|
309
|
+
endedAt: new Date(ended).toISOString(),
|
|
310
|
+
durationMs: Math.max(0, ended - started)
|
|
311
|
+
};
|
|
312
|
+
}
|
|
285
313
|
const validateTestRunReportFileName = (fileName)=>{
|
|
286
314
|
if (!fileName || '.' === fileName || '..' === fileName || external_node_path_namespaceObject.basename(fileName) !== fileName || fileName.endsWith('.html')) throw new Error(`Midscene Test reportFileName must be one path segment without an extension: ${fileName}`);
|
|
287
315
|
};
|
|
288
316
|
const uniqueTestRunReportSources = (sources)=>{
|
|
289
317
|
const unique = new Map();
|
|
290
|
-
const scopeBySourcePath = new Map();
|
|
291
318
|
for (const source of sources){
|
|
292
319
|
const scopeId = source.scopeId.trim();
|
|
293
320
|
const sourcePath = external_node_path_namespaceObject.resolve(source.sourcePath);
|
|
294
321
|
if (!scopeId) throw new Error('Midscene Test report source scopeId must not be empty.');
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
scopeBySourcePath.set(sourcePath, scopeId);
|
|
298
|
-
unique.set(`${scopeId}\u0000${sourcePath}`, {
|
|
322
|
+
unique.set(`${scopeId}\u0000${source.dumpPath ?? sourcePath}`, {
|
|
323
|
+
...source,
|
|
299
324
|
scopeId,
|
|
300
325
|
sourcePath
|
|
301
326
|
});
|
|
@@ -304,20 +329,49 @@ const uniqueTestRunReportSources = (sources)=>{
|
|
|
304
329
|
...unique.values()
|
|
305
330
|
];
|
|
306
331
|
};
|
|
307
|
-
const prepareTestRunReportSources = (sources)=>{
|
|
332
|
+
const prepareTestRunReportSources = (sources, loadedDumps)=>{
|
|
308
333
|
const prepared = [];
|
|
309
|
-
const metrics = emptyTestRunReportMetrics();
|
|
310
334
|
const ownerByScopedExecution = new Map();
|
|
335
|
+
const preparedByPath = new Map();
|
|
311
336
|
for (const [sourceIndex, source] of uniqueTestRunReportSources(sources).entries()){
|
|
312
|
-
|
|
313
|
-
const
|
|
337
|
+
const sourceKey = source.sourcePath;
|
|
338
|
+
const shared = preparedByPath.get(sourceKey);
|
|
339
|
+
if (shared) {
|
|
340
|
+
if (source.dumpPath) {
|
|
341
|
+
const snapshot = external_types_js_namespaceObject.ReportActionDump.fromSerializedString(loadedDumps?.get(source.dumpPath) ?? (0, external_node_fs_namespaceObject.readFileSync)(source.dumpPath, 'utf8'));
|
|
342
|
+
shared.dump.executions = dedupeExecutionsKeepLatest([
|
|
343
|
+
...shared.dump.executions,
|
|
344
|
+
...snapshot.executions
|
|
345
|
+
]);
|
|
346
|
+
shared.executionIds.splice(0, shared.executionIds.length, ...shared.dump.executions.flatMap((execution)=>execution.id ? [
|
|
347
|
+
execution.id
|
|
348
|
+
] : []));
|
|
349
|
+
}
|
|
350
|
+
for (const executionId of shared.executionIds){
|
|
351
|
+
const key = `${source.scopeId}\u0000${executionId}`;
|
|
352
|
+
const owner = ownerByScopedExecution.get(key);
|
|
353
|
+
if (owner && owner !== shared.reportId) throw new Error(`Agent execution ${executionId} is present in multiple reports for test scope ${source.scopeId}: ${owner}, ${shared.reportId}`);
|
|
354
|
+
ownerByScopedExecution.set(key, shared.reportId);
|
|
355
|
+
}
|
|
356
|
+
prepared.push({
|
|
357
|
+
...shared,
|
|
358
|
+
scopeId: source.scopeId
|
|
359
|
+
});
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (!source.dumpPath && !(0, external_node_fs_namespaceObject.existsSync)(source.sourcePath)) throw new Error(`Agent report does not exist: ${source.sourcePath}`);
|
|
363
|
+
const sourceVersion = source.dumpPath ? void 0 : peekReportSdkVersion(source.sourcePath);
|
|
314
364
|
const currentVersion = (0, external_utils_js_namespaceObject.getVersion)();
|
|
315
365
|
if (sourceVersion && currentVersion && sourceVersion !== currentVersion && !warnedMismatchedVersions.has(sourceVersion)) {
|
|
316
366
|
warnedMismatchedVersions.add(sourceVersion);
|
|
317
367
|
(0, utils_namespaceObject.logMsg)(`[@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.`);
|
|
318
368
|
}
|
|
319
369
|
const reportId = `runner-report-${sourceIndex + 1}`;
|
|
320
|
-
const
|
|
370
|
+
const snapshot = source.dumpPath ? external_types_js_namespaceObject.ReportActionDump.fromSerializedString(loadedDumps?.get(source.dumpPath) ?? (0, external_node_fs_namespaceObject.readFileSync)(source.dumpPath, 'utf8')) : void 0;
|
|
371
|
+
const { baseDump, executions } = snapshot ? {
|
|
372
|
+
baseDump: snapshot,
|
|
373
|
+
executions: snapshot.executions
|
|
374
|
+
} : collectDedupedExecutions(source.sourcePath);
|
|
321
375
|
const executionIds = [];
|
|
322
376
|
for (const execution of executions){
|
|
323
377
|
if (!execution.id) continue;
|
|
@@ -335,32 +389,124 @@ const prepareTestRunReportSources = (sources)=>{
|
|
|
335
389
|
deviceType: baseDump.deviceType,
|
|
336
390
|
executions
|
|
337
391
|
});
|
|
338
|
-
const
|
|
339
|
-
metrics.modelCallCount += sourceMetrics.timing.modelCallCount;
|
|
340
|
-
metrics.modelTimeMs += sourceMetrics.timing.modelCallTimeMs;
|
|
341
|
-
metrics.promptTokens += sourceMetrics.tokens.promptTokens;
|
|
342
|
-
metrics.cachedInputTokens += sourceMetrics.tokens.cachedInputTokens;
|
|
343
|
-
metrics.completionTokens += sourceMetrics.tokens.completionTokens;
|
|
344
|
-
metrics.totalTokens += sourceMetrics.tokens.totalTokens;
|
|
345
|
-
prepared.push({
|
|
392
|
+
const preparedSource = {
|
|
346
393
|
reportId,
|
|
347
394
|
scopeId: source.scopeId,
|
|
348
395
|
sourcePath: source.sourcePath,
|
|
349
396
|
executionIds,
|
|
350
397
|
dump,
|
|
351
|
-
directoryMode: isDirectoryModeReport(source.sourcePath)
|
|
352
|
-
|
|
398
|
+
directoryMode: !!source.dumpPath || isDirectoryModeReport(source.sourcePath),
|
|
399
|
+
...source.dumpPath ? {
|
|
400
|
+
dumpPath: source.dumpPath
|
|
401
|
+
} : {}
|
|
402
|
+
};
|
|
403
|
+
prepared.push(preparedSource);
|
|
404
|
+
preparedByPath.set(sourceKey, preparedSource);
|
|
353
405
|
}
|
|
406
|
+
const summary = (0, external_report_stats_js_namespaceObject.collectReportSummary)({
|
|
407
|
+
executions: dedupeExecutionsKeepLatest([
|
|
408
|
+
...preparedByPath.values()
|
|
409
|
+
].flatMap((source)=>source.dump.executions))
|
|
410
|
+
});
|
|
354
411
|
return {
|
|
355
412
|
sources: prepared,
|
|
356
|
-
metrics
|
|
413
|
+
metrics: {
|
|
414
|
+
modelCallCount: summary.timing.modelCallCount,
|
|
415
|
+
modelTimeMs: summary.timing.modelCallTimeMs,
|
|
416
|
+
...summary.tokens
|
|
417
|
+
}
|
|
357
418
|
};
|
|
358
419
|
};
|
|
359
|
-
const runnerDumpScript = (dump)=>{
|
|
360
|
-
const closeTag = "<\/script>";
|
|
361
|
-
return '<script type="' + external_test_run_report_js_namespaceObject.TEST_RUN_REPORT_SCRIPT_TYPE + '">\n' + (0, utils_namespaceObject.escapeScriptTag)(JSON.stringify(dump)) + '\n' + closeTag + '\n';
|
|
362
|
-
};
|
|
363
420
|
class TestRunReportAssembler {
|
|
421
|
+
async assembleAsync(options) {
|
|
422
|
+
validateTestRunReportFileName(options.reportFileName);
|
|
423
|
+
const loaded = new Map();
|
|
424
|
+
await Promise.all(options.sources.map(async (source)=>{
|
|
425
|
+
if (source.dumpPath) loaded.set(source.dumpPath, await promises_namespaceObject.readFile(source.dumpPath, 'utf8'));
|
|
426
|
+
}));
|
|
427
|
+
const prepared = prepareTestRunReportSources(options.sources, loaded);
|
|
428
|
+
const dump = options.buildRunnerDump({
|
|
429
|
+
sources: prepared.sources,
|
|
430
|
+
metrics: prepared.metrics
|
|
431
|
+
});
|
|
432
|
+
if ('test-runner' !== dump.kind || 1 !== dump.schemaVersion) throw new Error('Invalid Runner report dump');
|
|
433
|
+
const directoryMode = prepared.sources.some((source)=>source.directoryMode);
|
|
434
|
+
const outputDir = external_node_path_namespaceObject.resolve(options.outputDir);
|
|
435
|
+
await promises_namespaceObject.mkdir(outputDir, {
|
|
436
|
+
recursive: true
|
|
437
|
+
});
|
|
438
|
+
const artifact = external_node_path_namespaceObject.join(outputDir, options.reportFileName);
|
|
439
|
+
const finalPath = directoryMode ? external_node_path_namespaceObject.join(artifact, 'index.html') : `${artifact}.html`;
|
|
440
|
+
if (!options.overwrite && ((0, external_node_fs_namespaceObject.existsSync)(artifact) || (0, external_node_fs_namespaceObject.existsSync)(`${artifact}.html`))) throw new Error(`Report artifact already exists: ${artifact}`);
|
|
441
|
+
const temporary = await promises_namespaceObject.mkdtemp(external_node_path_namespaceObject.join(outputDir, '.test-run-report-'));
|
|
442
|
+
const htmlPath = external_node_path_namespaceObject.join(temporary, 'index.html');
|
|
443
|
+
try {
|
|
444
|
+
const parts = [
|
|
445
|
+
(0, external_utils_js_namespaceObject.getReportTpl)(),
|
|
446
|
+
directoryMode ? (0, html_utils_js_namespaceObject.getBaseUrlFixScript)() : ''
|
|
447
|
+
];
|
|
448
|
+
const imageIds = new Set();
|
|
449
|
+
const reports = [];
|
|
450
|
+
for (const source of new Map(prepared.sources.map((source)=>[
|
|
451
|
+
source.reportId,
|
|
452
|
+
source
|
|
453
|
+
])).values()){
|
|
454
|
+
const serialized = source.dump.serialize();
|
|
455
|
+
if (source.dumpPath) {
|
|
456
|
+
const refs = new Map();
|
|
457
|
+
JSON.parse(serialized, (_key, value)=>{
|
|
458
|
+
const ref = (0, image_reference_js_namespaceObject.normalizeStoredImageRef)(value);
|
|
459
|
+
if (ref) refs.set(ref.id, ref);
|
|
460
|
+
return value;
|
|
461
|
+
});
|
|
462
|
+
if (refs.size) await promises_namespaceObject.mkdir(external_node_path_namespaceObject.join(temporary, 'screenshots'), {
|
|
463
|
+
recursive: true
|
|
464
|
+
});
|
|
465
|
+
for (const ref of refs.values())if (!imageIds.has(ref.id)) {
|
|
466
|
+
if ('file' !== ref.storage || !ref.path) throw new Error(`Snapshot image ${ref.id} has no file source`);
|
|
467
|
+
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)}`));
|
|
468
|
+
imageIds.add(ref.id);
|
|
469
|
+
}
|
|
470
|
+
} else if (source.directoryMode) {
|
|
471
|
+
const images = external_node_path_namespaceObject.join(external_node_path_namespaceObject.dirname(source.sourcePath), 'screenshots');
|
|
472
|
+
if ((0, external_node_fs_namespaceObject.existsSync)(images)) await promises_namespaceObject.cp(images, external_node_path_namespaceObject.join(temporary, 'screenshots'), {
|
|
473
|
+
recursive: true
|
|
474
|
+
});
|
|
475
|
+
} else {
|
|
476
|
+
const html = await promises_namespaceObject.readFile(source.sourcePath, 'utf8');
|
|
477
|
+
for (const match of html.matchAll(/<script\b([^>]*)>[\s\S]*?<\/script>/g))if (/(?:^|\s)type=["']midscene-image["']/.test(match[1])) parts.push(match[0]);
|
|
478
|
+
}
|
|
479
|
+
reports.push(source.dump);
|
|
480
|
+
parts.push((0, external_utils_js_namespaceObject.reportHTMLContent)({
|
|
481
|
+
dumpString: serialized,
|
|
482
|
+
attributes: {
|
|
483
|
+
'data-group-id': source.reportId,
|
|
484
|
+
'data-report-id': source.reportId,
|
|
485
|
+
'data-runner-scope-id': source.scopeId,
|
|
486
|
+
[html_utils_js_namespaceObject.DATA_SCREENSHOT_MODE_ATTR]: directoryMode ? 'directory' : 'inline'
|
|
487
|
+
}
|
|
488
|
+
}, void 0, void 0, false));
|
|
489
|
+
}
|
|
490
|
+
parts.push((0, html_utils_js_namespaceObject.generateTestRunReportScriptTag)(dump), mergedAgentReportComment(reports));
|
|
491
|
+
await promises_namespaceObject.writeFile(htmlPath, parts.join('\n'));
|
|
492
|
+
if (options.overwrite) {
|
|
493
|
+
await promises_namespaceObject.rm(artifact, {
|
|
494
|
+
recursive: true,
|
|
495
|
+
force: true
|
|
496
|
+
});
|
|
497
|
+
await promises_namespaceObject.rm(`${artifact}.html`, {
|
|
498
|
+
force: true
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
await promises_namespaceObject.rename(directoryMode ? temporary : htmlPath, directoryMode ? artifact : finalPath);
|
|
502
|
+
return finalPath;
|
|
503
|
+
} finally{
|
|
504
|
+
await promises_namespaceObject.rm(temporary, {
|
|
505
|
+
recursive: true,
|
|
506
|
+
force: true
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
}
|
|
364
510
|
assemble(options) {
|
|
365
511
|
validateTestRunReportFileName(options.reportFileName);
|
|
366
512
|
const outputDir = external_node_path_namespaceObject.resolve(options.outputDir);
|
|
@@ -403,7 +549,10 @@ class TestRunReportAssembler {
|
|
|
403
549
|
(0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath, -1 === htmlEndIndex ? template : template.slice(0, htmlEndIndex));
|
|
404
550
|
if (directoryMode) (0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath, (0, html_utils_js_namespaceObject.getBaseUrlFixScript)());
|
|
405
551
|
const agentReports = [];
|
|
406
|
-
for (const source of prepared.sources)
|
|
552
|
+
for (const source of new Map(prepared.sources.map((source)=>[
|
|
553
|
+
source.reportId,
|
|
554
|
+
source
|
|
555
|
+
])).values()){
|
|
407
556
|
if (source.directoryMode) {
|
|
408
557
|
const screenshotsDir = external_node_path_namespaceObject.join(external_node_path_namespaceObject.dirname(source.sourcePath), 'screenshots');
|
|
409
558
|
if ((0, external_node_fs_namespaceObject.existsSync)(screenshotsDir)) {
|
|
@@ -425,7 +574,7 @@ class TestRunReportAssembler {
|
|
|
425
574
|
}
|
|
426
575
|
}, void 0, void 0, false)}\n`);
|
|
427
576
|
}
|
|
428
|
-
(0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath,
|
|
577
|
+
(0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath, (0, html_utils_js_namespaceObject.generateTestRunReportScriptTag)(runnerDump));
|
|
429
578
|
const agentComment = mergedAgentReportComment(agentReports);
|
|
430
579
|
if (agentComment) (0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath, agentComment);
|
|
431
580
|
(0, external_node_fs_namespaceObject.appendFileSync)(temporaryReportPath, `${htmlEndTag}\n`);
|