feat(ui): refine global shell utilities

This commit is contained in:
cesnimda
2026-09-28 18:19:27 +02:00
parent 8e56ceabf5
commit 0f54007015
18 changed files with 322 additions and 63 deletions
@@ -228,6 +228,55 @@ for (const mode of ["light", "dark"] as const) for (const language of ["en", "nb
expect((await (await page.request.get(`${apiUrl}/jobapplications`)).json()).total).toBe(1);
});
test(`[P5-02 PRES-E07 E08 E09 S02] ${suffix} utility search and notification states`, async ({ page }, info) => {
test.setTimeout(90_000);
const t = translations[language];
await page.setViewportSize({ width: language === "nb" ? 390 : 1440, height: language === "nb" ? 844 : 900 });
await page.goto("/settings");
await expect(page.getByRole("heading", { level: 1, name: t.settings })).toBeVisible();
await page.route("**/api/jobapplications?**", async route => {
if (new URL(route.request().url()).searchParams.get("q") === "outage") {
await route.fulfill({ status: 503, contentType: "application/json", body: '{"message":"Search is temporarily unavailable"}' });
} else await route.continue();
});
const trigger = page.getByRole("button", { name: new RegExp(t.quickSearch) });
await trigger.focus();
await trigger.press("Enter");
const dialog = page.getByRole("dialog", { name: t.quickSearch });
const input = dialog.getByRole("textbox", { name: t.quickSearch });
await input.fill("outage");
await expect(dialog.getByRole("alert")).toBeVisible();
await expect(dialog.getByText(t.noMatchingCommands)).toHaveCount(0);
await capture(page, info, `utility-error-${suffix}`);
await scan(page, info, `utility-error-${suffix}`, '[role="dialog"]');
await input.fill("");
await input.press("End");
await input.press("Home");
await input.press("ArrowDown");
await input.press("Enter");
await expect(page).toHaveURL(/\/jobs$/);
const notification = {
id: "22222222-2222-2222-2222-222222222222", operationId: null, kind: "operation_failed",
title: "CV export failed", message: "Review the operation and try again.", linkPath: "/operations",
createdAtUtc: "2026-08-15T12:00:00Z", readAtUtc: null,
};
await page.route("**/api/notifications?limit=10", route => route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify([notification]) }));
await page.route("**/api/notifications/*/read", route => route.fulfill({ status: 200, body: "{}" }));
await page.route("**/api/notifications/*", route => route.request().method() === "DELETE"
? route.fulfill({ status: 204, body: "" }) : route.continue());
await page.getByRole("button", { name: t.notifications, exact: true }).click();
await expect(page.getByText("CV export failed")).toBeVisible();
await expect(page.getByText(t.notificationsUnread)).toBeVisible();
await capture(page, info, `utility-notifications-${suffix}`);
await scan(page, info, `utility-notifications-${suffix}`, ".MuiPopover-paper");
await page.getByRole("button", { name: t.notificationsMarkRead }).click();
await expect(page.getByRole("button", { name: t.notificationsMarkRead })).toHaveCount(0);
await page.getByRole("button", { name: t.notificationsDismiss }).click();
await expect(page.getByText("CV export failed")).toHaveCount(0);
});
test(`[P5-00 PRES-E08 C06 S05] ${suffix} real Tooltip contrast and open-toast action access`, async ({ page, owner }, info) => {
test.setTimeout(120_000);
const t = translations[language];