From 4ece55b03163bf4c26d09e9726e0d685c53d6761 Mon Sep 17 00:00:00 2001 From: Tudor Date: Fri, 3 Jul 2026 14:34:17 +0100 Subject: [PATCH] fix(e2e): scroll the detail-page chart into view before asserting visibility The canvas renders below the fold and stays 'hidden' to Playwright until scrolled to; wait for attachment, scroll, then assert. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01PqGhF93UrpDNvXBLMjJENL --- e2e/tests/journeys.spec.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/e2e/tests/journeys.spec.ts b/e2e/tests/journeys.spec.ts index f955657..b366b89 100644 --- a/e2e/tests/journeys.spec.ts +++ b/e2e/tests/journeys.spec.ts @@ -43,8 +43,13 @@ test('school detail page renders name and performance data', async ({ page }) => await firstSchool.click(); await page.waitForURL(/\/school\//); await expect(page.locator('h1').first()).toBeVisible(); - // The detail page renders at least one chart canvas (performance history) - await expect(page.locator('canvas').first()).toBeVisible({ timeout: 15_000 }); + // The detail page renders at least one chart canvas (performance history). + // Charts live below the fold and only become visible once scrolled to, so + // wait for the element, scroll it into view, then assert visibility. + const chart = page.locator('canvas').first(); + await chart.waitFor({ state: 'attached', timeout: 15_000 }); + await chart.scrollIntoViewIfNeeded(); + await expect(chart).toBeVisible({ timeout: 15_000 }); }); test('comparing two schools shows both side by side', async ({ page }) => {