Fix E2E: color mode toggle test needs a route for elevation chart

The color mode selector moved from the header to the elevation chart,
which only renders when a route exists. Updated test to use mocked
BRouter with waypoints.

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

View file

@ -123,14 +123,23 @@ test.describe("Planner", () => {
// pointer events needed for the distance-based snap detection.
test("session has color mode toggle", async ({ page, request }) => {
const response = await request.post("/api/sessions", { data: {} });
const { url } = await response.json();
const sessionResp = await request.post("/api/sessions", { data: {} });
const { url } = await sessionResp.json();
await mockBRouter(page);
// Need a route for the elevation chart (and color selector) to appear
await page.goto(`${url}?waypoints=${encodeURIComponent(JSON.stringify([
{ lat: 52.520, lon: 13.405 },
{ lat: 52.515, lon: 13.351 },
]))}`);
await page.goto(url);
await expect(page.locator(".leaflet-container")).toBeVisible({ timeout: 10000 });
await expect(page.getByText("Connected")).toBeVisible({ timeout: 15000 });
const select = page.getByTitle("Route Color");
await expect(select).toBeVisible();
// Wait for elevation chart to render with the color mode selector
const select = page.locator("select").last();
await expect(select).toBeVisible({ timeout: 10000 });
await expect(select).toHaveValue("plain");
// Switch to elevation