🚀(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:
21
src/frontend/apps/e2e/__tests__/helpers.ts
Normal file
21
src/frontend/apps/e2e/__tests__/helpers.ts
Normal 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}`,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user