Skip to content

Commit

Permalink
feat: add waitForBlurEnterContent function to handle blur animation b…
Browse files Browse the repository at this point in the history
…efore page readiness
  • Loading branch information
MH4GF committed Dec 15, 2024
1 parent de76868 commit fc05f7c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/__vrt__/vrt.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,26 @@ import type { Page, TestInfo } from "@playwright/test";
import { expect, test } from "@playwright/test";
import { createHtmlReport } from "axe-html-reporter";

const waitForBlurEnterContent = async (page: Page) => {
await page.evaluate(() => {
return new Promise<void>((resolve) => {
const animationContainers = document.querySelectorAll(".blur-enter-content");
if (animationContainers.length === 0) {
resolve();
return;
}

setTimeout(() => resolve(), 2000);
});
});
};

const waitForPageReady = async (page: Page) => {
await page.waitForLoadState("domcontentloaded");
await page.waitForLoadState("load");
await page.waitForLoadState("networkidle");
await page.evaluate(() => document.fonts.ready);
await waitForBlurEnterContent(page);
};

const maskFlakyElements = async (page: Page, selectors: string[]) => {
Expand Down

0 comments on commit fc05f7c

Please sign in to comment.