From 2aaa27cfec0ac51995b280566b7633cb98072dce Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 13 Feb 2026 19:09:48 +0000 Subject: [PATCH] fix: enhance login navigation flow with improved error handling and visibility checks --- tests/settings/user-lifecycle.spec.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/settings/user-lifecycle.spec.ts b/tests/settings/user-lifecycle.spec.ts index d6d5d592..67c33864 100644 --- a/tests/settings/user-lifecycle.spec.ts +++ b/tests/settings/user-lifecycle.spec.ts @@ -157,8 +157,15 @@ async function navigateToLogin(page: import('@playwright/test').Page): Promise false)) { await logoutButton.click(); + await page.waitForURL(/\/login/, { timeout: 15000 }).catch(() => undefined); } else { - await page.goto('/login', { waitUntil: 'domcontentloaded' }); + try { + await page.goto('/login', { waitUntil: 'domcontentloaded' }); + } catch (error) { + if (!(error instanceof Error) || !error.message.includes('interrupted by another navigation')) { + throw error; + } + } } const emailInput = page.locator('input[type="email"]').or(page.getByLabel(/email/i)).first(); @@ -173,6 +180,11 @@ async function loginWithCredentials( const emailInput = page.locator('input[type="email"]').or(page.getByLabel(/email/i)).first(); const passwordInput = page.locator('input[type="password"]').or(page.getByLabel(/password/i)).first(); + const hasEmailInput = await emailInput.isVisible().catch(() => false); + if (!hasEmailInput) { + await navigateToLogin(page); + } + await expect(emailInput).toBeVisible({ timeout: 15000 }); await expect(passwordInput).toBeVisible({ timeout: 15000 }); await emailInput.fill(email); @@ -344,6 +356,7 @@ test.describe('Admin-User E2E Workflow', () => { } // Login as admin + await navigateToLogin(page); await loginWithCredentials(page, adminEmail, TEST_PASSWORD); const token = await getAuthToken(page);