Fix E2E strict mode violations in multi-day tests

- "km" locator matched both header summary and stats footer — narrowed
  to match "km ·" pattern unique to the header
- "Day 1" locator matched both map label pill and sidebar header —
  scoped to sidebar with page.locator("aside")

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-04-11 00:59:03 +02:00
parent adc5b44739
commit b6bca0229b
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9

View file

@ -251,8 +251,8 @@ test.describe("Planner", () => {
await expect(page.getByText("Connected")).toBeVisible({ timeout: 15000 });
await expect(page.getByText("Waypoints (3)")).toBeVisible({ timeout: 5000 });
// Wait for route to compute
await expect(page.getByText(/\d+\.\d+ km/)).toBeVisible({ timeout: 20000 });
// Wait for route to compute — match the header summary which has "km ·"
await expect(page.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") });
@ -261,9 +261,10 @@ test.describe("Planner", () => {
const moonButton = secondRow.getByTitle(/overnight/i);
await moonButton.click();
// Day breakdown should appear
await expect(page.getByText("Day 1")).toBeVisible({ timeout: 5000 });
await expect(page.getByText("Day 2")).toBeVisible({ timeout: 5000 });
// 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 });
});
test("export GPX with day breaks includes overnight metadata", async ({ page, request }) => {
@ -306,7 +307,8 @@ test.describe("Planner", () => {
// Wait for waypoints to load
await expect(page.getByText("Waypoints (3)")).toBeVisible({ timeout: 10000 });
// The overnight waypoint should show day breakdown
await expect(page.getByText("Day 1")).toBeVisible({ timeout: 5000 });
// The overnight waypoint should show day breakdown in the sidebar
const sidebar = page.locator("aside");
await expect(sidebar.getByText("Day 1")).toBeVisible({ timeout: 5000 });
});
});