From 5aa03674a53caf144bdd337bb114279777f095e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 8 Aug 2026 23:23:15 +0200 Subject: [PATCH] test(e2e): click the always-present vaccination add button The capture helper branched on an instant isVisible() read to pick between the header add and the empty-state add. Right after a navigation that read races the client render and loses, so it fell through to the empty-state button, which is gone once a record exists, and the click timed out. The header add renders in both states; clicking it directly lets click() auto-wait for hydration. --- e2e/vaccinations.spec.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/e2e/vaccinations.spec.ts b/e2e/vaccinations.spec.ts index 3cdf09356..37b1bddc4 100644 --- a/e2e/vaccinations.spec.ts +++ b/e2e/vaccinations.spec.ts @@ -84,14 +84,11 @@ async function captureDose( booster: "confirm" | "decline" | "none"; }, ): Promise { - const add = page.locator('[data-slot="vaccination-add"]').first(); - const addEmpty = page.locator('[data-slot="vaccination-add-empty"]').first(); - // The list uses a header Add; the empty state uses its own. - if (await add.isVisible().catch(() => false)) { - await add.click(); - } else { - await addEmpty.click(); - } + // The header Add renders whether or not the list is empty, so clicking it + // works in both states. click() auto-waits for the button to be actionable, + // which avoids racing an instant visibility read against the client render + // (an empty-state-only branch times out once a record already exists). + await page.locator('[data-slot="vaccination-add"]').first().click(); await expect(page.locator('[data-slot="vaccination-form"]')).toBeVisible();