Fix aircraft link in flight details

This commit is contained in:
2026-05-14 17:02:08 +03:00
parent 4f5786ee30
commit b3d242e7e0
4 changed files with 106 additions and 1 deletions
@@ -0,0 +1,60 @@
import { test, expect } from "./fixtures/console-gate";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
// TIRREDESIGN-24 — in the online-board flight details card, the aircraft
// title under "Борт" must be a clickable external link that opens in a new tab.
// Angular renders:
// http://www.aeroflot.ru/cms/{language}/flight/plane_park
const FIXTURE_DIR = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"../fixtures/api",
);
const onlineboardDetails = fs.readFileSync(
path.join(FIXTURE_DIR, "onlineboard-details.json"),
"utf8",
);
test("Onlineboard details aircraft title opens Aeroflot plane park in a new tab", async ({
page,
context,
consoleMessages,
}) => {
await page.route("**/api/flights/v1.1/ru/onlineboard/details?**", async (route) => {
await route.fulfill({
status: 200,
contentType: "application/json",
body: onlineboardDetails,
});
});
await context.route("http://www.aeroflot.ru/cms/ru/flight/plane_park", async (route) => {
await route.fulfill({
status: 200,
contentType: "text/html",
body: "<!doctype html><title>Plane park</title>",
});
});
await page.goto("/ru-ru/onlineboard/SU6951-20260514");
const aircraftRow = page.locator('[data-testid="details-row-aircraft"]');
await expect(aircraftRow).toBeVisible({ timeout: 15000 });
await expect(aircraftRow.getByText("Борт")).toBeVisible();
const link = aircraftRow.locator("a.details-row__subtitle-link");
await expect(link).toHaveText("Sukhoi SuperJet 100");
await expect(link).toHaveAttribute(
"href",
"http://www.aeroflot.ru/cms/ru/flight/plane_park",
);
await expect(link).toHaveAttribute("target", "_blank");
const popupPromise = page.waitForEvent("popup");
await link.click();
const popup = await popupPromise;
await expect(popup).toHaveURL("http://www.aeroflot.ru/cms/ru/flight/plane_park");
await popup.close();
});