From f91a6b16c5ba3ca8f5b53d64495ebfb6c990cdea Mon Sep 17 00:00:00 2001 From: David Dreschner Date: Mon, 13 Jul 2026 03:44:15 +0200 Subject: [PATCH] chore(playwright): Rewrite login handler to avoid race conditions Assisted-by: ClaudeCode:claude-opus-4.6[1M] Signed-off-by: David Dreschner --- .../support/utils/password-confirmation.ts | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/playwright/support/utils/password-confirmation.ts b/tests/playwright/support/utils/password-confirmation.ts index 9524f1f5094f2..0100712d3a144 100644 --- a/tests/playwright/support/utils/password-confirmation.ts +++ b/tests/playwright/support/utils/password-confirmation.ts @@ -16,19 +16,18 @@ export async function handlePasswordConfirmation(page: Page, password = 'admin') try { // Check if the dialog exists within a short timeout - const dialogVisible = await dialog.isVisible({ timeout: 500 }).catch(() => false) - - if (dialogVisible) { - // Fill the password field - await dialog.locator('input[type="password"]').fill(password) - - // Click the confirm button - await dialog.getByRole('button', { name: 'Confirm' }).click() - - // Wait for the dialog to disappear - await dialog.waitFor({ state: 'hidden' }) - } + await dialog.waitFor({ state: 'visible', timeout: 500 }) } catch { // Dialog didn't appear, which is fine - some operations might not require confirmation + return } + + // Fill the password field + await dialog.locator('input[type="password"]').fill(password) + + // Click the confirm button + await dialog.getByRole('button', { name: 'Confirm' }).click() + + // Wait for the dialog to disappear + await dialog.waitFor({ state: 'hidden' }) }