47 lines
2.2 KiB
TypeScript
47 lines
2.2 KiB
TypeScript
import { test, expect } from "./fixtures/console-gate";
|
|
import { routeScheduleVvoMjzFixtures } from "./helpers/api-fixtures";
|
|
import { vvoMjzDetailsUrl } from "./helpers/dates";
|
|
|
|
// Schedule details page must render Angular's `<schedule-details-header>`
|
|
// summary block between the day-tabs strip and the per-leg cards:
|
|
//
|
|
// • One `details-header-badge` per flight in the URL (so a connecting
|
|
// itinerary like SU 6188 + SU 6341 shows BOTH badges, not just one).
|
|
// • A right-side cluster with the share/buy/last-update controls.
|
|
// • For multi-leg trips, a `flight-details-full-route` timeline that
|
|
// spans every leg, with formatted times (`00:30`, not raw ISO).
|
|
//
|
|
// This test pins those guarantees so the page can't regress to "no
|
|
// summary header" or "first-leg-only badge / raw ISO timeline" again.
|
|
|
|
test("summary header — both badges + last-update + formatted full-route timeline", async ({ page, consoleMessages }) => {
|
|
await routeScheduleVvoMjzFixtures(page);
|
|
await page.goto(vvoMjzDetailsUrl());
|
|
|
|
const summary = page.locator(".schedule-details__summary");
|
|
await expect(summary).toBeVisible({ timeout: 15000 });
|
|
|
|
// Both flight-number badges present (SU 5752 + SU 6837).
|
|
const badges = summary.locator(".details-header-badge");
|
|
await expect(badges).toHaveCount(2);
|
|
await expect(summary).toContainText("SU 5752");
|
|
await expect(summary).toContainText("SU 6837");
|
|
|
|
// Last-update line is rendered (right-side cluster).
|
|
await expect(summary).toContainText(/Последнее обновление:\s*\d{2}:\d{2}/);
|
|
|
|
// Full-route timeline is present and shows formatted clock times
|
|
// (16:30 / 18:35 / 08:40 / 13:00) — NOT raw ISO timestamps with
|
|
// T-separators or '+03:00' offsets, which was a regression from
|
|
// using `.local` instead of `.localTime`.
|
|
const timeline = summary.locator(".full-route-timeline");
|
|
await expect(timeline).toBeVisible();
|
|
const timelineText = (await timeline.innerText()).replace(/\s+/g, " ");
|
|
expect(timelineText).toMatch(/\b16:30\b/);
|
|
expect(timelineText).toMatch(/\b18:35\b/);
|
|
expect(timelineText).toMatch(/\b08:40\b/);
|
|
expect(timelineText).toMatch(/\b13:00\b/);
|
|
expect(timelineText).not.toMatch(/2026-05-\d{2}T/);
|
|
expect(timelineText).not.toMatch(/\+\d{2}:\d{2}/);
|
|
});
|