test: cover first useful answer journey

This commit is contained in:
ik
2026-09-21 07:39:28 +07:00
parent 2ed28266df
commit 10d43013f7
3 changed files with 30 additions and 2 deletions
+25
View File
@@ -0,0 +1,25 @@
import { expect, test } from "@playwright/test";
test("player can complete the first useful answer journey", async ({ page }) => {
const query = "/?hours=24&sort=activity";
await page.setViewportSize({ width: 390, height: 844 });
await page.goto(query);
await page.evaluate(() => localStorage.removeItem("rf4spotter:fishing-plan"));
const firstCard = page.locator(".spot-card").first();
await expect(firstCard).toBeVisible();
await expect(firstCard.getByText("Открыть точку")).toBeVisible();
await firstCard.getByText("Открыть точку").click();
await expect(page.getByRole("heading", { name: /^Точка / })).toBeVisible();
await expect(page.getByRole("heading", { name: "Что взять" })).toBeVisible();
const save = page.getByRole("button", { name: "Сохранить в план" });
await save.click();
await expect(page.getByRole("button", { name: "В плане" })).toHaveAttribute("aria-pressed", "true");
await page.goBack();
await expect(page).toHaveURL(query);
await page.goto("/plan");
await expect(page.getByText("1 из 5 точек")).toBeVisible();
await expect(page.getByRole("link", { name: "Открыть точку" })).toBeVisible();
});