Skip to content

Commit e6f5f56

Browse files
committed
ci: allow Slack Mantis failure evidence without screenshots
1 parent 04442f4 commit e6f5f56

2 files changed

Lines changed: 79 additions & 1 deletion

File tree

.github/workflows/mantis-slack-desktop-smoke.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,15 @@ jobs:
281281
fi
282282
283283
status="$(jq -r '.status' "$root/mantis-slack-desktop-smoke-summary.json")"
284+
screenshot_required=false
285+
if [[ "$status" == "pass" ]]; then
286+
screenshot_required=true
287+
fi
284288
jq -n \
285289
--arg status "$status" \
286290
--arg candidate_sha "${{ needs.validate_ref.outputs.candidate_revision }}" \
287291
--arg scenario "$SCENARIO_ID" \
292+
--argjson screenshot_required "$screenshot_required" \
288293
'{
289294
schemaVersion: 1,
290295
id: "slack-desktop-smoke",
@@ -296,7 +301,7 @@ jobs:
296301
pass: ($status == "pass")
297302
},
298303
artifacts: [
299-
{ kind: "desktopScreenshot", lane: "candidate", label: "Slack desktop/VNC browser", path: "slack-desktop-smoke.png", targetPath: "slack-desktop.png", alt: "Slack Web desktop screenshot from the Mantis VM", width: 720, inline: true },
304+
{ kind: "desktopScreenshot", lane: "candidate", label: "Slack desktop/VNC browser", path: "slack-desktop-smoke.png", targetPath: "slack-desktop.png", alt: "Slack Web desktop screenshot from the Mantis VM", width: 720, inline: true, required: $screenshot_required },
300305
{ kind: "motionPreview", lane: "candidate", label: "Slack motion preview", path: "slack-desktop-smoke-preview.gif", targetPath: "slack-desktop-preview.gif", alt: "Animated Slack desktop preview", width: 720, inline: true, required: false },
301306
{ kind: "motionClip", lane: "candidate", label: "Slack change MP4", path: "slack-desktop-smoke-change.mp4", targetPath: "slack-desktop-change.mp4", required: false },
302307
{ kind: "fullVideo", lane: "candidate", label: "Slack desktop MP4", path: "slack-desktop-smoke.mp4", targetPath: "slack-desktop.mp4", required: false },

test/scripts/mantis-publish-pr-evidence.test.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,79 @@ describe("scripts/mantis/publish-pr-evidence", () => {
9393
expect(body).toContain("- Overall: `true`");
9494
});
9595

96+
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+
96169
it("rejects artifact paths that escape the manifest directory", () => {
97170
const dir = mkdtempSync(path.join(tmpdir(), "mantis-evidence-test-"));
98171
const manifestPath = path.join(dir, "mantis-evidence.json");

0 commit comments

Comments
 (0)