feat: clarify home query context

This commit is contained in:
ik
2026-09-20 19:55:33 +07:00
parent d1a5ad1b22
commit 7efdb1a16a
5 changed files with 39 additions and 4 deletions
+26
View File
@@ -0,0 +1,26 @@
import { expect, test } from "@playwright/test";
test("home makes the selected query context explicit and shareable", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/?waterbody=kuori&fish=lake-trout&hours=72&sort=freshness");
await expect(page.getByRole("heading", { name: "Озёрная форель · Куори" })).toBeVisible();
await expect(page.getByText("72 часа · Сначала свежие")).toBeVisible();
await expect(page.getByRole("link", { name: "Сбросить запрос" })).toHaveAttribute("href", "/#results");
await expect(page.getByLabel("Водоём")).toHaveValue("kuori");
await expect(page.getByLabel("Рыба")).toHaveValue("lake-trout");
await expect(page.getByLabel("Период")).toHaveValue("72");
await expect(page.getByLabel("Сначала")).toHaveValue("freshness");
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
expect(overflow).toBeLessThanOrEqual(0);
});
test("empty filtered result offers a clear way back to the full dataset", async ({ page }) => {
await page.goto("/?waterbody=kuori&fish=lake-trout&hours=6&sort=freshness");
const emptyState = page.getByRole("heading", { name: "Пока нет свежих данных" });
if (await emptyState.isVisible()) {
await expect(page.getByRole("link", { name: "Показать все данные" })).toHaveAttribute("href", "/#results");
}
});