Files
flights_web/tests/e2e/schedule-details-mini-list-scoped.spec.ts
T

39 lines
1.8 KiB
TypeScript

import { test, expect } from "./fixtures/console-gate";
import { routeScheduleVvoMjzFixtures } from "./helpers/api-fixtures";
import { vvoMjzDetailsUrl } from "./helpers/dates";
// On the schedule details page the left mini-list renders a SINGLE
// card for the currently-open flight — matching Angular's
// `schedule-flights-mini-list`, which only falls into the
// multi-day-accordion branch when `schedule.length > 1`. Previously
// the rail showed day-±1 siblings that read as visual duplicates of
// the open flight, and before that it dumped the whole route search.
//
// For a connecting itinerary the single card must surface BOTH
// flight numbers ("SU 5752, SU 6837") and the combined
// Vladivostok→Mirny origin/destination, not just the first leg.
test("mini-list — one combined card for the open SU 5752+SU 6837 itinerary", async ({ page, consoleMessages }) => {
await routeScheduleVvoMjzFixtures(page);
await page.goto(vvoMjzDetailsUrl());
const miniList = page.locator(".schedule-mini-list");
await expect(miniList).toBeVisible({ timeout: 15000 });
// No day-grouping accordion headers, no day-siblings — just one row.
await expect(miniList.locator("[data-testid^='mini-list-day-header-']")).toHaveCount(0);
const items = miniList.locator("[data-testid^='mini-list-item-']");
await expect(items).toHaveCount(1);
const railText = (await miniList.innerText()).replace(/\s+/g, " ");
// Both flight numbers present (Angular surfaces the whole chain).
expect(railText).toContain("SU 5752");
expect(railText).toContain("SU 6837");
// Combined Vladivostok → Mirny endpoints — NOT first-leg-only
// Vladivostok → Krasnoyarsk.
expect(railText).toContain("Мирный");
expect(railText).not.toContain("Красноярск");
// No unrelated route-mates from the parent search.
expect(railText).not.toMatch(/SU\s*5644/);
});