From 9e684ccf0b67f5f34df01e2a4c5f5d0bb38bbbea Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Mon, 6 Jul 2026 16:15:17 +0200 Subject: [PATCH] test(e2e): re-issue finish-day click until daily-summary nav starts The finish-day button is a routerLink inside an @if (hasDoneTasks()) / @else swap, so marking a task done re-creates the element. A one-shot click can land before Angular wires the new element's routerLink and silently no-ops, hanging archiveDoneTasks for the full 30s waitForURL. Retry the click via expect().toPass() until navigation actually starts. Recurrence of the race first addressed in b8d1dbe261. --- e2e/utils/supersync-helpers.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/e2e/utils/supersync-helpers.ts b/e2e/utils/supersync-helpers.ts index 4ff2887a41..23fb4d73c6 100644 --- a/e2e/utils/supersync-helpers.ts +++ b/e2e/utils/supersync-helpers.ts @@ -1088,12 +1088,17 @@ export const markTaskDoneByKey = async ( */ export const archiveDoneTasks = async (client: SimulatedE2EClient): Promise => { // Click the "Finish Day" button to go to Daily Summary. - // Arm waitForURL *before* clicking via Promise.all: if the click lands a hair - // before Angular wires up the routerLink (animation/CD timing), a click-then-wait - // sequence silently no-ops and only fails 30s later. Racing them removes that gap. + // The button is a routerLink inside an @if (hasDoneTasks()) / @else swap, so + // marking a task done re-creates the element; a single click can land in the + // window before Angular wires up the routerLink and silently no-ops (30s hang). + // Racing waitForURL against a one-shot click doesn't cover that gap, so re-issue + // the click until navigation actually starts. const finishDayBtn = client.page.locator('.e2e-finish-day'); await finishDayBtn.waitFor({ state: 'visible', timeout: UI_VISIBLE_TIMEOUT }); - await Promise.all([client.page.waitForURL(/daily-summary/), finishDayBtn.click()]); + await expect(async () => { + await finishDayBtn.click(); + await client.page.waitForURL(/daily-summary/, { timeout: 2000 }); + }).toPass({ timeout: UI_VISIBLE_TIMEOUT }); // Click "Save & Go Home" button (has sun icon wb_sunny) const saveAndGoHomeBtn = client.page.locator(