Files
flights_web/tests/e2e/schedule-flight-details-button.spec.ts
T
gnezim f5e41a7911
ci-deploy / build-deploy-test (push) Successful in 1m49s
Add flight details button to schedule search results
- Add flight details button to ScheduleFlightBody component
- Button positioned after Buy button (matching Angular layout)
- Button uses SHARED.FLIGHT-DETAILS translation key
- Add onFlightDetails callback to ScheduleFlightBody props
- Add handleFlightDetails to DayGroupedFlightList
- Pass onFlightDetails to ScheduleFlightBody
- Add E2E tests for flight details button functionality
2026-04-29 20:23:24 +03:00

89 lines
2.9 KiB
TypeScript

import { test, expect } from "./fixtures/console-gate";
test.describe("Schedule flight details button", () => {
test("flight details button is visible in expanded flight body", async ({
page,
}) => {
await page.goto("/ru-ru/schedule/route/SVO-LED-20260415");
const cards = page.locator(".flight-card--clickable");
await expect(cards.first()).toBeVisible({ timeout: 30000 });
await cards.first().click();
const actions = page.locator('[data-testid="schedule-flight-body-actions"]');
await expect(actions).toBeVisible({ timeout: 10000 });
const detailsBtn = actions.locator('[data-testid="flight-details-button"]');
await expect(detailsBtn).toBeVisible();
});
test("flight details button has correct label (Russian)", async ({ page }) => {
await page.goto("/ru-ru/schedule/route/SVO-LED-20260415");
const cards = page.locator(".flight-card--clickable");
await expect(cards.first()).toBeVisible({ timeout: 30000 });
await cards.first().click();
const detailsBtn = page.locator('[data-testid="flight-details-button"]');
await expect(detailsBtn).toBeVisible();
const text = await detailsBtn.textContent();
expect(text).toContain("Детали");
});
test("flight details button navigates to flight details page", async ({
page,
}) => {
await page.goto("/ru-ru/schedule/route/SVO-LED-20260415");
const cards = page.locator(".flight-card--clickable");
await expect(cards.first()).toBeVisible({ timeout: 30000 });
await cards.first().click();
const detailsBtn = page.locator('[data-testid="flight-details-button"]');
await detailsBtn.click();
await expect(page).toHaveURL(/\/ru-ru\/schedule\/[A-Z]{3}\/SU\d+-\d{8}\/[A-Z]{3}/);
});
test("flight details button works for connecting flights", async ({
page,
}) => {
await page.goto("/ru-ru/schedule/route/MOW-MMK-20260427-20260503");
const cards = page.locator(".flight-card--clickable");
await expect(cards.first()).toBeVisible({ timeout: 30000 });
const firstCard = cards.first();
await firstCard.click();
const detailsBtn = page.locator('[data-testid="flight-details-button"]');
await expect(detailsBtn).toBeVisible({ timeout: 10000 });
await detailsBtn.click();
await expect(page).toHaveURL(
/\/ru-ru\/schedule\/[A-Z]{3}\/SU\d+-\d{8}\/[A-Z]{3}\/SU\d+-\d{8}\/[A-Z]{3}/,
);
});
test("flight details button preserves search context in URL", async ({
page,
}) => {
await page.goto("/ru-ru/schedule/route/SVO-LED-20260415");
const cards = page.locator(".flight-card--clickable");
await expect(cards.first()).toBeVisible({ timeout: 30000 });
await cards.first().click();
const detailsBtn = page.locator('[data-testid="flight-details-button"]');
await detailsBtn.click();
const url = page.url();
expect(url).toContain("?request=");
expect(url).toContain("schedule-route-SVO-LED-20260415");
});
});