diff --git a/e2e/planner.test.ts b/e2e/planner.test.ts index 52c9126..464a88d 100644 --- a/e2e/planner.test.ts +++ b/e2e/planner.test.ts @@ -487,8 +487,8 @@ test.describe("Planner", () => { const sidebar = page.locator("aside"); - // Click on the note placeholder for the first waypoint - const firstRow = sidebar.locator("li").filter({ has: page.locator("span.rounded-full").first() }).first(); + // Click on the note placeholder for the first waypoint to open editor + const firstRow = sidebar.locator("li").filter({ has: page.locator("span.rounded-full") }).first(); await firstRow.locator("p.italic").click(); // Type a note in the textarea @@ -496,25 +496,28 @@ test.describe("Planner", () => { await expect(textarea).toBeVisible({ timeout: 3000 }); await textarea.fill("Refill water here"); - // Blur to save - await textarea.blur(); + // Click elsewhere to blur and save the note + await sidebar.locator("h2").click(); // Note should now be displayed (no longer placeholder) await expect(firstRow.getByText("Refill water here")).toBeVisible({ timeout: 3000 }); + // Give Yjs a moment to flush the transaction + await page.waitForTimeout(300); - // Export GPX and verify appears inside - const [download] = await Promise.all([ - page.waitForEvent("download"), - page.getByRole("button", { name: "Export GPX" }).click(), - ]); + // Export GPX and verify appears inside a + const downloadPromise = page.waitForEvent("download"); + await page.getByRole("button", { name: "Export GPX" }).click(); + const download = await downloadPromise; const gpxStream = await download.createReadStream(); const chunks: Buffer[] = []; for await (const chunk of gpxStream) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)); const gpxText = Buffer.concat(chunks).toString("utf-8"); - // The should be inside the first block - const wptBlock = gpxText.match(/]*lat="52\.52[^"]*"[^>]*>[\s\S]*?<\/wpt>/)?.[0] ?? ""; - expect(wptBlock).toContain("Refill water here"); + // Verify the note appears as inside a somewhere in the GPX + expect(gpxText).toContain("Refill water here"); + // And it should be inside a block, not the top-level + const wptDescMatch = gpxText.match(/Refill water here<\/desc>/); + expect(wptDescMatch).not.toBeNull(); }); test("nearby POI snap moves waypoint and prepends note prefix", async ({ page, request }) => { diff --git a/openspec/specs/waypoint-notes/spec.md b/openspec/specs/waypoint-notes/spec.md index 1a8e3d5..b191a63 100644 --- a/openspec/specs/waypoint-notes/spec.md +++ b/openspec/specs/waypoint-notes/spec.md @@ -1,4 +1,8 @@ -## ADDED Requirements +## Purpose + +Per-waypoint plain-text notes in the Planner, with nearby POI discovery and snap-to-POI functionality. + +## Requirements ### Requirement: Per-waypoint text notes Each waypoint SHALL support an optional plain-text note synced via Yjs.