Files
rf4-spotter/apps/web/tests/degradation.spec.ts
T

22 lines
855 B
TypeScript

import { expect, test } from "@playwright/test";
for (const path of [
"/waterbodies",
"/waterbodies/vyunok",
"/waterbodies/vyunok/pike",
"/fish",
"/media?type=waterbody",
"/tackle",
"/tackle/analytics",
"/tackle/items/00000000-0000-0000-0000-000000000000",
]) {
test(`${path} exposes a cache-safe unavailable state`, async ({ page }) => {
const response = await page.goto(path);
expect(response?.status(), `${path} status`).toBe(503);
expect(response?.headers()["retry-after"], `${path} retry header`).toBe("60");
expect(response?.headers()["cache-control"], `${path} cache header`).toBe("no-store");
await expect(page.getByRole("alert")).toContainText(/временно недоступ|недоступен/i);
await expect(page.locator("body")).not.toContainText(/Traceback|localhost:8000|API \d+/i);
});
}