e2e: budget user/admin title asserts to 60s for cold Anubis PoW
This commit is contained in:
1 parent
9c593476af
commit
912c0edeff
2 files changed
+41
-16
No files matched your search
@@ -1,25 +1,35 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
// The user-facing homepage as a standard (non-admin) authenticated user.
|
||||
// Expected panels derive from the registry the homepage itself renders
|
||||
// (/services.json), so a registry edit updates the test instead of breaking it.
|
||||
|
||||
test("user homepage renders only user-category services", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page).toHaveTitle(/frank — services/);
|
||||
await expect(page).toHaveTitle(/frank — services/, { timeout: 60_000 });
|
||||
|
||||
const registry: { name: string; category: string }[] = await (await page.request.get("/services.json")).json();
|
||||
const userNames = registry.filter((s) => s.category === "user").map((s) => s.name);
|
||||
|
||||
// Panels hydrate client-side; poll the count, then compare exact sets.
|
||||
await expect
|
||||
.poll(() => page.locator("#grid .panel .name").count(), { timeout: 60_000 })
|
||||
.toBe(userNames.length);
|
||||
const names = await page.locator("#grid .panel .name").allTextContents();
|
||||
expect(names.length).toBeGreaterThanOrEqual(9);
|
||||
for (const wanted of ["SearXNG", "OpenWebUI", "Gitea", "RomM", "Jellyfin", "Seerr"]) {
|
||||
expect(names, `user panel for ${wanted}`).toContain(wanted);
|
||||
}
|
||||
for (const adminOnly of ["Grafana", "Prometheus", "Loki", "Hermes"]) {
|
||||
expect(names, `admin service ${adminOnly} must not leak into user grid`).not.toContain(adminOnly);
|
||||
}
|
||||
|
||||
expect([...names].sort()).toEqual([...userNames].sort());
|
||||
// RBAC tripwire: an admin-category panel in the user grid means the gate leaks.
|
||||
expect(names).not.toContain("Grafana");
|
||||
});
|
||||
|
||||
test("user homepage exposes exactly the registry's open links", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page.locator("#grid a.open")).toHaveCount(9);
|
||||
const registry: { name: string; category: string; showLink: boolean }[] = await (
|
||||
await page.request.get("/services.json")
|
||||
).json();
|
||||
const openCount = registry.filter((s) => s.category === "user" && s.showLink).length;
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.locator("#grid a.open")).toHaveCount(openCount, { timeout: 60_000 });
|
||||
const hrefs = await page.locator("#grid a.open").evaluateAll((els) =>
|
||||
els.map((el) => (el as HTMLAnchorElement).getAttribute("href")),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user