64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
import { test, expect } from "./fixtures/console-gate";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { nextOnlineboardDetailsFixture } from "./helpers/onlineboard-fixtures";
|
|
|
|
const FIXTURE_DIR = path.resolve(
|
|
path.dirname(fileURLToPath(import.meta.url)),
|
|
"../fixtures/api",
|
|
);
|
|
|
|
const baseDetails = JSON.parse(
|
|
fs.readFileSync(path.join(FIXTURE_DIR, "onlineboard-details.json"), "utf8"),
|
|
);
|
|
|
|
test("TIRREDESIGN-7: onlineboard details shows non-scheduled transition even when isActual=false", async ({
|
|
page,
|
|
consoleMessages,
|
|
}) => {
|
|
const shifted = nextOnlineboardDetailsFixture(JSON.stringify(baseDetails));
|
|
const details = JSON.parse(shifted.body);
|
|
const flight = details.data.routes[0];
|
|
const leg = flight.leg;
|
|
const isoDate = `${shifted.compactDate.slice(0, 4)}-${shifted.compactDate.slice(4, 6)}-${shifted.compactDate.slice(6, 8)}`;
|
|
|
|
flight.status = "InFlight";
|
|
leg.status = "InFlight";
|
|
leg.transition = {
|
|
registration: {
|
|
start: {
|
|
utc: `${isoDate}T07:00:00Z`,
|
|
local: `${isoDate}T10:00:00+03:00`,
|
|
dayChange: { value: 0, title: "" },
|
|
localTime: "10:00",
|
|
tzOffset: 180,
|
|
},
|
|
end: {
|
|
utc: `${isoDate}T07:30:00Z`,
|
|
local: `${isoDate}T10:30:00+03:00`,
|
|
dayChange: { value: 0, title: "" },
|
|
localTime: "10:30",
|
|
tzOffset: 180,
|
|
},
|
|
status: "InProgress",
|
|
isActual: false,
|
|
},
|
|
};
|
|
|
|
await page.route("**/api/flights/v1.1/ru/onlineboard/details?**", async (route) => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: "application/json",
|
|
body: JSON.stringify(details),
|
|
});
|
|
});
|
|
|
|
await page.goto(`/ru-ru/onlineboard/SU6951-${shifted.compactDate}`);
|
|
|
|
const registrationRow = page.locator('[data-testid="details-row-registration"]');
|
|
await expect(registrationRow).toBeVisible({ timeout: 15000 });
|
|
await expect(registrationRow.getByText("Регистрация")).toBeVisible();
|
|
await expect(registrationRow.getByText("Идет")).toBeVisible();
|
|
});
|