61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { test, expect } from "./fixtures/console-gate";
|
|
import { routeAppSettingsFixture } from "./helpers/api-fixtures";
|
|
|
|
const FIXTURE_DIR = path.resolve(
|
|
path.dirname(fileURLToPath(import.meta.url)),
|
|
"../fixtures/api",
|
|
);
|
|
|
|
const URL =
|
|
"/ru-ru/schedule/KJA/SU6837-20260519/MJZ?request=schedule-route-KJA-MJZ-20260518-20260524-C0";
|
|
|
|
test("TIRREDESIGN-26: schedule details day tabs disable non-operating flight dates", async ({
|
|
page,
|
|
consoleMessages,
|
|
}) => {
|
|
await routeAppSettingsFixture(page);
|
|
await page.route("**/api/flights/v1.1/*/schedule/details?**", async (route) => {
|
|
const source = JSON.parse(
|
|
fs.readFileSync(path.join(FIXTURE_DIR, "schedule-details-vvo-mjz.json"), "utf8"),
|
|
) as {
|
|
data: {
|
|
routes: Array<{
|
|
flightId: { carrier: string; flightNumber: string; date: string };
|
|
}>;
|
|
partners: string[];
|
|
};
|
|
};
|
|
const su6837 = source.data.routes.find(
|
|
(flight) =>
|
|
flight.flightId.carrier === "SU" &&
|
|
flight.flightId.flightNumber === "6837" &&
|
|
flight.flightId.date === "2026-05-19",
|
|
);
|
|
expect(su6837).toBeTruthy();
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: "application/json",
|
|
body: JSON.stringify({
|
|
data: {
|
|
partners: [],
|
|
routes: su6837 ? [su6837] : [],
|
|
daysOfFlight: ["20260519", "20260523"],
|
|
},
|
|
}),
|
|
});
|
|
});
|
|
|
|
await page.goto(URL);
|
|
await expect(page.getByTestId("day-tabs")).toBeVisible({ timeout: 15000 });
|
|
await expect(page.getByTestId("day-tab-20260519")).toBeEnabled();
|
|
|
|
const nonOperatingFriday = page.getByTestId("day-tab-20260522");
|
|
await expect(nonOperatingFriday).toBeDisabled();
|
|
await expect(page.getByTestId("day-tab-20260523")).toBeEnabled();
|
|
|
|
await expect(page.getByTestId("schedule-details-not-found")).toHaveCount(0);
|
|
});
|