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;