Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/tests/e2e/notifications.spec.ts
T

52 lines
2.9 KiB
TypeScript

import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser, tenantSettingsNotificationsPath } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Notifications-Smoke (AK-P3 / DoD D.19): Login -> Notification-Center oeffnen
* -> Interim-Screen (AD-28) sichtbar; Topbar-Glocke oeffnet das Center;
* Notification-Settings rendern die Modul-Gruppen + Master-Switch.
*
* Skippt ohne E2E-Credentials / wenn die Routen im Environment nicht erreichbar
* sind. Nicht-mutierend: keine Preferences werden geschrieben.
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const notificationsPath = process.env.E2E_TENANT_NOTIFICATIONS_CENTER_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/notifications");
test.describe("notifications smoke", () => {
test("renders the notification center and follows the topbar bell link", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Notifications smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(notificationsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Notifications path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.notifications.center"]')).toBeVisible();
// The shell exposes the notification center as a regular link so keyboard,
// browser-history and open-in-new-tab behaviour remain native.
const bell = page.locator('[data-ui-id="ui.action.shell.notifications"]');
if (await bell.isVisible()) {
await expect(bell).toHaveAttribute("href", notificationsPath);
await bell.click();
await expect(page).toHaveURL(new RegExp(`${notificationsPath.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.notifications.center"]')).toBeVisible();
}
});
test("renders the notification settings groups and master switch", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Notifications smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const settingsPath = tenantSettingsNotificationsPath(dashboardPath);
const response = await page.goto(settingsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Notification settings path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.settings.notifications.page"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.notifications.master.email"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.notifications.module.general"]')).toBeVisible();
});
});