Files
rf4-spotter/apps/web/tests/task-journey.spec.ts
T

26 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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();
});