diff --git a/frontend/scripts/capture-screenshots.mjs b/frontend/scripts/capture-screenshots.mjs index 84735a4..88d90e9 100644 --- a/frontend/scripts/capture-screenshots.mjs +++ b/frontend/scripts/capture-screenshots.mjs @@ -122,16 +122,6 @@ async function captureRuns(page, dir) { await page.waitForTimeout(1500) await page.screenshot({ path: `${dir}/app-runs-compare.png`, fullPage: true }) - // A dashboard read against those two runs: the same page a live run is - // watched on, showing finished ones. This is the seam the feature exists for. - const picked = await page - .getByTestId("run-link") - .evaluateAll((links) => - links.slice(0, 2).map((a) => a.getAttribute("href")), - ) - const ids = picked - .map((href) => (href || "").split("/").pop()) - .filter(Boolean) // The API is its own host here; the SPA's origin does not proxy /api. const apiUrl = APP_URL.replace("//app.", "//api.") const results = await page.evaluate(async (base) => { @@ -146,12 +136,30 @@ async function captureRuns(page, dir) { .map((one) => one.name) .find((n) => n.endsWith("_results")) }, apiUrl) - if (results && ids.length) { - await page.goto(`${APP_URL}/view/${results}?runs=${ids.join(",")}`, { + + // A dashboard read against two runs: the same page a live run is watched + // on, showing finished ones. This is the seam the feature exists for — and + // it draws nothing unless the runs are the ones that dashboard reads, so + // the table is filtered to its flow rather than read from the top. Another + // flow's run finishing later would otherwise photograph an empty grid. + if (results) { + const flow = results.replace(/_results$/, "") + await page.goto(`${APP_URL}/runs?flow=${flow}`, { waitUntil: "networkidle", }) - await page.waitForTimeout(2000) - await page.screenshot({ path: `${dir}/app-run-context.png` }) + const ids = await page.getByTestId("run-link").evaluateAll((links) => + links + .slice(0, 2) + .map((a) => (a.getAttribute("href") || "").split("/").pop()) + .filter(Boolean), + ) + if (ids.length) { + await page.goto(`${APP_URL}/view/${results}?runs=${ids.join(",")}`, { + waitUntil: "networkidle", + }) + await page.waitForTimeout(2000) + await page.screenshot({ path: `${dir}/app-run-context.png` }) + } } // The dashboard that pins the last few runs, drawn live rather than in a