Show onboard services in schedule details
This commit is contained in:
@@ -41,7 +41,14 @@ export async function routeAppSettingsFixture(page: Page): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
export async function routePopularRequestsFixture(page: Page): Promise<void> {
|
||||
await page.route("**/api/Requests/1/getpopular", (route) =>
|
||||
fulfillJson(route, fixtureText("popular-requests.json")),
|
||||
);
|
||||
}
|
||||
|
||||
export async function routeOnlineboardRouteFixtures(page: Page): Promise<void> {
|
||||
await routePopularRequestsFixture(page);
|
||||
await routeAppSettingsFixture(page);
|
||||
await page.route("**/api/flights/v1/*/days/**/board/", (route) =>
|
||||
fulfillJson(route, fixtureText("board-days-route.json")),
|
||||
@@ -96,6 +103,45 @@ export async function routeScheduleVvoMjzFixtures(page: Page): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
export async function routeScheduleVvoMjzServicesFixtures(
|
||||
page: Page,
|
||||
): Promise<void> {
|
||||
await routeDictionaryFixtures(page);
|
||||
await routeAppSettingsFixture(page);
|
||||
await page.route("**/api/flights/v1/*/days/**/schedule/", (route) =>
|
||||
fulfillJson(route, fixtureText("schedule-days-route.json")),
|
||||
);
|
||||
await page.route("**/api/flights/1/*/schedule?**", (route) =>
|
||||
fulfillJson(route, fixtureText("schedule-search-vvo-mjz.json")),
|
||||
);
|
||||
await page.route("**/api/flights/v1.1/*/schedule/details?**", (route) => {
|
||||
const fixture = JSON.parse(fixtureText("schedule-details-vvo-mjz.json"));
|
||||
const actual = fixture.data.routes[0].leg.equipment.aircraft.actual;
|
||||
actual.onBoardServices = [
|
||||
{
|
||||
id: "2",
|
||||
title: "Space+",
|
||||
url: "http://www.aeroflot.ru/cms/ru/flight/space_plus",
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
title: "Интернет на борту",
|
||||
url: "http://www.aeroflot.ru/cms/ru/flight/on_board/at_height",
|
||||
},
|
||||
{
|
||||
id: "8",
|
||||
title: "Выбор места",
|
||||
url: "https://www.aeroflot.ru/ru-ru/additional_service/#seat_reservation",
|
||||
},
|
||||
];
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(fixture),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
interface BoardRouteFixture {
|
||||
flightId: { date?: string; dateLT?: string };
|
||||
leg: {
|
||||
|
||||
@@ -250,7 +250,7 @@ test.describe("Online Board", () => {
|
||||
await routeDictionaryFixtures(page);
|
||||
await routeOnlineboardRouteFixtures(page);
|
||||
await page.goto(`/ru/onlineboard/route/MOW-KUF-${formatYmd(new Date())}`);
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForLoadState("domcontentloaded");
|
||||
|
||||
await expect(page.locator('[data-testid="filter-accordion"]')).toBeVisible({
|
||||
timeout: 10000,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { test, expect } from "./fixtures/console-gate";
|
||||
import { routeScheduleVvoMjzServicesFixtures } from "./helpers/api-fixtures";
|
||||
|
||||
const URL =
|
||||
"/ru-ru/schedule/VVO/SU5752-20260518/KJA/SU6837-20260519/MJZ?request=schedule-route-VVO-MJZ-20260518-20260524";
|
||||
|
||||
test("schedule details render onboard services from actual aircraft data", async ({
|
||||
page,
|
||||
}) => {
|
||||
await routeScheduleVvoMjzServicesFixtures(page);
|
||||
await page.goto(URL);
|
||||
|
||||
const leg1 = page.locator(".schedule-leg-details").nth(0);
|
||||
await expect(leg1).toBeVisible({ timeout: 15000 });
|
||||
await expect(leg1.getByText("Услуги на борту")).toBeVisible();
|
||||
await expect(leg1.getByText("Space+")).toBeVisible();
|
||||
await expect(leg1.getByText("Интернет на борту")).toBeVisible();
|
||||
await expect(leg1.getByText("Выбор места")).toBeVisible();
|
||||
await expect(leg1.getByTestId("schedule-service-icon-2")).toBeVisible();
|
||||
await expect(leg1.getByTestId("schedule-service-icon-5")).toBeVisible();
|
||||
await expect(leg1.getByTestId("schedule-service-icon-8")).toBeVisible();
|
||||
|
||||
await expect(leg1.getByRole("link", { name: "Space+" })).toHaveAttribute(
|
||||
"href",
|
||||
"http://www.aeroflot.ru/cms/ru/flight/space_plus",
|
||||
);
|
||||
|
||||
const leg2 = page.locator(".schedule-leg-details").nth(1);
|
||||
await expect(leg2.getByText("Услуги на борту")).toHaveCount(0);
|
||||
});
|
||||
Reference in New Issue
Block a user