fix: capture dashboard screenshot after contract ready

This commit is contained in:
Codex
2026-07-01 03:10:30 +00:00
parent 6284cf2636
commit 610357a0c3
+13 -6
View File
@@ -612,12 +612,6 @@ if (requestedRunId) {
await page.waitForTimeout(150);
}
if (captureScreenshot && screenshotPath) {
await page.screenshot({ path: screenshotPath, fullPage, animations: "disabled" }).catch((error) => {
pageErrors.push({ message: "screenshot failed: " + String(error?.message || error).slice(0, 400) });
});
}
const dom = await page.evaluate(async ({ expectedRoutePrefix, expectedSentinelId, requestedRunId, requestedRunSelection }) => {
const numberValue = (value) => Number.isFinite(Number(value)) ? Number(value) : 0;
const objectOrNull = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -838,6 +832,19 @@ const dom = await page.evaluate(async ({ expectedRoutePrefix, expectedSentinelId
};
}, { expectedRoutePrefix, expectedSentinelId, requestedRunId, requestedRunSelection });
if (captureScreenshot && screenshotPath) {
if (requestedRunId && dom.memorySummary?.perPageLines === true && dom.memorySummary?.axesOk === true) {
await page.evaluate(() => {
const chart = document.querySelector("[data-run-memory-chart='true']");
if (chart instanceof HTMLElement) chart.scrollIntoView({ block: "center", inline: "nearest", behavior: "auto" });
}).catch(() => null);
await page.waitForTimeout(150);
}
await page.screenshot({ path: screenshotPath, fullPage, animations: "disabled" }).catch((error) => {
pageErrors.push({ message: "screenshot failed: " + String(error?.message || error).slice(0, 400) });
});
}
const consoleErrors = consoleMessages.filter((item) => item.type === "error");
const navigationOk = !navigationError || (dom.shell === true && dom.ready === true);
const ok = navigationOk