Files
edr-platform/e2e-ui/specs/guest/search.smoke.spec.ts

25 lines
1.0 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { resultsUrl, SCHEDULE_ID } from "../../fixtures/data";
/**
* Portal smoke (Track A foundation): deep-link to results → POST /search fires → a priced result
* card for the seeded trip renders. Proves stack + seed + search + currency formatting are wired.
*/
test("portal: seeded trip appears in search results with a price", async ({ page }) => {
const searchResponse = page.waitForResponse(
(r) => r.url().includes("/search") && r.request().method() === "POST",
);
await page.goto(resultsUrl());
const res = await searchResponse;
expect([200, 201]).toContain(res.status());
const body = await res.json();
const outbound = body?.data?.outbound ?? [];
expect(outbound.some((t: any) => t.scheduleId === SCHEDULE_ID)).toBe(true);
// The seeded train + a formatted ETB price render in the DOM.
await expect(page.getByText("UI Test Express").first()).toBeVisible({ timeout: 20_000 });
await expect(page.getByText(/ETB\s*[\d,]+/).first()).toBeVisible();
});