test: cover home filters on desktop and mobile
This commit is contained in:
@@ -38,3 +38,20 @@ test("submitted catch appears publicly only after moderation", async ({ page })
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId(spotTestId)).toBeVisible();
|
||||
});
|
||||
|
||||
for (const viewport of [{ name: "desktop", width: 1280, height: 900 }, { name: "mobile", width: 390, height: 844 }]) {
|
||||
test(`home filters work on ${viewport.name}`, async ({ page }) => {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.goto("/");
|
||||
await page.getByLabel("Водоём").selectOption("kuori");
|
||||
await page.getByLabel("Рыба").selectOption("lake-trout");
|
||||
await page.getByLabel("Период").selectOption("72");
|
||||
await page.getByLabel("Сначала").selectOption("freshness");
|
||||
await page.getByRole("button", { name: "⌕ Найти клёв" }).click();
|
||||
await expect(page).toHaveURL(/waterbody=kuori.*fish=lake-trout.*hours=72.*sort=freshness/);
|
||||
await expect(page.getByTestId("spot-85-92")).toBeVisible();
|
||||
await expect(page.getByTestId("spot-110-103")).toHaveCount(0);
|
||||
const dimensions = await page.evaluate(() => ({ width: document.documentElement.clientWidth, scroll: document.documentElement.scrollWidth }));
|
||||
expect(dimensions.scroll).toBeLessThanOrEqual(dimensions.width);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user