ci(mantis): render proof media responsively

This commit is contained in:
Ayaan Zaidi
2026-05-11 20:07:45 +05:30
parent 4b6c43af48
commit adc3ba45ca
3 changed files with 22 additions and 8 deletions

View File

@@ -156,11 +156,21 @@ function renderPairTable({ pair, rawBase }) {
if (!left || !right) {
return "";
}
const width = Math.min(Number(left.width ?? right.width ?? 420) || 420, 720);
return [
`| ${left.label} | ${right.label} |`,
"| --- | --- |",
`| <img src="${artifactUrl(rawBase, left)}" width="${width}" alt="${left.alt ?? left.label}"> | <img src="${artifactUrl(rawBase, right)}" width="${width}" alt="${right.alt ?? right.label}"> |`,
'<table width="100%">',
" <thead>",
" <tr>",
` <th width="50%">${left.label}</th>`,
` <th width="50%">${right.label}</th>`,
" </tr>",
" </thead>",
" <tbody>",
" <tr>",
` <td width="50%" align="center"><img src="${artifactUrl(rawBase, left)}" width="100%" alt="${left.alt ?? left.label}"></td>`,
` <td width="50%" align="center"><img src="${artifactUrl(rawBase, right)}" width="100%" alt="${right.alt ?? right.label}"></td>`,
" </tr>",
" </tbody>",
"</table>",
"",
].join("\n");
}

View File

@@ -94,9 +94,11 @@ describe("scripts/mantis/build-telegram-desktop-proof-evidence", () => {
"https://github.com/openclaw/openclaw/tree/qa-artifacts/mantis/telegram-desktop/pr-1/run-1",
});
expect(body).toContain("| Main | This PR |");
expect(body).toContain('<th width="50%">Main</th>');
expect(body).toContain('<th width="50%">This PR</th>');
expect(body).toContain("baseline/telegram-desktop-proof.gif");
expect(body).toContain("candidate/telegram-desktop-proof.gif");
expect(body).toContain('telegram-desktop-proof.gif" width="420"');
expect(body).toContain('telegram-desktop-proof.gif" width="100%"');
expect(body).not.toContain("| Main | This PR |");
});
});

View File

@@ -92,9 +92,11 @@ describe("scripts/mantis/publish-pr-evidence", () => {
expect(body).toContain("<!-- mantis-discord-status-reactions -->");
expect(body).toContain("Summary: Mantis reran the scenario.");
expect(body).toContain("| Baseline queued-only | Candidate queued -> thinking -> done |");
expect(body).toContain('<table width="100%">');
expect(body).toContain('<th width="50%">Baseline queued-only</th>');
expect(body).toContain('<th width="50%">Candidate queued -> thinking -> done</th>');
expect(body).toContain(
'<img src="https://raw.githubusercontent.com/openclaw/openclaw/qa-artifacts/mantis/discord/pr-1/run-1/baseline.png"',
'<td width="50%" align="center"><img src="https://raw.githubusercontent.com/openclaw/openclaw/qa-artifacts/mantis/discord/pr-1/run-1/baseline.png" width="100%"',
);
expect(body).toContain(
"[Baseline change MP4](https://raw.githubusercontent.com/openclaw/openclaw/qa-artifacts/mantis/discord/pr-1/run-1/baseline-change.mp4)",