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 }); });