Files
crosscode-platform/apps/events/e2e/campuses.spec.ts
T
joshuaandClaude Opus 5.5 7e8eeaa7a5 Campuses frontend, docs and e2e (1.43.0)
Site settings -> Campuses tab; campus picker in the event editor; campus
filter and badges on the events list, public events page (remembered,
starts on home campus) and reports/dashboards; /campus/<slug> pages and
sitemap; home campus on the profile; "Everyone at a campus" in email and
WhatsApp broadcasts. Help, FEATURES, SETTINGS, API docs, protocol doc
(campusCount), handover and roadmap updated; campuses seeded for e2e.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 16:45:43 +02:00

46 lines
2.1 KiB
TypeScript

import { test, expect, seed, api, API } from "./fixtures";
// Multi-campus. The campuses and the two events' campuses are seeded (e2e/support/prepare-db.js)
// with campuses off; these tests turn them on, and off again afterwards so the other specs see a
// single-campus church.
test.describe("campuses", () => {
test.beforeAll(async ({ browser }) => {
const page = await browser.newPage();
await api(page, "admin", "PUT", "/api/campuses/settings", { enabled: true });
await page.close();
});
test.afterAll(async ({ browser }) => {
const page = await browser.newPage();
await api(page, "admin", "PUT", "/api/campuses/settings", { enabled: false });
await page.close();
});
test("the events page filters by campus and keeps church-wide events", async ({ page }) => {
await page.goto("/events");
await expect(page.getByText("E2E Paid Conference")).toBeVisible();
await page.getByLabel("Campus").selectOption({ label: "E2E North" });
await expect(page.getByText("E2E Free Evening")).toBeVisible(); // North
await expect(page.getByText("E2E Alpha Course")).toBeVisible(); // all campuses
await expect(page.getByText("E2E Paid Conference")).toBeHidden(); // South
// The choice is remembered.
await page.reload();
await expect(page.getByLabel("Campus")).toHaveValue(seed().campuses.north.id);
await expect(page.getByText("E2E Paid Conference")).toBeHidden();
});
test("a campus has its own page", async ({ page }) => {
await page.goto(`/campus/${seed().campuses.north.slug}`);
await expect(page.getByRole("heading", { name: "E2E North" })).toBeVisible();
await expect(page.getByText("1 North Road")).toBeVisible();
await expect(page.getByText("E2E Free Evening")).toBeVisible();
await expect(page.getByText("E2E Paid Conference")).toBeHidden();
});
test("a campus with events can't be deleted", async ({ page }) => {
const res = await page.request.delete(`${API}/api/campuses/${seed().campuses.north.id}`, { headers: { Authorization: `Bearer ${seed().users.admin.token}` } });
expect(res.status()).toBe(409);
expect((await res.json()).code).toBe("CAMPUS_HAS_EVENTS");
});
});