Audit log: search (person, target, IP), role filter, every action in the filter, inclusive To date. Data requests: search and paging (was cut at 200). Webhook deliveries: status filter and Load older. Supervisor Payments loads only what it needs (unpaid registrations, recent/today/donation payments, a person's own for refunds) instead of everything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot
52 lines
2.7 KiB
TypeScript
52 lines
2.7 KiB
TypeScript
import { test, expect, seed, loginAs, api } from "./fixtures";
|
|
|
|
// 1.50.1: long lists load a page (or just what's needed) at a time, with search and filters.
|
|
test.describe("long lists", () => {
|
|
test("Payments: today, recent and a person's payments for a refund", async ({ page }) => {
|
|
// A donation recorded today for the seeded user (on an event no other test totals up).
|
|
await api(page, "supervisor", "POST", "/api/payments", {
|
|
amount: 77, method: "cash", isDonation: true, eventId: seed().events.conference, userId: seed().users.user.id,
|
|
});
|
|
|
|
await loginAs(page, "supervisor");
|
|
await page.goto("/dashboard/supervisor/payments");
|
|
await expect(page.getByText("R 77.00").first()).toBeVisible();
|
|
|
|
// Refund: picking the person loads their payments.
|
|
await page.locator("label", { hasText: "Refund" }).first().click();
|
|
await page.getByPlaceholder("Search by name, email or phone…").last().fill(seed().users.user.name);
|
|
await page.getByRole("button", { name: new RegExp(seed().users.user.name) }).first().click();
|
|
await expect(page.locator("option", { hasText: "R 77.00" })).toHaveCount(1);
|
|
});
|
|
|
|
test("Payments API: narrowing filters", async ({ page }) => {
|
|
const userId = seed().users.user.id;
|
|
const mine = await api<{ data: { userId: string }[] }>(page, "supervisor", "GET", `/api/payments?userId=${userId}&limit=200`);
|
|
expect(mine.data.length).toBeGreaterThan(0);
|
|
expect(mine.data.every((p) => p.userId === userId)).toBe(true);
|
|
|
|
const unpaid = await api<{ status: string }[]>(page, "supervisor", "GET", "/api/registrations?unpaid=1");
|
|
expect(unpaid.every((r) => ["pending", "confirmed", "partial_paid"].includes(r.status))).toBe(true);
|
|
});
|
|
|
|
test("Audit log: search and the full list of actions", async ({ page }) => {
|
|
await loginAs(page, "admin");
|
|
await page.goto("/dashboard/admin/audit-log");
|
|
const action = page.getByLabel("Action");
|
|
await expect(action.locator("option", { hasText: "Bulk action on registrations" })).toHaveCount(1);
|
|
await expect(action.locator("option", { hasText: "Webhook added, changed or deleted" })).toHaveCount(1);
|
|
|
|
await page.getByLabel("Search").fill("nobody-matches-this-xyz");
|
|
await expect(page.getByText("No matching audit entries.")).toBeVisible();
|
|
await expect(page.getByText(/0 actions match the filters/)).toBeVisible();
|
|
await page.getByRole("button", { name: "Clear filters" }).click();
|
|
await expect(page.getByLabel("Search")).toHaveValue("");
|
|
});
|
|
|
|
test("Data requests: search", async ({ page }) => {
|
|
const res = await api<{ requests: unknown[]; total: number }>(page, "admin", "GET", "/api/privacy/requests?status=closed&search=nobody-matches-this-xyz");
|
|
expect(res.requests).toEqual([]);
|
|
expect(res.total).toBe(0);
|
|
});
|
|
});
|