From 3268de40b74cc2bdcb6ae0702f7bb38b0ecc1716 Mon Sep 17 00:00:00 2001 From: DeccanHYD Date: Sat, 26 Sep 2026 09:09:39 +0200 Subject: [PATCH] test(web): wait for settled route before spacing overflow check --- web/tests/browser/typography.spec.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/web/tests/browser/typography.spec.ts b/web/tests/browser/typography.spec.ts index 8ef0d8e..b96b63d 100644 --- a/web/tests/browser/typography.spec.ts +++ b/web/tests/browser/typography.spec.ts @@ -256,10 +256,9 @@ test("spacing slider changes layout, persists, resets and retains touch targets await expect(nav.locator("svg")).toHaveCSS("width", "21px"); await page.setViewportSize({ width: 320, height: 800 }); await page.addStyleTag({ content: "html { font-size: 200%; }" }); - await page.locator(".route-stage").evaluate(async (element) => { - await Promise.all(element.getAnimations().map((animation) => animation.finished)); - }); - const overflow = await page.evaluate(() => Array.from(document.querySelectorAll("*")) + // WebKit can report no active route animation before its first paint. + // Check the settled layout instead of sampling that transient entry frame. + await expect.poll(() => page.evaluate(() => Array.from(document.querySelectorAll("*")) .map((element) => { const rect = element.getBoundingClientRect(); return { @@ -270,8 +269,7 @@ test("spacing slider changes layout, persists, resets and retains touch targets right: Math.round(rect.right), }; }) - .filter((item) => item.right > innerWidth + 1 || item.left < -1)); - expect(overflow).toEqual([]); + .filter((item) => item.right > innerWidth + 1 || item.left < -1))).toEqual([]); expect((await slider.boundingBox())!.height).toBeGreaterThanOrEqual(48); await slider.screenshot({ path: `output/playwright/${info.project.name}-spacing-${value}.png`,