Files
rf4-spotter/apps/web/tests/home-results-limit.spec.ts
T

14 lines
665 B
TypeScript

import { expect, test } from "@playwright/test";
test("home focuses the first screen on five results and keeps pagination", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/");
await expect(page.locator(".spot-card")).toHaveCount(5);
await expect(page.getByRole("navigation", { name: "Пагинация" })).toBeVisible();
await expect(page.getByRole("link", { name: "Следующая →" })).toHaveAttribute("href", /offset=5/);
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
expect(overflow).toBeLessThanOrEqual(0);
});