ci: release-verify hosts override + /api pre-warm + robust buy-button e2e
ci-deploy / build-deploy-test (push) Successful in 3m6s

release-verify.yml: three additions, all targeting the webzavod URL
(no gnerim.ru in this workflow — release-verify e2e runs against the
customer's deployed environment, not our internal preview).

1. Add /etc/hosts entry — flights-ui.devwebzavod.ru has no public DNS.
   Operator hosts resolve it via local /etc/hosts to 46.235.186.67.
   Without mirroring that on the runner every probe fails with
   "Could not resolve host" (runs 537 + 539).

2. Diagnose customer URL reachability — mirrors ci-deploy's tunnel
   probe but on the customer URL: surfaces broken /api wiring before
   the e2e suite spends 30 minutes hitting it.

3. Pre-warm /api cache — same rationale as ci-deploy: the four
   dictionary endpoints are read on every page load, and the upstream
   WAF rate-limits per source IP. Warm them once with sleeps so the
   e2e suite hits the customer's nginx cache, not the upstream WAF.

schedule-route-buy-button.spec.ts: rewritten for ci-deploy run 538.
The previous version hard-coded the first card on a URL that included
today, hitting the "today's earliest flight is < 2h out, buy button
hides" edge case. Now scans up to 8 cards looking for the buy button
on a fully-future calendar week — proves the strip + button surface
without depending on which specific rows are buyable on the day.
This commit is contained in:
2026-04-28 00:05:52 +03:00
parent 245221bcb0
commit 265fd33e9d
2 changed files with 68 additions and 22 deletions
+38
View File
@@ -32,10 +32,48 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Add hosts entry for customer URL
# `flights-ui.devwebzavod.ru` has no public DNS — operator hosts
# resolve it via local /etc/hosts to 46.235.186.67 (the customer's
# web ingress IP). Mirror that override on the runner so curl,
# node fetch, and Playwright's chromium can resolve the host.
# Without this, every probe fails with `Could not resolve host`.
run: echo "46.235.186.67 flights-ui.devwebzavod.ru" | sudo tee -a /etc/hosts
- name: Wait for customer URL
id: wait_customer
run: scripts/ci/wait-for-url.sh http://flights-ui.devwebzavod.ru/ru-ru/onlineboard 60 5
- name: Diagnose customer URL reachability
id: customer_diag
# Mirrors ci-deploy's tunnel-reachability probe but against the
# customer URL — surfaces /api wiring problems before the e2e
# suite spends 30 minutes hitting them.
run: |
echo "--- /api/health ---"
curl -sSI --max-time 10 http://flights-ui.devwebzavod.ru/api/health | head -10 || true
echo "--- /api/dictionary/1/world_regions (expect JSON, ~5KB) ---"
curl -sS --max-time 10 \
-w "\n[size=%{size_download} time=%{time_total}s code=%{http_code}]\n" \
http://flights-ui.devwebzavod.ru/api/dictionary/1/world_regions | head -c 400; echo
echo "--- second hit on the same dict (expect HIT if nginx caches) ---"
curl -sSI --max-time 10 \
http://flights-ui.devwebzavod.ru/api/dictionary/1/world_regions | grep -iE "^HTTP|x-cache|x-envoy" || true
- name: Pre-warm /api cache (dictionaries shared across e2e specs)
id: cache_warmup
# Same rationale as ci-deploy: every page load reads the four
# dictionary endpoints, and the upstream WAF rate-limits per
# source IP. Warm them once with sleeps so the e2e suite hits
# the customer's nginx cache instead of the upstream WAF.
run: |
for path in world_regions countries cities airports; do
url="http://flights-ui.devwebzavod.ru/api/dictionary/1/${path}"
rc=$(curl -sS --max-time 10 -o /dev/null -w "%{http_code}" "$url")
echo "warm $path -> HTTP $rc"
sleep 2
done
- name: Install Playwright browsers
id: playwright_install
run: pnpm exec playwright install --with-deps chromium
+30 -22
View File
@@ -11,28 +11,36 @@ import { test, expect } from "./fixtures/console-gate";
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");
// Pick a calendar week well clear of the 2h pre-departure cutoff so every
// flight in the list is inside the buy window. Earlier-this-week URLs hit
// a "today's first flight is < 2h out" edge case and the buy button hides
// on that single row, even though the rest of the list shows it.
await page.goto("/ru-ru/schedule/route/MOW-MMK-20260505-20260511");
// 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 });
// Wait for the list to render.
const cards = page.locator(".flight-card--clickable");
await expect(cards.first()).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();
// Expand each card in turn until we find one whose body strip shows the
// buy button — Angular's parity contract is "buy button surfaces on
// search results page", not "on every single row regardless of status",
// so we just need one positive proof per spec run.
const total = await cards.count();
let foundBuy = false;
for (let i = 0; i < total && i < 8; i++) {
await cards.nth(i).click();
const actions = page
.locator('[data-testid="schedule-flight-body-actions"]')
.nth(i);
await expect(actions).toBeVisible({ timeout: 10000 });
const buy = actions.locator('[data-testid="buy-ticket-button"]');
if (await buy.isVisible()) {
foundBuy = true;
break;
}
// Collapse before opening the next so we don't accumulate expanded
// rows that fight for viewport.
await cards.nth(i).click();
}
expect(foundBuy, "expected at least one expanded flight body to render buy ticket button").toBe(true);
});