feat(website): church details, settings, audit log, search engine data, safer editing

Church details saved through Accounts' church.update (live at once).
Settings: Search Console and Bing codes, Coming soon line, menu order.
Audit log and recent edits. A made share image, Event / VideoObject /
PodcastEpisode / BreadcrumbList structured data, permanent redirects
from old page addresses. Saves refused when someone else saved in
between; Ministry leaders' events; templates previewed with the
church's own content before choosing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 15:30:27 +02:00
co-authored by Claude Opus 5.5
parent d8ed238042
commit 085265392e
37 changed files with 951 additions and 91 deletions
+5 -3
View File
@@ -107,13 +107,13 @@ test("restore an older version, then publish it", async ({ page, context }) => {
test("switch template in the preview, and back, without losing anything", async ({ page, context }) => {
await signIn(context);
await page.goto("/admin/template");
await page.getByRole("button", { name: /^Bold/ }).click();
await page.getByRole("button", { name: "Use Bold" }).click();
await expect(page.getByText("Switched to Bold.")).toBeVisible();
await page.goto("/preview/start");
await expect(page.locator("html")).toHaveAttribute("data-template", "bold");
await expect(page.getByRole("heading", { level: 1, name: "A home for everyone on the hill" })).toBeVisible();
await page.goto("/admin/template");
await page.getByRole("button", { name: /^Heritage/ }).click();
await page.getByRole("button", { name: "Use Heritage" }).click();
await expect(page.getByText("Switched to Heritage.")).toBeVisible();
await page.goto("/admin/publish");
await expect(page.getByText("Nothing waiting to be published")).toBeVisible();
@@ -148,8 +148,10 @@ test("an event added and published shows on the site at once (its own Publish)",
});
test("the admin's screens are accessible", async ({ page, context }) => {
// Thirteen screens, each checked by axe.
test.setTimeout(240_000);
await signIn(context, "owner");
for (const path of ["/admin", "/admin/template", "/admin/pages", "/admin/ministries", "/admin/leaders", "/admin/messages", "/admin/events", "/admin/linked", "/admin/media", "/admin/publish", "/admin/people"]) {
for (const path of ["/admin", "/admin/template", "/admin/pages", "/admin/ministries", "/admin/leaders", "/admin/messages", "/admin/events", "/admin/linked", "/admin/media", "/admin/publish", "/admin/settings", "/admin/people", "/admin/audit"]) {
await page.goto(path);
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
const axe = await new AxeBuilder({ page }).withTags(["wcag2a", "wcag2aa", "wcag21aa", "wcag22aa"]).analyze();
+37
View File
@@ -71,3 +71,40 @@ test("robots.txt keeps the admin out; the sitemap lists the pages", async ({ pag
expect(sitemap).toContain("/visit</loc>");
expect(sitemap).not.toContain("/admin");
});
test("structured data on event and other pages, a made share image, the verification codes, a moved page", async ({ page }) => {
const backend = "http://127.0.0.1:5310";
await page.request.post(`${backend}/test/demo?template=heritage`);
await page.goto("/events");
const ld = (await page.locator('script[type="application/ld+json"]').allTextContents()).map((t) => JSON.parse(t));
expect(ld.some((x) => x["@type"] === "BreadcrumbList")).toBeTruthy();
await page.getByRole("link", { name: "Family picnic" }).first().click();
await expect(page.getByRole("heading", { level: 1, name: "Family picnic" })).toBeVisible();
const eventLd = (await page.locator('script[type="application/ld+json"]').allTextContents()).map((t) => JSON.parse(t));
const ev = eventLd.find((x) => x["@type"] === "Event");
expect(ev.name).toBe("Family picnic");
expect(ev.location["@type"]).toBe("Place");
// Pages without their own photo share a made image.
await page.goto("/visit");
const og = await page.locator('meta[property="og:image"]').getAttribute("content");
expect(og).toContain("/share-image?t=");
const img = await page.request.get(new URL(og!).pathname + new URL(og!).search);
expect(img.status()).toBe(200);
expect(img.headers()["content-type"]).toBe("image/png");
// An admin sets the codes and moves a page; the old address goes on to the new one.
const { cookie } = await (await page.request.post(`${backend}/test/session?role=editor`)).json();
const headers = { Cookie: `ccw_session=${cookie.value}`, Origin: "http://localhost:3310", "Content-Type": "application/json" };
await page.request.put("/api/v1/admin/settings", { headers, data: { googleVerification: "googleCode123", bingVerification: "bingCode456" } });
const pages = await (await page.request.get("/api/v1/admin/pages", { headers })).json();
const visit = pages.find((p: { kind: string }) => p.kind === "visit");
expect((await page.request.put(`/api/v1/admin/pages/${visit.id}`, { headers, data: { slug: "first-visit" } })).ok()).toBeTruthy();
expect((await page.request.post("/api/v1/admin/publish", { headers, data: {} })).ok()).toBeTruthy();
const moved = await page.request.get("/visit", { maxRedirects: 0 });
expect([301, 308]).toContain(moved.status());
expect(moved.headers().location).toContain("/first-visit");
await page.goto("/");
expect(await page.locator('meta[name="google-site-verification"]').getAttribute("content")).toBe("googleCode123");
expect(await page.locator('meta[name="msvalidate.01"]').getAttribute("content")).toBe("bingCode456");
});