From 610357a0c3e744e93c182ae6ce171607fd6a3f56 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 1 Jul 2026 03:10:30 +0000 Subject: [PATCH] fix: capture dashboard screenshot after contract ready --- scripts/src/hwlab-node-web-sentinel-p5.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/src/hwlab-node-web-sentinel-p5.ts b/scripts/src/hwlab-node-web-sentinel-p5.ts index 30d6b8a5..1baf3a95 100644 --- a/scripts/src/hwlab-node-web-sentinel-p5.ts +++ b/scripts/src/hwlab-node-web-sentinel-p5.ts @@ -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