Archived
Complete command palette, ExcelTS 10, roadmap: v2 for webhooks and sent links (1.51.6)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { test, expect, loginAs } from "./fixtures";
|
||||
|
||||
// Dashboard pages the palette leaves out on purpose: role home pages it reaches through
|
||||
// "Dashboard", pages that only redirect or reuse another, and an older form nothing links to.
|
||||
const NOT_IN_PALETTE = new Set([
|
||||
"/dashboard/admin", "/dashboard/staff", "/dashboard/supervisor", // role homes ("Dashboard")
|
||||
"/dashboard/admin/settings", // its tabs are listed one by one
|
||||
"/dashboard/admin/whatsapp", "/dashboard/supervisor/sections", "/dashboard/admin/forms", // redirects / the same page
|
||||
"/dashboard/admin/cashup/[id]", // one event's cashup, from Cashup
|
||||
"/dashboard/supervisor/manual-registration", // the older manual form
|
||||
"/dashboard/user/reset-password", // from My profile & security
|
||||
]);
|
||||
|
||||
// Dashboard "Today" and "Waiting for you", and the Ctrl+K command palette (1.49.0).
|
||||
test.describe("dashboard and command palette", () => {
|
||||
test("the admin dashboard shows what's on today and what's waiting", async ({ page }) => {
|
||||
@@ -48,4 +61,30 @@ test.describe("dashboard and command palette", () => {
|
||||
await staffDialog.getByRole("combobox", { name: "Search" }).fill("scan");
|
||||
await expect(staffDialog.getByRole("option", { name: "Scan tickets" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("the palette lists every report and every dashboard page", async ({ page }) => {
|
||||
const root = path.join(__dirname, "..", "frontend", "src");
|
||||
const palette = fs.readFileSync(path.join(root, "lib", "commandPages.ts"), "utf8");
|
||||
const pages: string[] = [];
|
||||
const walk = (dir: string) => {
|
||||
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
if (e.isDirectory()) walk(path.join(dir, e.name));
|
||||
else if (e.name === "page.tsx") pages.push("/" + path.relative(path.join(root, "app"), dir).split(path.sep).join("/"));
|
||||
}
|
||||
};
|
||||
walk(path.join(root, "app", "dashboard"));
|
||||
const missing = pages.filter(p => !NOT_IN_PALETTE.has(p) && !palette.includes(`href: "${p}"`) && !palette.includes(`href: "${p}?`));
|
||||
expect(missing).toEqual([]);
|
||||
|
||||
// Reports come from the catalogue: one the old hand-made list didn't have.
|
||||
await loginAs(page, "supervisor");
|
||||
await page.goto("/dashboard/supervisor");
|
||||
await expect(page.getByRole("button", { name: /Search or jump to/ })).toBeVisible();
|
||||
await page.keyboard.press("Control+k");
|
||||
const dialog = page.getByRole("dialog", { name: "Go to or search" });
|
||||
await dialog.getByRole("combobox", { name: "Search" }).fill("medical");
|
||||
await expect(dialog.getByRole("option", { name: /Report: Medical & emergency list/ })).toBeVisible();
|
||||
await dialog.getByRole("combobox", { name: "Search" }).fill("profit");
|
||||
await expect(dialog.getByRole("option", { name: /Report: Profit report/ })).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user