🚀(app-impress) create the e2e app impress

Create the e2e app impress, it will be used
to test the app impress.
This commit is contained in:
Anthony LC
2024-04-02 12:13:06 +02:00
parent 8fda0bc9b9
commit 3098b9f4fc
18 changed files with 1213 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { Locator } from '@playwright/test';
export async function waitForElementCount(
locator: Locator,
count: number,
timeout: number,
) {
let elapsedTime = 0;
const interval = 200; // Check every 200 ms
while (elapsedTime < timeout) {
const currentCount = await locator.count();
if (currentCount >= count) {
return true;
}
await locator.page().waitForTimeout(interval); // Wait for the interval before checking again
elapsedTime += interval;
}
throw new Error(
`Timeout after ${timeout}ms waiting for element count to be at least ${count}`,
);
}