Skip to content

Commit 1600fe5

Browse files
committed
fix: wait for async error element in duplicate registration test
The registration form uses async fetch (no page navigation), so waitForLoadState returns immediately. Wait for the error element to become visible instead of checking synchronously.
1 parent 4d7e06e commit 1600fe5

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

playwright/tests/auth/registration.spec.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,11 @@ test.describe('Registration', () => {
8989
await registerPage.acceptTerms();
9090
await registerPage.submit();
9191

92-
// Wait for response
93-
await page.waitForLoadState('domcontentloaded');
94-
95-
// Should show error or redirect with error parameter
96-
const url = page.url();
97-
const hasError = await registerPage.hasGlobalError() ||
98-
await registerPage.hasExistingAccountError() ||
99-
url.includes('error');
100-
101-
expect(hasError).toBe(true);
92+
// Registration uses async fetch — wait for the error element to appear
93+
// rather than waiting for page navigation (which doesn't happen)
94+
const globalError = page.locator('#globalError');
95+
const existingAccountError = page.locator('#existingAccountError');
96+
await expect(globalError.or(existingAccountError)).toBeVisible({ timeout: 10000 });
10297
});
10398

10499
test('should reject mismatched passwords', async ({

0 commit comments

Comments
 (0)