Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

test: wait for theme transitions before measuring contrast

Amruth Pillai6a595ebf20ff
diff --git a/tests/e2e/specs/accessibility-preferences.spec.ts b/tests/e2e/specs/accessibility-preferences.spec.ts
index 1da84dbad..f1b9ca7f9 100644
--- a/tests/e2e/specs/accessibility-preferences.spec.ts
+++ b/tests/e2e/specs/accessibility-preferences.spec.ts
@@ -192,8 +192,10 @@ test("control boundary contrast clears 3:1 in both themes", async ({ authPage: p
await expect(locate()).toBeVisible();
for (const dark of [false, true]) {
await page.evaluate((enabled) => document.documentElement.classList.toggle("dark", enabled), dark);
- // Measure the settled theme; checkbox background/border colors transition independently.
- await expect.poll(async () => (await ratio(locate(), track)).old).toBeLessThan(3);
+ // Border and background transition independently; measure only after both finish.
+ await locate().evaluate(async (element) => {
+ await Promise.all(element.getAnimations().map((animation) => animation.finished));
+ });
const contrast = await ratio(locate(), track);
expect(contrast.actual, `${path} dark=${dark}`).toBeGreaterThanOrEqual(3);
expect(contrast.old, "old decorative boundary fails this same oracle").toBeLessThan(3);