Files
flights_web/tests/e2e/schedule-details-meal-sub-icons.spec.ts

42 lines
2.1 KiB
TypeScript

import { test, expect } from "./fixtures/console-gate";
import { routeScheduleVvoMjzFixtures } from "./helpers/api-fixtures";
import { vvoMjzDetailsUrl } from "./helpers/dates";
// Schedule Details "Питание на борту" must render meal-class sub-icons
// (Эконом класс / Комфорт класс / Бизнес класс) ONLY when the API
// returns the matching `equipment.meal[].type` for that flight. Empty
// meal[] → just the cutlery icon + caption with no sub-icons. Mirrors
// Angular's `*ngIf="hasEconomyMeal"` etc. in
// flight-details-meal.component.html.
//
// Reference URL covers a connecting itinerary where both live legs
// currently return Economy / Comfort / Business meal entries.
test("Питание sub-icons appear only for legs whose API meal[] contains them", async ({
page,
consoleMessages,
}) => {
await routeScheduleVvoMjzFixtures(page);
await page.goto(vvoMjzDetailsUrl());
// Wait until both leg-details panels are mounted.
await expect(page.locator(".schedule-leg-details")).toHaveCount(2, {
timeout: 15000,
});
// ── Leg 1 (SU 5752) ───────────────────────────────────────────────
const leg1 = page.locator(".schedule-leg-details").nth(0);
await expect(leg1.getByText(/Airbus A319/i)).toBeVisible();
// Cutlery icon row + caption present.
await expect(leg1.getByText("Питание на борту")).toBeVisible();
await expect(leg1.getByText("Эконом класс")).toBeVisible();
await expect(leg1.getByText("Комфорт класс")).toBeVisible();
await expect(leg1.getByText("Бизнес класс")).toBeVisible();
// ── Leg 2 (SU 6837) ───────────────────────────────────────────────
const leg2 = page.locator(".schedule-leg-details").nth(1);
await expect(leg2.getByText("Эконом класс")).toBeVisible();
await expect(leg2.getByText("Комфорт класс")).toBeVisible();
await expect(leg2.getByText("Бизнес класс")).toBeVisible();
});