import { expect, test } from "@playwright/test"; // Technical smoke of the real stand: the built SPA behind Nginx, the Go API // behind the /api proxy, and the error routes of both. It needs no data and // checks no candidate or employer workflow. test("start page renders the SPA in Russian", async ({ page }) => { await page.goto("/"); await expect(page.locator("html")).toHaveAttribute("lang", "ru"); await expect( page.getByRole("heading", { level: 1, name: "Протокол подтвержденных навыков" }), ).toBeVisible(); }); test("status page shows a live API", async ({ page }) => { const healthz = page.waitForResponse( (response) => new URL(response.url()).pathname === "/api/v1/healthz", ); await page.goto("/status"); await expect(page.getByRole("heading", { level: 1, name: "Технический статус" })).toBeVisible(); expect((await healthz).status()).toBe(200); await expect(page.locator("dt", { hasText: "Статус" }).locator("+ dd")).toHaveText("ok"); }); test("API healthz answers through the frontend proxy", async ({ request }) => { const response = await request.get("/api/v1/healthz"); expect(response.status()).toBe(200); expect(await response.json()).toEqual({ status: "ok" }); }); test("unknown SPA route shows the not-found page", async ({ page }) => { await page.goto("/e2e-missing-page"); await expect(page.getByRole("heading", { level: 1, name: "Страница не найдена" })).toBeVisible(); await expect(page.getByText("/e2e-missing-page")).toBeVisible(); await expect(page.getByRole("link", { name: "На главную" })).toHaveAttribute("href", "/"); }); test("unknown API route returns a not_found problem", async ({ request }) => { const response = await request.get("/api/v1/missing"); expect(response.status()).toBe(404); expect(response.headers()["content-type"]).toMatch(/^application\/problem\+json\b/); expect(await response.json()).toMatchObject({ status: 404, code: "not_found" }); });