Timed jobs move from in-process timers to a job registry run by pg-boss: once per schedule across processes, retries, run history, cron schedules in the church timezone, and an admin Background jobs page with Run now. Playwright end-to-end tests run against their own seeded database. A Gitea Actions workflow runs backend tests, frontend checks and the e2e tests, and deploys v* tags with scripts/deploy.sh once secrets are set. Also fixes the at-the-door check-in count for multi-day tickets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
3.4 KiB
TypeScript
63 lines
3.4 KiB
TypeScript
import { test, expect, seed, loginAs, api } from "./fixtures";
|
||
|
||
type EventRow = { id: string; title: string; scheduleType?: string; sessions?: { cancelled?: boolean }[] };
|
||
|
||
test.describe("supervisor tools", () => {
|
||
test("create a weekly multi-session event in the wizard", async ({ page }) => {
|
||
await loginAs(page, "supervisor");
|
||
await page.goto("/dashboard/supervisor/events");
|
||
await page.getByRole("button", { name: "+ Add Event" }).click();
|
||
await expect(page.getByRole("heading", { name: "New Event" })).toBeVisible();
|
||
|
||
await page.getByPlaceholder("Event title").fill("E2E Wizard Course");
|
||
await page.getByRole("button", { name: "Multiple sessions" }).click();
|
||
// The repeat pattern defaults to weekly, 18:30–20:30, 5 sessions from today.
|
||
await page.getByRole("button", { name: "Create sessions" }).click();
|
||
await expect(page.getByText(/^5 sessions — edit any date/)).toBeVisible();
|
||
await page.locator('input[type="number"][placeholder="0"]').first().fill("250");
|
||
|
||
// Through the remaining steps to Create Event.
|
||
const create = page.getByRole("button", { name: "Create Event" });
|
||
for (let i = 0; i < 15 && !(await create.isVisible()); i++) {
|
||
await page.getByRole("button", { name: "Next →" }).click();
|
||
}
|
||
await create.click();
|
||
await expect(page.getByRole("heading", { name: "New Event" })).toBeHidden();
|
||
|
||
const row = page.locator("li", { hasText: "E2E Wizard Course" });
|
||
await expect(row.getByText(/5 sessions · /)).toBeVisible();
|
||
const all = await api<EventRow[]>(page, "supervisor", "GET", "/api/events/all");
|
||
const created = all.find((e) => e.title === "E2E Wizard Course");
|
||
expect(created?.scheduleType).toBe("sessions");
|
||
expect(created?.sessions?.filter((s) => !s.cancelled)).toHaveLength(5);
|
||
});
|
||
|
||
test("self-service kiosk: a visitor registers for a free event", async ({ page }) => {
|
||
await page.goto("/self-service");
|
||
await page.getByPlaceholder("supervisor@example.com").fill(seed().users.supervisor.email);
|
||
await page.getByPlaceholder("••••••••").fill("E2e-password-123");
|
||
await page.getByRole("button", { name: "Sign In" }).click();
|
||
await expect(page.getByText("Signed in as supervisor")).toBeVisible();
|
||
const value = await page.locator("option", { hasText: "E2E Free Evening" }).getAttribute("value");
|
||
await page.locator("select").selectOption(value!);
|
||
await page.getByRole("button", { name: "Start Kiosk" }).click();
|
||
|
||
await expect(page.getByRole("heading", { name: "E2E Free Evening" })).toBeVisible();
|
||
await page.getByPlaceholder("john@example.com").fill("walkin@e2e.test");
|
||
await page.getByPlaceholder("+27 82 000 0000").fill("0820000099");
|
||
await page.getByPlaceholder("John Smith").fill("Walk In Visitor");
|
||
await page.getByRole("button", { name: "+" }).first().click();
|
||
await page.getByRole("button", { name: "Register", exact: true }).click();
|
||
await expect(page.getByRole("heading", { name: "You're Registered!" })).toBeVisible();
|
||
});
|
||
|
||
test("admin: background jobs page", async ({ page }) => {
|
||
await loginAs(page, "admin");
|
||
await page.goto("/dashboard/admin/settings?tab=jobs");
|
||
await expect(page.getByRole("heading", { name: "Background jobs" })).toBeVisible();
|
||
// The e2e backend runs with JOBS_ENABLED=false.
|
||
await expect(page.getByText(/All background jobs are switched off/)).toBeVisible();
|
||
await expect(page.getByText("Session reminders and certificates")).toBeVisible();
|
||
});
|
||
});
|