35 lines
1.4 KiB
TypeScript
35 lines
1.4 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
// The admin panel as a homepage-admins member. The 200 itself is the RBAC
|
|
// allow-leg: the same path returns 403 for the standard user (10-homepage).
|
|
|
|
test("admin panel renders admin-category services", async ({ page }) => {
|
|
await page.goto("/admin/");
|
|
await expect(page).toHaveTitle(/frank — admin/);
|
|
|
|
const names = await page.locator("#grid .panel .name").allTextContents();
|
|
for (const wanted of ["Grafana", "Prometheus", "Loki"]) {
|
|
expect(names, `admin panel for ${wanted}`).toContain(wanted);
|
|
}
|
|
expect(names, "user services stay out of the admin grid").not.toContain("SearXNG");
|
|
});
|
|
|
|
test("admin open links reach their apps through SSO", async ({ page }) => {
|
|
await page.goto("/admin/");
|
|
const hrefs = await page.locator("#grid a.open").evaluateAll((els) =>
|
|
els.map((el) => (el as HTMLAnchorElement).href),
|
|
);
|
|
expect(hrefs.length).toBe(3); // grafana, prometheus, loki
|
|
|
|
for (const href of hrefs) {
|
|
const target = new URL(href);
|
|
await page.goto(href);
|
|
await expect
|
|
.poll(() => new URL(page.url()).hostname, { timeout: 60_000 })
|
|
.toBe(target.hostname);
|
|
expect(await page.locator('input[name="uidField"]').count()).toBe(0);
|
|
const resp = await page.request.get(page.url());
|
|
expect(resp.status(), `${target.hostname} must answer, not error`).toBeLessThan(500);
|
|
}
|
|
});
|