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) <noreply@anthropic.com>
This commit is contained in:
parent
b6bca0229b
commit
f90571fc2c
1 changed files with 7 additions and 7 deletions
|
|
@ -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 });
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue