From e9e80c4e54b2b84bcb4f81f1edee10339458a3e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Mon, 18 May 2026 00:30:38 +0200 Subject: [PATCH] Fix E2E note save: use el.blur() and wait for textarea to disappear sidebar h2 click doesn't reliably blur the textarea in headless Chrome. el.blur() directly fires the native blur event; waiting for textarea to disappear confirms onBlur executed and the note was saved to Yjs. Co-Authored-By: Claude Sonnet 4.6 --- e2e/planner.test.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/e2e/planner.test.ts b/e2e/planner.test.ts index caa426d..6848da3 100644 --- a/e2e/planner.test.ts +++ b/e2e/planner.test.ts @@ -496,13 +496,16 @@ test.describe("Planner", () => { await expect(textarea).toBeVisible({ timeout: 3000 }); await textarea.fill("Refill water here"); - // Click elsewhere to blur and save the note - await sidebar.locator("h2").click(); + // Blur the textarea directly to trigger the onBlur save handler + await textarea.evaluate((el) => el.blur()); - // Note should now be displayed (no longer placeholder) + // Wait for the textarea to disappear (confirms onBlur fired and editingNoteIndex reset) + await expect(textarea).not.toBeVisible({ timeout: 3000 }); + + // Note should now be displayed as static text await expect(firstRow.getByText("Refill water here")).toBeVisible({ timeout: 3000 }); - // Give Yjs a moment to flush the transaction - await page.waitForTimeout(300); + // Allow Yjs transaction to flush + await page.waitForTimeout(500); // Open the export dropdown (▾ chevron next to Export GPX), then click Export Plan await page.getByRole("button", { name: "▾" }).click();