Skip to content

Commit 0ab5fb3

Browse files
committed
chore(playwright): Rewrite login handler to avoid race conditions
Assisted-by: ClaudeCode:claude-opus-4.6[1M] Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
1 parent fe12dc2 commit 0ab5fb3

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

tests/playwright/support/utils/password-confirmation.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@ export async function handlePasswordConfirmation(page: Page, password = 'admin')
1616

1717
try {
1818
// Check if the dialog exists within a short timeout
19-
const dialogVisible = await dialog.isVisible({ timeout: 500 }).catch(() => false)
19+
await dialog.waitFor({ state: 'visible', timeout: 500 })
2020

21-
if (dialogVisible) {
22-
// Fill the password field
23-
await dialog.locator('input[type="password"]').fill(password)
21+
// Fill the password field
22+
await dialog.locator('input[type="password"]').fill(password)
2423

25-
// Click the confirm button
26-
await dialog.getByRole('button', { name: 'Confirm' }).click()
24+
// Click the confirm button
25+
await dialog.getByRole('button', { name: 'Confirm' }).click()
2726

28-
// Wait for the dialog to disappear
29-
await dialog.waitFor({ state: 'hidden' })
30-
}
27+
// Wait for the dialog to disappear
28+
await dialog.waitFor({ state: 'hidden' })
3129
} catch {
3230
// Dialog didn't appear, which is fine - some operations might not require confirmation
3331
}

0 commit comments

Comments
 (0)