fix(e2e): scroll detail-page chart into view before asserting #5

Merged
tudor merged 2 commits from fix/e2e-detail-chart-scroll into main 2026-07-03 13:56:00 +00:00
Showing only changes of commit 4ece55b031 - Show all commits
+7 -2
View File
@@ -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 }) => {