Files
rf4-spotter/apps/web/tests/waterbodies.spec.ts
T
2026-09-20 19:18:51 +07:00

28 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { expect, test } from "@playwright/test";
test("waterbody detail preserves confirmed facts and empty activity state", async ({ page }) => {
await page.goto("/waterbodies/р-вьюнок");
await expect(page.locator("h1")).toHaveText("р. Вьюнок");
await expect(page.getByText("В карточке источника указано видов рыб: 29.")).toBeVisible();
await expect(page.getByText("Изображений-кандидатов: 2; публикация требует отдельной проверки.")).toBeVisible();
await expect(page.getByText("Свежих подтверждённых видов пока нет.")).toBeVisible();
await expect(page.getByText("Свежих точек пока нет")).toBeVisible();
});
test("unknown waterbody slug has a navigable not-found state", async ({ page }) => {
await page.goto("/waterbodies/not-a-real-waterbody");
await expect(page.getByRole("heading", { name: "Водоём не найден" })).toBeVisible();
await expect(page.getByRole("alert")).toContainText("Такого водоёма нет в справочнике");
await expect(page.getByRole("link", { name: "Открыть каталог" })).toHaveAttribute("href", "/waterbodies");
});
test("unknown waterbody/fish pair keeps a clear not-found state", async ({ page }) => {
await page.goto("/waterbodies/р-вьюнок/not-a-real-fish");
await expect(page.getByRole("heading", { name: "Данные не найдены" })).toBeVisible();
await expect(page.getByRole("alert")).toContainText("Такого сочетания нет в справочнике");
await expect(page.getByRole("link", { name: "Вернуться на главную" })).toHaveAttribute("href", "/");
});