fix(e2e): wait for dialog close animation in deleteTask helper

The deleteTask() helper was clicking the confirmation dialog Delete
button but not waiting for the dialog to actually close. This caused
a race condition where tests would immediately check for the undo
snackbar before it could appear, leading to timeouts.

The fix adds a proper wait for the dialog container to be hidden
after clicking Delete, ensuring the close animation completes and
NgRx effects have time to dispatch the snackbar action.

Fixes CI E2E workflow failure in "Undo task delete syncs restored
task to other client" test.
This commit is contained in:
Johannes Millan 2026-01-19 12:09:50 +01:00
parent 7dcf0b77df
commit cf317036de

View file

@ -536,11 +536,20 @@ export const deleteTask = async (
// Confirm deletion if dialog appears
const confirmBtn = client.page.locator('mat-dialog-actions button:has-text("Delete")');
if (
await confirmBtn.isVisible({ timeout: UI_VISIBLE_TIMEOUT_SHORT }).catch(() => false)
) {
const dialogAppeared = await confirmBtn
.isVisible({ timeout: UI_VISIBLE_TIMEOUT_SHORT })
.catch(() => false);
if (dialogAppeared) {
await confirmBtn.click();
// Wait for dialog to close (not just click the button)
// This ensures the close animation completes before continuing
await client.page
.locator('mat-dialog-container')
.waitFor({ state: 'hidden', timeout: UI_VISIBLE_TIMEOUT });
}
// Wait for UI to settle after deletion
await client.page.waitForTimeout(UI_SETTLE_STANDARD);
};