diff --git a/apps/meteor/tests/e2e/config/global-setup.ts b/apps/meteor/tests/e2e/config/global-setup.ts
index 42e2e3f62f5..064dea90eba 100644
--- a/apps/meteor/tests/e2e/config/global-setup.ts
+++ b/apps/meteor/tests/e2e/config/global-setup.ts
@@ -1,6 +1,6 @@
/* eslint no-await-in-loop: 0 */
-import { chromium } from '@playwright/test';
+import { chromium, expect } from '@playwright/test';
import * as constants from './constants';
import injectInitialData from '../fixtures/inject-initial-data';
@@ -32,7 +32,7 @@ export default async function (): Promise
{
await page.locator('[name=password]').type(constants.ADMIN_CREDENTIALS.password);
await page.locator('role=button >> text="Login"').click();
- await page.waitForTimeout(1000);
+ await expect(page.locator('role=alert[name=loading]')).toHaveCount(0);
await page.context().storageState({ path: `admin-session.json` });
diff --git a/apps/meteor/tests/e2e/config/global.d.ts b/apps/meteor/tests/e2e/config/global.d.ts
index e29110bb745..64ab771db66 100644
--- a/apps/meteor/tests/e2e/config/global.d.ts
+++ b/apps/meteor/tests/e2e/config/global.d.ts
@@ -2,5 +2,6 @@ declare namespace PlaywrightTest {
interface Matchers {
hasAttribute(a: string): Promise;
toBeInvalid(): Promise;
+ toBeBusy(): Promise;
}
}
diff --git a/apps/meteor/tests/e2e/utils/test.ts b/apps/meteor/tests/e2e/utils/test.ts
index d0bcfa7b454..8e0bc506271 100644
--- a/apps/meteor/tests/e2e/utils/test.ts
+++ b/apps/meteor/tests/e2e/utils/test.ts
@@ -88,6 +88,13 @@ expect.extend({
pass,
};
},
+ async toBeBusy(received: Locator) {
+ const pass = await received.evaluate((node) => node.getAttribute('aria-busy') === 'true');
+ return {
+ message: () => `expected ${received} to be busy`,
+ pass,
+ };
+ },
async hasAttribute(received: Locator, attribute: string) {
const pass = await received.evaluate((node, attribute) => node.hasAttribute(attribute), attribute);