From ad08037f4fc7a891b6c162b61a7d55f1454a2325 Mon Sep 17 00:00:00 2001 From: Hare Date: Fri, 16 Oct 2026 05:59:39 +0900 Subject: [PATCH] fix: wait for settled theme colors in browser checks --- site/tests/browser/theme.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/site/tests/browser/theme.spec.ts b/site/tests/browser/theme.spec.ts index 1e5f0fa..b87eaf9 100644 --- a/site/tests/browser/theme.spec.ts +++ b/site/tests/browser/theme.spec.ts @@ -48,6 +48,11 @@ async function paint(locator: Locator, property = 'color') { }, property); } async function readable(locator: Locator, minimum = 4.5, property = 'color') { + // Assert the requested palette state, not a scheduler-dependent intermediate + // frame of the existing hover/focus color transition. + await locator.evaluate(async (element) => { + await Promise.all(element.getAnimations().map((animation) => animation.finished.catch(() => {}))); + }); const colors = await paint(locator, property); expect(contrast(colors.color, colors.background), `${property} contrast for ${locator}`).toBeGreaterThanOrEqual(minimum); return colors;