Files
glenloch-media/e2e/calendar.spec.ts
2026-11-20 04:07:02 +00:00

30 lines
1.1 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { signInAs, BASE } from "./dev";
/** Week / month / year lenses over the same schedule. */
test.describe("calendar views", () => {
test("switches between week, month, and year", async ({ page }) => {
await page.setViewportSize({ width: 1024, height: 900 });
await signInAs(page, "admin@glenloch.local");
await page.goto(`${BASE}/schedule`);
await expect(page.getByRole("link", { name: "Week" })).toHaveAttribute(
"aria-current",
"page",
);
await page.getByRole("link", { name: "Month" }).click();
await expect(page).toHaveURL(/view=month/);
await expect(page.getByRole("link", { name: "Month" })).toHaveAttribute(
"aria-current",
"page",
);
await expect(page.getByText(/Every service this month/)).toBeVisible();
await page.getByRole("link", { name: "Year" }).click();
await expect(page).toHaveURL(/view=year/);
await expect(page.getByText(/A year at a glance/)).toBeVisible();
await expect(page.getByTestId("year-calendar").locator("a")).toHaveCount(12);
});
});