
























@@ -93,6 +93,79 @@ describe("scripts/mantis/publish-pr-evidence", () => {
9393expect(body).toContain("- Overall: `true`");
9494});
959596+it("allows failure manifests to omit optional visual artifacts", () => {
97+const dir = mkdtempSync(path.join(tmpdir(), "mantis-evidence-test-"));
98+writeFileSync(path.join(dir, "summary.json"), JSON.stringify({ status: "fail" }));
99+writeFileSync(path.join(dir, "report.md"), "bootstrap failed before screenshot");
100+const manifestPath = path.join(dir, "mantis-evidence.json");
101+writeFileSync(
102+manifestPath,
103+JSON.stringify({
104+schemaVersion: 1,
105+id: "slack-desktop-smoke",
106+title: "Mantis Slack Desktop Smoke QA",
107+summary: "Mantis could not finish VM setup.",
108+scenario: "slack-openclaw-desktop-smoke",
109+comparison: {
110+candidate: {
111+expected: "Slack QA and VM gateway setup pass",
112+sha: "bbb",
113+status: "fail",
114+},
115+pass: false,
116+},
117+artifacts: [
118+{
119+alt: "Slack Web desktop screenshot from the Mantis VM",
120+inline: true,
121+kind: "desktopScreenshot",
122+label: "Slack desktop/VNC browser",
123+lane: "candidate",
124+path: "slack-desktop-smoke.png",
125+required: false,
126+targetPath: "slack-desktop.png",
127+},
128+{
129+kind: "metadata",
130+label: "Slack desktop summary",
131+lane: "run",
132+path: "summary.json",
133+targetPath: "summary.json",
134+},
135+{
136+kind: "report",
137+label: "Slack desktop report",
138+lane: "run",
139+path: "report.md",
140+targetPath: "report.md",
141+},
142+],
143+}),
144+);
145+146+const manifest = loadEvidenceManifest(manifestPath);
147+expect(manifest.artifacts.map((artifact) => artifact.targetPath)).toEqual([
148+"summary.json",
149+"report.md",
150+"mantis-evidence.json",
151+]);
152+const body = renderEvidenceComment({
153+artifactRoot: "mantis/slack/pr-1/run-1",
154+artifactUrl: "https://github.com/openclaw/openclaw/actions/runs/1/artifacts/2",
155+ manifest,
156+marker: "<!-- mantis-slack-desktop-smoke -->",
157+rawBase:
158+"https://raw.githubusercontent.com/openclaw/openclaw/qa-artifacts/mantis/slack/pr-1/run-1",
159+requestSource: "workflow_dispatch",
160+runUrl: "https://github.com/openclaw/openclaw/actions/runs/1",
161+treeUrl: "https://github.com/openclaw/openclaw/tree/qa-artifacts/mantis/slack/pr-1/run-1",
162+});
163+164+expect(body).toContain("Summary: Mantis could not finish VM setup.");
165+expect(body).toContain("- Overall: `false`");
166+expect(body).not.toContain("<img ");
167+});
168+96169it("rejects artifact paths that escape the manifest directory", () => {
97170const dir = mkdtempSync(path.join(tmpdir(), "mantis-evidence-test-"));
98171const manifestPath = path.join(dir, "mantis-evidence.json");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。