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