Restore buy/share/status strip in schedule search results body

Angular search-results page renders <flight-details-body-actions> →
<flight-actions> with NO overrides inside every expanded flight body —
share/buy/register/status all surface there. A prior refactor confused
this with the dedicated /schedule/details page, where Angular's
flight-schedule-details DOES set [share]=false [buy]=false [print]=false
[details]=false [register]=false because that page-level summary owns
those affordances. The strip was removed from both contexts, leaving
the search results page (e.g. /ru-ru/schedule/route/AER-LED-…) without
any buy button when a flight is expanded.

ScheduleFlightBody now accepts an opt-in showActions flag and renders
the existing <FlightActions> at the bottom (Angular-parity gating via
canBuyTicket / canViewFlightStatus). DayGroupedFlightList opts in;
ScheduleDetailsPage stays opted out so its page-level summary remains
the single owner of share/buy on the details page.

Note on e2e: tests/e2e/schedule-route-buy-button.spec.ts asserts the
button surfaces after expanding the first card, but the local dev
server's curl-based API proxy is currently being blocked by the
upstream WAF ("Доступ к сайту временно ограничен"), so the spec runs
green only against environments that reach /api. CI + deployed
verification suites cover that path. Behaviour is also locked in by:
- ScheduleFlightBody.test.tsx — strip renders iff showActions=true
- DayGroupedFlightList.test.tsx — passes showActions=true through
This commit is contained in:
2026-04-27 22:08:01 +03:00
parent 77634147ce
commit 5db509e199
6 changed files with 154 additions and 30 deletions
@@ -0,0 +1,38 @@
import { test, expect } from "./fixtures/console-gate";
// Schedule search-results page must mirror Angular's
// `<flight-details-body-actions>` strip in each expanded flight body —
// that's where Angular surfaces the buy ticket button (TZ §4.1.14.4.4).
// The component had been silently dropped during a refactor that confused
// the search-results page with the dedicated `flight-schedule-details`
// page (which DOES suppress buy/share because its page-level summary
// owns those affordances).
test("schedule route page surfaces the buy ticket button inside an expanded flight body", async ({
page,
}) => {
await page.goto("/ru-ru/schedule/route/MOW-MMK-20260427-20260503");
// Wait for flights to render. The schedule list builds rows of
// .flight-card items inside DayGroupedFlightList.
const firstCard = page.locator(".flight-card").first();
await expect(firstCard).toBeVisible({ timeout: 30000 });
// Expand the first flight by clicking its row. FlightCard wires
// expandable=true on the schedule path so a click toggles the body.
await firstCard.click();
// The action strip (`schedule-flight-body-actions`) wraps the
// restored `<FlightActions>` row.
const actions = page
.locator('[data-testid="schedule-flight-body-actions"]')
.first();
await expect(actions).toBeVisible({ timeout: 10000 });
// The buy ticket button (FlightActions → BuyTicketButton) must be
// present whenever the flight is in the [now+2h, now+330d] window.
// Today + few days is squarely inside that window for typical flights.
await expect(
actions.locator('[data-testid="buy-ticket-button"]'),
).toBeVisible();
});