Files
kandev/apps/web/e2e/helpers/animations.ts
T
2026-08-26 13:11:37 +00:00

12 lines
529 B
TypeScript

import type { Locator } from "@playwright/test";
export async function waitForFiniteAnimations(surface: Locator): Promise<void> {
await surface.evaluate(async (element) => {
const animations = element.getAnimations({ subtree: true }).filter((animation) => {
const iterations = animation.effect?.getComputedTiming().iterations;
return typeof iterations === "number" && Number.isFinite(iterations);
});
await Promise.all(animations.map((animation) => animation.finished.catch(() => undefined)));
});
}