test: harden saved plan mobile UX

This commit is contained in:
ik
2026-09-20 20:44:58 +07:00
parent 92bb878ced
commit 6ce9784d0a
4 changed files with 30 additions and 3 deletions
+26
View File
@@ -26,3 +26,29 @@ test("plan can be restored from a shareable URL", async ({ page }) => {
await expect(page.getByRole("button", { name: "Поделиться планом" })).toBeVisible();
await expect(page.getByText("1 из 5 точек")).toBeVisible();
});
test("plan caps imported entries, stays printable and fits narrow viewports", async ({ page }) => {
const plan = Array.from({ length: 6 }, (_, index) => ({
key: `/spots/vyunok-6331x633${index + 2}`,
waterbody: "Вьюнок",
coordinates: `6331:633${index + 2}`,
baits: "Тестовая приманка",
freshness: "",
confidence: "",
}));
await page.goto("/plan");
await page.evaluate((value) => localStorage.setItem("rf4spotter:fishing-plan", JSON.stringify(value)), plan);
await page.reload();
await expect(page.getByText("5 из 5 точек")).toBeVisible();
await expect(page.locator(".plan-card")).toHaveCount(5);
for (const width of [320, 390]) {
await page.setViewportSize({ width, height: 800 });
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
expect(overflow, `${width}px plan overflows`).toBeLessThanOrEqual(0);
}
await page.emulateMedia({ media: "print" });
await expect(page.getByRole("button", { name: "Печать / PDF" })).toBeHidden();
await expect(page.locator(".plan-card")).toHaveCount(5);
});