From f90571fc2ccba9998d0c371ba04a07a430985e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sat, 11 Apr 2026 01:02:02 +0200 Subject: [PATCH] Fix overnight E2E test: use nearby waypoints, scope locators to sidebar The test used waypoints 300km apart causing BRouter timeouts. Switched to nearby Berlin waypoints for fast route computation. Scoped all locators to the sidebar to avoid strict mode violations from map elements matching the same text. Co-Authored-By: Claude Opus 4.6 (1M context) --- e2e/planner.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/planner.test.ts b/e2e/planner.test.ts index 9a54bb5..eabcc7b 100644 --- a/e2e/planner.test.ts +++ b/e2e/planner.test.ts @@ -240,29 +240,29 @@ test.describe("Planner", () => { const sessionResp = await request.post("/api/sessions", { data: {} }); const { url } = await sessionResp.json(); - // Create session with 3 waypoints + // Create session with 3 nearby waypoints (short route for fast BRouter response) await page.goto(`${url}?waypoints=${encodeURIComponent(JSON.stringify([ { lat: 52.520, lon: 13.405 }, - { lat: 51.840, lon: 12.243 }, - { lat: 50.980, lon: 11.028 }, + { lat: 52.516, lon: 13.377 }, + { lat: 52.510, lon: 13.390 }, ]))}`); await expect(page.locator(".leaflet-container")).toBeVisible({ timeout: 10000 }); await expect(page.getByText("Connected")).toBeVisible({ timeout: 15000 }); await expect(page.getByText("Waypoints (3)")).toBeVisible({ timeout: 5000 }); - // Wait for route to compute — match the header summary which has "km ·" - await expect(page.getByText(/\d+\.\d+ km ·/)).toBeVisible({ timeout: 20000 }); + // Wait for route to compute — the header summary shows distance + const sidebar = page.locator("aside"); + await expect(sidebar.getByText(/\d+\.\d+ km/)).toBeVisible({ timeout: 20000 }); // Hover waypoint 2 to reveal controls, click the overnight toggle (moon icon) - const waypointRows = page.locator("li").filter({ has: page.locator("span.rounded-full") }); + const waypointRows = sidebar.locator("li").filter({ has: page.locator("span.rounded-full") }); const secondRow = waypointRows.nth(1); await secondRow.hover(); const moonButton = secondRow.getByTitle(/overnight/i); await moonButton.click(); // Day breakdown should appear in the sidebar - const sidebar = page.locator("aside"); await expect(sidebar.getByText("Day 1")).toBeVisible({ timeout: 5000 }); await expect(sidebar.getByText("Day 2")).toBeVisible({ timeout: 5000 }); });