push to maple-street

This commit is contained in:
Tiel Coder
2026-11-20 04:07:02 +00:00
parent 2cec220a24
commit 5adf1cef1f
345 changed files with 86105 additions and 1079 deletions
+60
View File
@@ -0,0 +1,60 @@
import { test, expect } from "@playwright/test";
import { signInAs, resetDb, BASE } from "./dev";
/**
* Announcements: an admin posts a published update; a volunteer sees it but no
* authoring controls; unpublishing hides it from the volunteer feed.
*/
const title = `E2E announcement ${Date.now()}`;
test.describe("announcements", () => {
test.beforeAll(async ({ browser }) => {
const context = await browser.newContext();
const page = await context.newPage();
await resetDb(page);
await context.close();
});
test("an admin creates and publishes an announcement", async ({ page }) => {
await page.setViewportSize({ width: 1200, height: 900 });
await signInAs(page, "admin@glenloch.local");
await page.goto(`${BASE}/announcements`);
await page.getByLabel("Title").fill(title);
await page
.getByLabel("Message")
.fill("Doors open 30 minutes early this Sunday.");
await page.getByRole("button", { name: "Create announcement" }).click();
await expect(page.getByRole("heading", { name: title })).toBeVisible();
await expect(page.getByText("Published")).toBeVisible();
});
test("a volunteer sees the post but no authoring controls", async ({
page,
}) => {
await page.setViewportSize({ width: 1200, height: 900 });
await signInAs(page, "avery@glenloch.local");
await page.goto(`${BASE}/announcements`);
await expect(page.getByRole("heading", { name: title })).toBeVisible();
await expect(
page.getByRole("button", { name: "Create announcement" }),
).toHaveCount(0);
await expect(page.getByRole("button", { name: "Unpublish" })).toHaveCount(0);
});
test("unpublishing hides the post from volunteers", async ({ page }) => {
await page.setViewportSize({ width: 1200, height: 900 });
await signInAs(page, "admin@glenloch.local");
await page.goto(`${BASE}/announcements`);
await page.getByRole("button", { name: "Unpublish" }).first().click();
await expect(page.getByText("Draft")).toBeVisible();
await signInAs(page, "avery@glenloch.local");
await page.goto(`${BASE}/announcements`);
await expect(page.getByRole("heading", { name: title })).toHaveCount(0);
});
});