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 den Drawer; * 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 opens the topbar drawer", 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(); // Topbar bell opens the interim drawer (AD-28) instead of navigating. const bell = page.locator('[data-ui-id="ui.action.shell.notifications"]'); if (await bell.isVisible()) { await bell.click(); await expect(page.locator('[data-ui-id="ui.notifications.drawer"]')).toBeVisible(); await page.locator('[data-ui-id="ui.notifications.drawer.close"]').click(); } }); 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(); }); });