Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -1,14 +1,13 @@
import { expect, test, type Page } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { loginAsTenantUser } from "./utils/auth";
import { loginAsAdminUser } from "./utils/auth";
import { expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { escapeRegExp, interceptCurrentRoutePost, postDataIncludesField, skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
// Admin-host pages need a dedicated OPERATOR admin user — the shared tenant user
// must not be one (it would redirect to the admin host on login and break every
// tenant-app login flow). The seed provisions `e2e.admin@example.test` with an
// AdminUser row + the global SuperAdmin role and emits E2E_ADMIN_EMAIL/PASSWORD.
// Admin-host pages use the canonical local platform admin. The shared tenant
// user must not be an operator (it would redirect to the admin host and break
// tenant-app login flows), so the seed emits the identities separately.
const adminCredentials =
process.env.E2E_ADMIN_EMAIL && process.env.E2E_ADMIN_PASSWORD
? { email: process.env.E2E_ADMIN_EMAIL, password: process.env.E2E_ADMIN_PASSWORD }
@@ -97,7 +96,7 @@ test.describe("admin email sequences mobile a11y", () => {
});
async function openAdminEmailSequences(page: Page): Promise<void> {
await loginAsTenantUser(page, adminCredentials!);
await loginAsAdminUser(page, adminCredentials!);
const response = await page.goto(adminEmailSequencesPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Admin email sequence path is not reachable in this environment");
}
@@ -0,0 +1,26 @@
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { loginAsAdminUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = process.env.E2E_ADMIN_EMAIL && process.env.E2E_ADMIN_PASSWORD
? { email: process.env.E2E_ADMIN_EMAIL, password: process.env.E2E_ADMIN_PASSWORD }
: null;
test.describe("AK-P19 platform admin interim screens", () => {
test("opens billing, jobs, health and support through the admin host", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_ADMIN_EMAIL", "E2E_ADMIN_PASSWORD"], "Skipping authenticated platform-admin smoke");
await loginAsAdminUser(page, credentials!);
const routes = ["/accounts/billing", "/jobs", "/health", "/support", "/accounts/new"] as const;
const ids = ["ui.admin.billing.page", "ui.admin.jobs.page", "ui.admin.health.page", "ui.admin.support.page", "ui.admin.accounts.create.page"] as const;
for (let index = 0; index < routes.length; index += 1) {
const response = await page.goto(routes[index], { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `AK-P19 admin route ${routes[index]} is unavailable`);
await expect(page.locator(`[data-ui-id="${ids[index]}"]`)).toBeVisible();
}
await expectNoCriticalA11yViolations(page);
});
});
@@ -1,5 +1,5 @@
import { expect, test } from "./utils/test";
import { loginAsTenantUser } from "./utils/auth";
import { loginAsAdminUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
@@ -24,7 +24,7 @@ const auditPath = process.env.E2E_ADMIN_AUDIT_PATH ?? "/audit";
test.describe("audit viewer smoke", () => {
test("renders the audit list with filter bar and export CTA", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_ADMIN_EMAIL", "E2E_ADMIN_PASSWORD"], "Audit smoke inputs not configured");
await loginAsTenantUser(page, adminCredentials!);
await loginAsAdminUser(page, adminCredentials!);
const response = await page.goto(auditPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Audit path is not reachable in this environment");
@@ -23,8 +23,7 @@ test.describe("auth golden path", () => {
const passwordInput = page.locator('input[type="password"], input[name="password"], input#password').first();
if ((await passwordInput.count()) > 0 && (await passwordInput.isVisible())) {
const requirements = page.locator('[aria-live="polite"]').first();
await expect(requirements).toBeVisible();
await expect(page.getByRole("progressbar", { name: /password strength|passwortstärke/iu })).toHaveAttribute("aria-label");
}
await expectNoCriticalA11yViolations(page);
@@ -8,8 +8,8 @@ const authRoutes = ["/login", "/forgot-password", "/reset", "/auth/magic-link",
// before auth and redirects home instead. Falls back to the default-seed "acme".
const tenantSlug = process.env.E2E_TENANT_ACCOUNT_SLUG ?? "acme";
const tenantProtectedRoutes = [
`/${tenantSlug}/settings/plugins`,
`/${tenantSlug}/settings/subscription`,
`/${tenantSlug}/settings/integrations/plugins`,
`/${tenantSlug}/settings/billing`,
`/${tenantSlug}/workflow-engine`,
`/${tenantSlug}/workflow-engine/workflows/example/run/manual`,
];
@@ -39,10 +39,10 @@ test.describe("authenticated mobile locale persistence", () => {
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expectAuthenticatedLocaleMobileReadinessPage(page, targetLocale);
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar.mobile"], [data-mobile="true"]').first();
await expect(mobileSidebar).toBeHidden();
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar"]').first();
await expect.poll(() => sidebarLeft(mobileSidebar)).toBeLessThan(0);
await page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').click();
await expect(mobileSidebar).toBeVisible();
await expect.poll(() => sidebarLeft(mobileSidebar)).toBeGreaterThanOrEqual(0);
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first()).toBeVisible();
const settingsLink = mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first();
@@ -50,7 +50,7 @@ test.describe("authenticated mobile locale persistence", () => {
await settingsLink.click();
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(tenantSettingsProfilePath(dashboardPath))}(?:[?#].*)?$`, "u"));
await expect(mobileSidebar).toBeHidden();
await expect.poll(() => sidebarLeft(mobileSidebar)).toBeLessThan(0);
await expectAuthenticatedLocaleMobileReadinessPage(page, targetLocale);
} finally {
await restoreLocale(page, initialLocale);
@@ -58,6 +58,10 @@ test.describe("authenticated mobile locale persistence", () => {
});
});
async function sidebarLeft(sidebar: ReturnType<Page["locator"]>): Promise<number> {
return (await sidebar.boundingBox())?.x ?? Number.NEGATIVE_INFINITY;
}
async function currentHtmlLocale(page: Page): Promise<string> {
return (await page.locator("html").getAttribute("lang")) ?? "";
}
@@ -0,0 +1,50 @@
// R-P12b flow editor smoke (DoD 19): login -> /automations -> open the flow
// editor -> the fullscreen canvas renders, the picker drawer opens from the
// bottom toolbar, and the dry-run dialog opens without side effects.
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const automationsPath = process.env.E2E_TENANT_AUTOMATIONS_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/automations");
test.describe("automation flow editor (R-P12b)", () => {
test("opens the editor, the picker drawer, and the dry-run dialog", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping authenticated automations smoke");
await loginAsTenantUser(page, credentials!);
const listResponse = await page.goto(automationsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, listResponse, automationsPath);
// The list links every rule to its editor route; without a seeded rule the
// smoke cannot exercise the editor and is skipped rather than red.
const editLink = page.locator(`a[href*="/automations/"][href$="/edit"]`).first();
if ((await editLink.count()) === 0) {
test.skip(true, "No automation rule available to open the flow editor");
}
await editLink.click();
await page.waitForURL(/\/automations\/[^/]+\/edit/u);
await expect(page.locator('[data-ui-id="ui.automation.editor"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.automation.editor.canvas"]')).toBeVisible();
await expect(page.locator(".react-flow__node").first()).toBeVisible({ timeout: 10_000 });
// Main action: the picker drawer opens and offers catalog nodes.
await page.locator('[data-ui-id="ui.automation.editor.openPicker"]').click();
await expect(page.locator('[data-ui-id="ui.automation.editor.picker"]')).toBeVisible();
await expect(page.locator('[data-ui-id^="ui.automation.editor.picker.category."]').first()).toBeVisible();
await page.keyboard.press("Escape");
// Dry run stays a preview: the dialog opens, nothing is submitted yet.
await page.locator('[data-ui-id="ui.automation.editor.dryRunTrigger"]').click();
await expect(page.locator('[data-ui-id="ui.automation.editor.dryRun"]')).toBeVisible();
await page.keyboard.press("Escape");
// No horizontal page overflow on the fullscreen editor.
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
expect(overflow).toBeLessThanOrEqual(1);
});
});
@@ -0,0 +1,54 @@
import { mkdir } from "node:fs/promises";
import path from "node:path";
import { expect, test, type Page, type TestInfo } from "@playwright/test";
const reviewDirectory = process.env.BILL14_SCREENSHOT_DIR?.trim();
async function capture(page: Page, testInfo: TestInfo, name: string): Promise<void> {
const screenshotPath = reviewDirectory ? path.join(reviewDirectory, `${name}.png`) : testInfo.outputPath(`${name}.png`);
await mkdir(path.dirname(screenshotPath), { recursive: true });
await page.screenshot({ path: screenshotPath, fullPage: true, animations: "disabled" });
}
test.describe("BILL-14 public registration plan advisor", () => {
test("keeps account data while recommending and overriding a team plan", async ({ page }, testInfo) => {
const adviceReady = page.waitForResponse((response) => {
const url = new URL(response.url());
return url.pathname === "/auth/registration-plan-advice" && response.status() === 200;
});
await page.goto("/register");
await adviceReady;
await expect(page.locator('[data-ui-id="ui.auth.register.accountStep"]')).toBeVisible();
await capture(page, testInfo, "01-register-account");
await page.locator('[data-ui-id="ui.auth.register.email"]').fill("bill14-visual@example.test");
const password = page.locator('[data-ui-id="ui.auth.register.password"]');
if (await password.isVisible().catch(() => false)) await password.fill("HiveGrid-BILL14-Visual-2026!");
await page.locator('[data-ui-id="ui.auth.register.firstName"]').fill("Ada");
await page.locator('[data-ui-id="ui.auth.register.lastName"]').fill("Lovelace");
await page.locator('[data-ui-id="ui.auth.register.company"]').fill("BILL-14 Review GmbH");
const teamStepButton = page.getByRole("button", { name: /Set team size|Teamgröße festlegen/u });
await expect(teamStepButton).toBeEnabled();
await teamStepButton.click();
const planStep = page.locator('[data-ui-id="ui.auth.register.planStep"]');
await expect(planStep).toBeVisible();
await capture(page, testInfo, "02-register-team-default");
await page.locator('[data-ui-id="ui.auth.register.officeSeats"]').getByRole("spinbutton").fill("5");
await page.locator('[data-ui-id="ui.auth.register.fieldSeats"]').getByRole("spinbutton").fill("15");
await page.getByRole("button", { name: /View plans and live prices|Tarife und Live-Preise anzeigen/u }).click();
const recommendedSwarm = planStep.getByRole("radio", { name: /Swarm/u });
await expect(recommendedSwarm).toBeChecked();
await expect(recommendedSwarm.locator("xpath=..").getByText(/Empfohlen|Recommended/u)).toBeVisible();
await capture(page, testInfo, "03-register-team-recommended");
await planStep.getByRole("radio", { name: /Core/u }).click();
await capture(page, testInfo, "04-register-team-manual-override");
await page.getByRole("button", { name: /Back to team size|Zurück zur Teamgröße/u }).click();
await page.getByRole("button", { name: /Back to account details|Zurück zu den Kontodaten/u }).click();
await expect(page.locator('[data-ui-id="ui.auth.register.company"]')).toHaveValue("BILL-14 Review GmbH");
await capture(page, testInfo, "05-register-back-navigation");
});
});
@@ -0,0 +1,29 @@
import { expect, test } from "./utils/test";
import { skipIfUnavailable } from "./utils/navigation";
/**
* Public-Booking smoke (AK-P16b / DoD D.19): oeffentliche Buchungsseite
* /b/{tenant}/{slug} oeffnen -> Buchungsformular sichtbar.
*
* Kein Login (public Route). Braucht eine published BookingPage im
* Ziel-Environment; der Pfad kommt aus `E2E_PUBLIC_BOOKING_PATH`
* (z.B. /b/demo-pro-crm/beratungstermin — Slug aus dem Staging-Seed
* `seedDemoTenantBookingData`). Bewusst weicher Skip statt
* REQUIRE_E2E_READINESS-fail-closed: die Readiness-Lane seedet (noch)
* keine Booking-Fixtures.
*/
const bookingPath = process.env.E2E_PUBLIC_BOOKING_PATH;
test.describe("public booking smoke", () => {
test("renders the public booking page with the booking form", async ({ page }) => {
test.skip(!bookingPath?.trim(), "E2E_PUBLIC_BOOKING_PATH not configured");
const response = await page.goto(bookingPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Public booking path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.booking.public"]')).toBeVisible();
// Hauptaktion: das Buchungsformular (Slot-Auswahl + Submit) ist da — oder
// die Seite meldet ehrlich "keine Slots" (Empty-State, DoD E.23).
await expect(page.locator('[data-ui-id="ui.booking.public.form"], [data-ui-id="ui.booking.public.empty"]').first()).toBeVisible();
});
});
@@ -0,0 +1,95 @@
// AK-P15b interim-UI smoke (AD-28): log in, open the dedicated private
// readiness channel, send through the live WebSocket gateway, then reload and
// prove that the acknowledged message was persisted by the server.
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable, waitForHydration } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing, skipOrFailWhenE2eOptInMissing } from "./utils/readiness";
import { expect, test } from "./utils/test";
const credentials = getTenantCredentials();
const peerCredentials =
process.env.E2E_PLUGIN_READONLY_EMAIL && process.env.E2E_PLUGIN_READONLY_PASSWORD
? { email: process.env.E2E_PLUGIN_READONLY_EMAIL, password: process.env.E2E_PLUGIN_READONLY_PASSWORD }
: null;
const chatPath = process.env.E2E_TENANT_CHAT_PATH;
test.describe("AK-P15b team chat interim smoke", () => {
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_PLUGIN_READONLY_EMAIL", "E2E_PLUGIN_READONLY_PASSWORD", "E2E_TENANT_CHAT_PATH"],
"Team chat smoke inputs not configured"
);
skipOrFailWhenE2eOptInMissing("E2E_ALLOW_CHAT_SEND", "skipping the mutating team chat send flow");
});
test("delivers typing, messages, and reads live between two members, then reloads the persisted result", async ({ browser, page }, testInfo) => {
const peerContext = await browser.newContext();
const peerPage = await peerContext.newPage();
try {
await loginAsTenantUser(peerPage, peerCredentials!);
const peerChatUrl = new URL(chatPath!, peerPage.url()).toString();
const peerResponse = await peerPage.goto(peerChatUrl, { waitUntil: "domcontentloaded" });
await waitForHydration(peerPage);
await skipIfUnavailable(peerPage, peerResponse, `Team chat channel path ${chatPath}`);
expect(peerResponse?.ok(), `Peer team chat channel returned ${peerResponse?.status() ?? "no response"}`).toBe(true);
const peerScreen = peerPage.locator('[data-ui-id="ui.chat.channelDetail"]').first();
await expect(peerScreen).toBeVisible();
await expect(peerScreen.locator("[data-connection-state]")).toHaveCount(0, { timeout: 45_000 });
await loginAsTenantUser(page, credentials!);
const chatUrl = new URL(chatPath!, page.url()).toString();
const response = await page.goto(chatUrl, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Team chat channel path ${chatPath}`);
expect(response?.ok(), `Team chat channel returned ${response?.status() ?? "no response"}`).toBe(true);
const screen = page.locator('[data-ui-id="ui.chat.channelDetail"]').first();
await expect(screen).toBeVisible();
// The connection alert is rendered for every non-online state. Waiting for
// it to disappear proves authentication and channel gap-sync completed.
await expect(screen.locator("[data-connection-state]")).toHaveCount(0, { timeout: 45_000 });
await expect(screen.locator('[data-ui-id="ui.chat.channelDetail.presence"]')).toBeVisible({ timeout: 15_000 });
const peerComposer = peerScreen.locator('[data-ui-id="ui.chat.channelDetail.composer"] textarea').first();
await peerComposer.fill(`typing probe ${Date.now()}`);
await expect(screen.locator('[data-ui-id="ui.chat.channelDetail.typing"]')).toBeVisible({ timeout: 10_000 });
await peerComposer.fill("");
const body = `E2E chat smoke ${testInfo.project.name} ${Date.now()}`;
const composer = screen.locator('[data-ui-id="ui.chat.channelDetail.composer"] textarea').first();
await expect(composer).toBeVisible();
await expect(composer).toBeEnabled();
await composer.fill(body);
const sendButton = screen.getByRole("button", { name: /^(Senden|Send)$/iu }).first();
await expect(sendButton).toBeEnabled();
await sendButton.click();
const acknowledgedMessage = screen.locator("[data-message-id]").filter({ hasText: body }).last();
await expect(acknowledgedMessage).toBeVisible();
const acknowledgedDelivery = acknowledgedMessage.locator("[data-delivery-state]").first();
await expect(acknowledgedDelivery).toHaveAttribute("data-delivery-state", "sent", { timeout: 30_000 });
await expect(acknowledgedDelivery).toHaveAttribute("data-transport-source", /^(http_ack|websocket)$/u);
const peerLiveMessage = peerScreen.locator("[data-message-id]").filter({ hasText: body }).last();
await expect(peerLiveMessage).toBeVisible({ timeout: 15_000 });
await expect(peerLiveMessage.locator("[data-delivery-state]").first()).toHaveAttribute("data-transport-source", "websocket");
const readReceipt = acknowledgedMessage.locator('[data-ui-id="ui.chat.channelDetail.readReceipt"]');
await expect(readReceipt).toHaveAttribute("data-read-count", "1", { timeout: 15_000 });
await expect(readReceipt).toHaveAttribute("data-recipient-count", "1");
await page.reload({ waitUntil: "domcontentloaded" });
const persistedMessage = page.locator('[data-ui-id="ui.chat.channelDetail"] [data-message-id]').filter({ hasText: body }).last();
await expect(persistedMessage).toBeVisible({ timeout: 15_000 });
await expect(persistedMessage.locator("[data-delivery-state]").first()).toHaveAttribute("data-transport-source", "persisted");
} finally {
await peerContext.close();
}
});
});
@@ -0,0 +1,65 @@
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* CRM interim-UI smoke (R-P6, AD-28, DoD D.19): Login -> /contacts open ->
* the interim list screen from ~/ui renders -> main action: follow the
* "new contact" button into the inline create dialog -> the contact fields
* and guarded submit action are reachable.
*
* The module is connector-gated (`tenantHasModule('crm-basic')`). Without the
* entitlement the loader returns a locked View-Model that renders
* `ui.crm.list.locked` instead of the table; without the route the shell
* answers 404. Local runs skip those fixture gaps; required readiness fails
* closed.
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const crmPath = process.env.E2E_TENANT_CRM_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/contacts");
test.describe("crm interim screen (R-P6)", () => {
test("renders the contact list and reaches the create form", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping authenticated CRM smoke");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(crmPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "CRM module is not reachable in this environment");
if (!page.url().includes("/contacts")) {
skipOrFailWhenE2eFixtureMissing("CRM route is not available for the test tenant");
}
// The interim list shell always renders; a locked entitlement swaps the
// table for the locked empty-state. Local runs skip; readiness fails closed.
await expect(page.locator('[data-ui-id="ui.crm.list"]')).toBeVisible();
const locked = page.locator('[data-ui-id="ui.crm.list.locked"]');
if (await locked.isVisible()) {
skipOrFailWhenE2eFixtureMissing("CRM connector (crm-basic) is not enabled for the test tenant");
}
// Main action: open the inline create dialog without leaving the list.
const newButton = page.locator('[data-ui-id="ui.crm.list.new"]');
await expect(newButton).toBeVisible();
await newButton.click();
// Expected result: the inline form is usable and the submit remains guarded
// until a contact identity is present.
const createDialog = page.locator('[data-ui-id="ui.crm.new.dialog"]');
const firstName = createDialog.locator('[data-ui-id="ui.crm.new.dialog.vorname"]');
const submit = createDialog.locator('[data-ui-id="ui.crm.new.dialog.submit"]');
await expect(createDialog).toBeVisible();
await expect(firstName).toBeEditable();
await expect(submit).toBeDisabled();
await firstName.fill("Pilot");
await expect(submit).toBeEnabled();
// No horizontal page overflow on the interim screen.
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
expect(overflow).toBeLessThanOrEqual(1);
await expectNoCriticalA11yViolations(page);
});
});
@@ -0,0 +1,50 @@
// R-P11b interim-UI smoke (AD-28, DoD 19): login -> /dashboard -> the interim
// screen renders the one layout the server derived from the member's seat, and
// a widget tile drills through to its module.
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
test.describe("dashboard interim screen (R-P11b)", () => {
test("renders the derived layout and drills into a widget", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping authenticated dashboard smoke");
await loginAsTenantUser(page, credentials!);
await page.goto(dashboardPath, { waitUntil: "domcontentloaded" });
expect(page.url()).toContain(dashboardPath);
const roleLayouts = page.locator('[data-ui-id="ui.dashboard.roleLayouts"]');
await expect(roleLayouts).toBeVisible();
// The layout follows the member's seat, so no switcher is offered.
await expect(page.locator('[data-ui-id^="ui.dashboard.roleSwitcher"]')).toHaveCount(0);
// At least one widget card renders for the derived layout.
await expect(page.locator('[data-ui-id^="ui.dashboard.widget."]').first()).toBeVisible();
// Live updates are always on, so the screen carries no live controls.
await expect(page.locator('[data-ui-id="ui.dashboard.live.toggle"]')).toHaveCount(0);
// Main action: a linked KPI tile drills through to its module.
const drilldown = page.locator('[data-ui-id$=".link"][data-ui-id^="ui.dashboard.widget."]').first();
if (await drilldown.count()) {
const href = await drilldown.getAttribute("href");
await drilldown.click();
await page.waitForURL((url) => url.pathname === href || url.pathname.startsWith(href ?? "/"));
await expect(page.locator('[data-ui-id="ui.surface.shell.main"]').first()).toBeVisible();
await page.goBack({ waitUntil: "domcontentloaded" });
await expect(roleLayouts).toBeVisible();
}
// No horizontal page overflow on the interim screen.
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
expect(overflow).toBeLessThanOrEqual(1);
await expectNoCriticalA11yViolations(page);
});
});
@@ -4,18 +4,25 @@ import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Email-Inbox smoke (VA-P23 / DoD D.19): Login -> /emails oeffnen -> Inbox
* Email-Inbox smoke (VA-P23 / AK-UI-01..03 / DoD D.19): Login -> /emails,
* /emails/new und /emails/:id oeffnen -> der jeweilige Interim-Screen ist
* sichtbar; Settings-Seite rendert die Connect-Flaechen.
*
* Beide Routen sind modul-gegated (tenantHasModule "email-inbox") + permission-
* gegated (email.read_own). Ohne verbundenes Postfach zeigt die Inbox den
* Klartext-Empty-State (kein Postfach verbunden) — auch das ist ein gueltiger
* Smoke-Durchlauf. Skippt ohne E2E-Credentials / wenn die Route im Environment
* nicht erreichbar ist (404 bei fehlendem Modul/Recht).
* Alle Routen sind modul-gegated (tenantHasModule "email-inbox") + permission-
* gegated (email.read_own, Compose zusaetzlich email.write). Ohne verbundenes
* Postfach zeigen Inbox und Compose den Klartext-No-Mailbox-State — auch das
* ist ein gueltiger Smoke-Durchlauf. Skippt ohne E2E-Credentials / wenn die
* Route im Environment nicht erreichbar ist (404 bei fehlendem Modul/Recht).
*
* Der Detail-Smoke braucht eine echte Message-ID und laeuft daher nur, wenn
* E2E_TENANT_EMAIL_MESSAGE_PATH gesetzt ist (sonst gibt es im Environment keine
* Mail zum Oeffnen).
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const emailsPath = process.env.E2E_TENANT_EMAILS_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/emails");
const emailComposePath = process.env.E2E_TENANT_EMAIL_COMPOSE_PATH ?? `${emailsPath}/new`;
const emailMessagePath = process.env.E2E_TENANT_EMAIL_MESSAGE_PATH;
const emailSettingsPath =
process.env.E2E_TENANT_EMAIL_SETTINGS_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/settings/integrations/email");
@@ -30,6 +37,28 @@ test.describe("email inbox smoke", () => {
await expect(page.locator('[data-ui-id="ui.email.inbox"]')).toBeVisible();
});
test("renders the compose screen (or its Klartext no-mailbox state)", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Email inbox smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(emailComposePath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Email compose path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.email.compose"]')).toBeVisible();
});
test("opens a message detail with its thread", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Email inbox smoke inputs not configured");
test.skip(!emailMessagePath, "E2E_TENANT_EMAIL_MESSAGE_PATH is not configured — no seeded mail to open");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(emailMessagePath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Email message path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.email.detail"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.email.detail.thread"]')).toBeVisible();
});
test("renders the mailbox connect settings", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Email inbox smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
@@ -0,0 +1,46 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Email-Marketing-Smoke (AK-P14a/AK-P14b, DoD D.19): Login -> /email-marketing
* oeffnen -> Setup oder Overview sichtbar -> Kampagnen-Liste und den
* sechs-stufigen Kampagnen-Wizard erreichen.
*
* Das Modul ist feature-gegated (`featureKeys.emailMarketing` via
* requireTenantProductAccess) + permission-gegated (emailMarketing.view).
* Ohne Entitlement redirectet die Shell (z.B. /plan-required), ohne Recht
* antwortet sie 404 — beides skippt den Smoke sauber statt zu failen.
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const emailMarketingPath = process.env.E2E_TENANT_EMAIL_MARKETING_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/email-marketing");
test.describe("email marketing smoke", () => {
test("renders the overview and reaches the campaigns list", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Email marketing smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(emailMarketingPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Email marketing module is not reachable in this environment");
test.skip(!page.url().includes("/email-marketing"), "Email marketing entitlement is not enabled for the test tenant");
const overview = page.locator('[data-ui-id="email-marketing.overview"]');
const setup = page.locator('[data-ui-id="email-marketing.setup"]');
await expect.poll(async () => (await overview.count()) + (await setup.count())).toBeGreaterThan(0);
await page.goto(`${emailMarketingPath}/campaigns`, { waitUntil: "domcontentloaded" });
await expect(page.locator('[data-ui-id="email-marketing.campaigns"]')).toBeVisible();
await page.getByRole("searchbox").fill("smoke");
await page.getByRole("button", { name: /Filtern|Apply/iu }).click();
await expect(page).toHaveURL(/query=smoke/u);
await page.goto(`${emailMarketingPath}/campaigns/new`, { waitUntil: "domcontentloaded" });
await expect(page.locator('[data-ui-id="email-marketing.campaign-editor"]')).toBeVisible();
await expect(page.getByText(/Grundlagen|Basics/iu).first()).toBeVisible();
await expect(page.getByText(/Test/iu).first()).toBeVisible();
await expect(page.getByText(/Prüfen|Review/iu).first()).toBeVisible();
});
});
@@ -0,0 +1,43 @@
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { compactMobileViewport, expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const emailMarketingPath =
process.env.E2E_TENANT_EMAIL_MARKETING_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/email-marketing");
test.describe("email marketing mobile a11y", () => {
for (const viewport of [narrowMobileViewport, compactMobileViewport]) {
test(`keeps setup, campaign cards and the six-step wizard usable at ${viewport.width}px`, async ({ page }) => {
test.setTimeout(60_000);
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"],
"Email marketing mobile a11y inputs not configured",
);
await page.setViewportSize(viewport);
await loginAsTenantUser(page, credentials!);
const response = await page.goto(emailMarketingPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Email marketing module is not reachable in this environment");
test.skip(!page.url().includes("/email-marketing"), "Email marketing entitlement is not enabled for the test tenant");
await expect(page.locator("body")).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
await page.goto(`${emailMarketingPath}/campaigns`, { waitUntil: "domcontentloaded" });
await expect(page.locator('[data-ui-id="email-marketing.campaigns"]')).toBeVisible();
await expectNoHorizontalOverflow(page);
await page.goto(`${emailMarketingPath}/campaigns/new`, { waitUntil: "domcontentloaded" });
await expect(page.locator('[data-ui-id="email-marketing.campaign-editor"]')).toBeVisible();
await expect(page.locator('[data-ui-id="email-marketing.campaign.autosave"]')).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
}
});
@@ -6,7 +6,6 @@ import { escapeRegExp, interceptCurrentRoutePost, postDataIncludesField } from "
const forgotForm = '[data-ui-id="ui.auth.forgot.form"], form';
const forgotEmailInput = '[data-ui-id="ui.auth.forgot.email"], input[name="email"]';
const forgotResetButton = '[data-ui-id="ui.auth.forgot.submit"], button[name="mode"][value="reset"]';
const forgotMagicLinkButton = '[data-ui-id="ui.auth.forgot.magicLinkSubmit"], button[name="mode"][value="magic"]';
const resetForm = '[data-ui-id="ui.auth.reset.form"], form';
const resetEmailInput = '[data-ui-id="ui.auth.reset.email"], input[type="email"], input[name="email"], input#email';
const resetPasswordInput = '[data-ui-id="ui.auth.reset.password"], input[name="password"]';
@@ -21,7 +20,7 @@ test.describe("forgot-password page a11y", () => {
});
}
test("submits reset and magic-link requests without account enumeration", async ({ page }) => {
test("submits reset requests without account enumeration", async ({ page }) => {
await page.goto("/forgot-password", { waitUntil: "domcontentloaded" });
const form = page.locator(forgotForm).first();
@@ -33,10 +32,6 @@ test.describe("forgot-password page a11y", () => {
await form.locator(forgotEmailInput).fill("unknown-e2e-user@example.invalid");
await form.locator(forgotResetButton).click();
await expect(page.getByText(/if an account exists|wenn es ein konto/iu)).toBeVisible({ timeout: 5_000 });
await form.locator(forgotEmailInput).fill("unknown-e2e-magic@example.invalid");
await form.locator(forgotMagicLinkButton).click();
await expect(page.getByText(/if an account exists|wenn es ein konto/iu)).toBeVisible({ timeout: 5_000 });
});
test("submits reset-token form with csrf and token fields without mutating data", async ({ page }) => {
@@ -58,35 +53,18 @@ test.describe("forgot-password page a11y", () => {
await expect(confirmInput).toBeEditable();
await expect(submit).toBeEnabled();
let resolveSubmitted!: (formData: URLSearchParams) => void;
const submitted = new Promise<URLSearchParams>((resolve) => {
resolveSubmitted = resolve;
});
await page.route("**/*", async (route) => {
const request = route.request();
const requestUrl = new URL(request.url());
if (request.method() !== "POST" || requestUrl.pathname !== "/reset") {
await route.continue();
return;
}
resolveSubmitted(new URLSearchParams(request.postData() ?? ""));
await route.fulfill({
status: 204,
body: "",
});
});
const submitted = await interceptCurrentRoutePost(page, { status: 204 });
await passwordInput.fill("LongEnough1!");
await confirmInput.fill("LongEnough1!");
await submit.click();
const formData = await submitted;
expect(formData.get("csrf") ?? "").not.toBe("");
expect(formData.get("verify-token")).toBe("dummy-token");
expect(formData.get("email")).toBe("contract@example.test");
expect(formData.get("password")).toBe("LongEnough1!");
expect(formData.get("password-confirm")).toBe("LongEnough1!");
await expect.poll(() => submitted.value, { timeout: 5_000 }).not.toBeNull();
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "verify-token", /^dummy-token$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "email", /^contract@example\.test$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "password", /^LongEnough1!$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "password-confirm", /^LongEnough1!$/u)).toBe(true);
});
test("shows an accessible error for an invalid reset token without losing context", async ({ page }) => {
@@ -110,36 +88,32 @@ test.describe("forgot-password page a11y", () => {
test.describe("forgot-password mobile contract a11y", () => {
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
test("posts reset and magic-link contracts on mobile without sending mail", async ({ page }) => {
for (const mode of [
{ button: forgotResetButton, email: "mobile-reset-contract@example.invalid", value: "reset" },
{ button: forgotMagicLinkButton, email: "mobile-magic-contract@example.invalid", value: "magic" },
] as const) {
await page.goto("/forgot-password", { waitUntil: "domcontentloaded" });
test("posts the reset contract on mobile without sending mail", async ({ page }) => {
const email = "mobile-reset-contract@example.invalid";
await page.goto("/forgot-password", { waitUntil: "domcontentloaded" });
const form = page.locator(forgotForm).first();
const emailInput = form.locator(forgotEmailInput).first();
const submitButton = form.locator(mode.button).first();
await expect(form).toBeVisible();
await expect(emailInput).toBeVisible();
await expect(submitButton).toBeVisible();
const form = page.locator(forgotForm).first();
const emailInput = form.locator(forgotEmailInput).first();
const submitButton = form.locator(forgotResetButton).first();
await expect(form).toBeVisible();
await expect(emailInput).toBeVisible();
await expect(submitButton).toBeVisible();
await emailInput.fill(mode.email);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
await emailInput.fill(email);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const submitted = await interceptCurrentRoutePost(page, {
status: 200,
body: "<!doctype html><title>Forgot password intercepted</title>",
contentType: "text/html",
});
await submitButton.click();
await expect.poll(() => submitted.value, { timeout: 5_000 }).not.toBeNull();
const submitted = await interceptCurrentRoutePost(page, {
status: 200,
body: "<!doctype html><title>Forgot password intercepted</title>",
contentType: "text/html",
});
await submitButton.click();
await expect.poll(() => submitted.value, { timeout: 5_000 }).not.toBeNull();
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "email", new RegExp(`^${escapeRegExp(mode.email)}$`, "u"))).toBe(true);
expect(postDataIncludesField(submitted.value, "mode", new RegExp(`^${mode.value}$`, "u"))).toBe(true);
await page.unroute("**/*");
}
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "email", new RegExp(`^${escapeRegExp(email)}$`, "u"))).toBe(true);
expect(postDataIncludesField(submitted.value, "mode", /^reset$/u)).toBe(true);
await page.unroute("**/*");
});
});
@@ -0,0 +1,30 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Forms smoke (AK-P16c / DoD D.19): Login -> /forms oeffnen -> Verwaltungs-
* Liste sichtbar.
*
* Die Route ist modul-gegated (tenantHasModule "forms") + permission-gegated
* (forms.basic). Bei aktivem Modul + Berechtigung rendert sie die
* Formular-Verwaltung mit `data-ui-id="ui.forms.list"`. Skippt ohne
* E2E-Credentials / wenn die Route im Environment nicht erreichbar ist
* (404 bei fehlendem Modul/Recht).
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const formsPath = process.env.E2E_TENANT_FORMS_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/forms");
test.describe("forms smoke", () => {
test("renders the forms admin list", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Forms smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(formsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Forms path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.forms.list"]')).toBeVisible();
});
});
@@ -0,0 +1,48 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* AK-P17a HR-core smoke (DoD D.19): Login -> /hr hub -> directory via hub link
* -> table/empty state visible; then the password-safe list where the
* never-list contract must hold (no revealed secret value anywhere before an
* explicit, audited reveal).
*
* The routes are module-gated (`tenantHasModule('hr')`) and permission-gated
* (`hr.read_own` / `hr.passwordsafe.use`, 404 instead of 403). Skips without
* E2E credentials or when the route is not reachable in this environment.
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const hrHubPath = process.env.E2E_TENANT_HR_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/hr");
const tenantSlug = hrHubPath.split("/").filter(Boolean)[0] ?? "app";
test.describe("hr core smoke", () => {
test("opens the hub, the employee directory and the password-safe list", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "HR smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(hrHubPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "HR hub is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.hr.hub.section.forMe"]')).toBeVisible();
// Main action: follow the hub link into the employee directory. The
// directory renders either the table or the plain-text empty state.
const directoryLink = page
.locator('[data-ui-id="ui.hr.hub.item.teamDirectory"], [data-ui-id="ui.hr.hub.item.directory"]')
.first();
await expect(directoryLink).toBeVisible();
await directoryLink.click();
await page.waitForURL(/\/hr\/directory(?:[/?#]|$)/u);
await expect(page.locator('[data-ui-id="ui.hr.directory.table"], [data-ui-id="ui.hr.directory.empty"]').first()).toBeVisible();
// Password-safe list: vault cards or empty state — and never a revealed
// secret value outside the audited on-demand reveal (DoD #3 never-list).
const safeResponse = await page.goto(`/${tenantSlug}/passwords`, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, safeResponse, "Password safe is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.hr.passwordSafe.list"], [data-ui-id="ui.hr.passwordSafe.empty"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.hr.vault.revealed"]')).toHaveCount(0);
});
});
@@ -0,0 +1,44 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* AK-P17b HR-workflows smoke (DoD D.19): Login -> /hr/leave -> tabs visible ->
* open the "new leave request" dialog (main action) -> dialog renders ->
* switch to the team tab via its server link (loader roundtrip, tab reflected
* in the URL).
*
* Module- and permission-gated like the HR core routes; skips without E2E
* credentials or when the route is not reachable in this environment.
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const leavePath = process.env.E2E_TENANT_HR_LEAVE_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/hr/leave");
test.describe("hr workflows smoke", () => {
test("renders the leave workflow, opens the request dialog and switches tabs", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "HR leave smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(leavePath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "HR leave is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.hr.leave.tabs"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.hr.leave.own.list"], [data-ui-id="ui.hr.leave.own.empty"]').first()).toBeVisible();
// Main action: open the new-request dialog (write stays out of the smoke
// run — the dialog itself proves the action wiring).
const newButton = page.locator('[data-ui-id="ui.hr.leave.new"]');
if (await newButton.isVisible()) {
await newButton.click();
await expect(page.locator('[data-ui-id="ui.hr.leave.newDialog"]')).toBeVisible();
await page.keyboard.press("Escape");
}
// Tab switch is a server link: the loader reflects the tab into the URL.
await page.locator('[data-ui-id="ui.hr.leave.tabs"] a').last().click();
await page.waitForURL(/[?&]tab=team(?:&|$)/u);
await expect(page.locator('[data-ui-id="ui.hr.leave.team.list"], [data-ui-id="ui.hr.leave.team.empty"]').first()).toBeVisible();
});
});
@@ -1,7 +1,7 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Integrations-Smoke (R-P5 / DoD D.19): Login -> Integrations-Katalog oeffnen ->
@@ -14,7 +14,8 @@ import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const integrationsPath =
process.env.E2E_TENANT_INTEGRATIONS_PATH ?? (dashboardPath?.endsWith("/dashboard") ? dashboardPath.replace(/\/dashboard$/u, "/integrations") : undefined);
process.env.E2E_TENANT_INTEGRATIONS_PATH ??
(dashboardPath?.endsWith("/dashboard") ? dashboardPath.replace(/\/dashboard$/u, "/settings/integrations") : undefined);
test.describe("integrations smoke (R-P5)", () => {
test.beforeEach(() => {
@@ -22,7 +23,9 @@ test.describe("integrations smoke (R-P5)", () => {
});
test("opens the catalog, an app's connection management and the connect wizard", async ({ page }) => {
test.skip(!integrationsPath, "Integrations path not derivable from E2E_TENANT_DASHBOARD_PATH");
if (!integrationsPath) {
skipOrFailWhenE2eFixtureMissing("Integrations path not derivable from E2E_TENANT_DASHBOARD_PATH");
}
await loginAsTenantUser(page, credentials!);
const response = await page.goto(integrationsPath!, { waitUntil: "domcontentloaded" });
@@ -33,7 +36,7 @@ test.describe("integrations smoke (R-P5)", () => {
// Open the P5 reference app card (always in the code catalog).
const card = page.locator('[data-row-id="sample-data-sync"]').first();
if (!(await card.isVisible())) {
test.skip(true, "sample-data-sync card not visible (catalog empty for this tenant)");
skipOrFailWhenE2eFixtureMissing("sample-data-sync card not visible (catalog empty for this tenant)");
}
await card.click();
@@ -0,0 +1,42 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const importPath = process.env.E2E_TENANT_KWP_PROJECT_IMPORT_PATH ?? dashboardPath?.replace(/\/dashboard\/?$/u, "/settings/integrations/kwp/import");
const readOnlyQuery = process.env.E2E_KWP_PROJECT_QUERY?.trim();
test.describe("VR-P32 KWP project import interim smoke", () => {
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"], "KWP project import smoke inputs not configured");
});
test("opens the import flow and optionally executes a read-only targeted search", async ({ page }) => {
if (!importPath) {
skipOrFailWhenE2eFixtureMissing("KWP project import path is not derivable");
}
await loginAsTenantUser(page, credentials!);
const response = await page.goto(importPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `KWP project import path ${importPath}`);
await expect(page.locator('[data-ui-id="ui.integrations.kwp.project-import"]')).toBeVisible();
if (!readOnlyQuery || readOnlyQuery.length < 2) {
await expect(
page
.getByText(/Kein KWP-Projekt ausgewählt|No KWP project selected/iu)
.or(page.getByText(/Keine KWP-Verbindung|No KWP connection/iu))
.first()
).toBeVisible();
return;
}
await page.getByLabel(/Suchbegriff|Search term/iu).fill(readOnlyQuery);
await page.getByRole("button", { name: /Suchen|Search/iu }).click();
await page.waitForLoadState("domcontentloaded");
await expect(page.locator('[data-ui-id="ui.integrations.kwp.project-import"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.integrations.kwp.project-import.results"]')).toBeVisible();
});
});
@@ -0,0 +1,68 @@
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Lead-inbox interim-UI smoke (R-P7, AD-28, DoD D.19): Login -> /leads open ->
* the interim triage inbox from ~/ui renders -> main action: follow the
* "new lead" button into the inline manual-entry dialog -> the identity fields
* and guarded submit control are reachable.
*
* The module is connector-gated (`tenantHasModule('leads')`). Without the
* entitlement the loader returns a locked View-Model that renders the locked
* empty-state (no filter bar) instead of the triage table; without the route
* the shell answers 404. Local runs skip those fixture gaps; required readiness
* fails closed.
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const leadsPath = process.env.E2E_TENANT_LEADS_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/leads");
test.describe("lead inbox interim screen (R-P7)", () => {
test("renders the triage inbox and reaches the manual-entry form", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping authenticated lead-inbox smoke");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(leadsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Leads module is not reachable in this environment");
if (!page.url().includes("/leads")) {
skipOrFailWhenE2eFixtureMissing("Leads route is not available for the test tenant");
}
// The interim inbox shell always renders; a locked entitlement swaps the
// filter bar + table for the locked empty-state. Local runs skip; readiness
// fails closed.
await expect(page.locator('[data-ui-id="ui.leads.list"]')).toBeVisible();
const filterBar = page.locator('[data-ui-id="ui.leads.list.filter"]');
if (!(await filterBar.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Leads connector (leads) is not enabled for the test tenant");
}
// Main action: open the inline manual-entry dialog without leaving the inbox.
const newButton = page.locator('[data-ui-id="ui.leads.list.new"]');
if (!(await newButton.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Test tenant lacks leads.write - create action not rendered");
}
await newButton.click();
// Expected result: identity fields are usable and submit stays guarded until
// at least one identifying value is present.
const createDialog = page.locator('[data-ui-id="ui.leads.new.dialog"]');
const email = createDialog.locator('[data-ui-id="ui.leads.new.dialog.email"]');
const submit = createDialog.locator('[data-ui-id="ui.leads.new.dialog.submit"]');
await expect(createDialog).toBeVisible();
await expect(email).toBeEditable();
await expect(submit).toBeDisabled();
await email.fill("pilot@example.test");
await expect(submit).toBeEnabled();
// No horizontal page overflow on the interim screen.
const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
expect(overflow).toBeLessThanOrEqual(1);
await expectNoCriticalA11yViolations(page);
});
});
@@ -42,15 +42,15 @@ test.describe("login page a11y", () => {
await page.locator('input[name="password"], input#password, input[type="password"]').first().fill("x");
await page.locator('button[type="submit"]').first().click();
await expect(page.locator("#email-error")).toHaveRole("alert");
await expect(page.locator("#email-error")).toHaveText("Invalid email");
await expect(page.locator("#password-error")).toHaveRole("alert");
await expect(page.locator("#password-error")).toHaveText("Invalid password");
await expect(page.locator("#login-email-error")).toHaveRole("alert");
await expect(page.locator("#login-email-error")).toHaveText("Invalid email");
await expect(page.locator("#login-password-error")).toHaveRole("alert");
await expect(page.locator("#login-password-error")).toHaveText("Invalid password");
await expect(page.getByRole("alert")).toHaveCount(2);
await expect(page.locator('input[name="email"]')).toHaveValue("not-an-email");
await expect(page.locator('input[name="email"]')).toHaveAttribute("aria-invalid", "true");
await expect(page.locator('input[name="email"]')).toHaveAttribute("aria-describedby", "email-error");
await expect(page.locator('input[name="email"]')).toHaveAttribute("aria-describedby", "login-email-error");
await expect(page.locator('input[name="password"]')).toHaveAttribute("aria-invalid", "true");
await expect(page.locator('input[name="password"]')).toHaveAttribute("aria-describedby", "password-error");
await expect(page.locator('input[name="password"]')).toHaveAttribute("aria-describedby", "login-password-error");
});
});
@@ -15,8 +15,7 @@ import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const membersPath = process.env.E2E_TENANT_MEMBERS_PATH ?? (dashboardPath ? tenantSettingsMembersPath(dashboardPath) : undefined);
const rolesAndPermissionsPath =
process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? (dashboardPath ? tenantRolesAndPermissionsPath(dashboardPath) : undefined);
const rolesAndPermissionsPath = process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? (dashboardPath ? tenantRolesAndPermissionsPath(dashboardPath) : undefined);
test.describe("members and roles smoke (R-P2b)", () => {
test.beforeEach(() => {
@@ -58,8 +57,8 @@ test.describe("members and roles smoke (R-P2b)", () => {
test("opens the merged roles tab and reaches the M04A/M02 editor chain", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(`${rolesAndPermissionsPath!}/roles`, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Roles path ${rolesAndPermissionsPath}/roles`);
const response = await page.goto(rolesAndPermissionsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Roles path ${rolesAndPermissionsPath}`);
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.roles"]').first()).toBeVisible();
@@ -33,8 +33,8 @@ test.describe("mobile auth pages", () => {
test("tenant protected deep links redirect unauthenticated mobile users to login with redirectTo", async ({ page }) => {
const tenantProtectedPaths = [
`/${tenantSlug}/dashboard`,
`/${tenantSlug}/settings/account`,
`/${tenantSlug}/settings/plugins`,
`/${tenantSlug}/settings/workspace`,
`/${tenantSlug}/settings/integrations/plugins`,
`/${tenantSlug}/workflow-engine`,
`/${tenantSlug}/workflow-engine/workflows/example/run/manual`,
];
@@ -94,12 +94,12 @@ test.describe("mobile auth pages", () => {
await expectNoHorizontalOverflow(page);
});
test("/reset without a token keeps password inputs disabled on mobile", async ({ page }) => {
test("/reset without a token shows the invalid-link recovery state on mobile", async ({ page }) => {
await page.goto("/reset", { waitUntil: "domcontentloaded" });
await expect(page.locator(resetEmailInput).first()).toBeVisible();
await expect(page.locator(resetPasswordInput).first()).toBeVisible();
await expect(page.locator(resetSubmitButton).first()).toBeDisabled();
await expect(page.locator('[data-ui-id="ui.auth.reset.invalid"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.auth.reset.requestNew"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.auth.reset.invalidBackToLogin"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
});
@@ -116,7 +116,8 @@ test.describe("mobile auth pages", () => {
await page.goto("/auth/magic-link", { waitUntil: "domcontentloaded" });
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
await expect(page.getByRole("link", { name: /request a new.*link|neuen.*link/i })).toHaveAttribute("href", "/forgot-password");
await expect(page.locator('[data-ui-id="ui.auth.magicLink.requestNew"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.auth.magicLink.backToLogin"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
});
@@ -126,17 +127,17 @@ test.describe("mobile auth pages", () => {
await expect(page).toHaveURL(/\/forgot-password(?:[?#].*)?$/);
await expectNoHorizontalOverflow(page);
await page.locator('a[href="/login"]').click();
await page.locator('[data-ui-id="ui.auth.forgot.backToLoginLink"]').click();
await expect(page).toHaveURL(/\/login(?:[?#].*)?$/);
await expectNoHorizontalOverflow(page);
await page.goto("/auth/magic-link", { waitUntil: "domcontentloaded" });
await page.locator('a[href="/forgot-password"]').click();
await expect(page).toHaveURL(/\/forgot-password(?:[?#].*)?$/);
await page.locator('[data-ui-id="ui.auth.magicLink.requestNew"]').click();
await expect(page).toHaveURL(/\/login(?:[?#].*)?$/);
await expectNoHorizontalOverflow(page);
await page.goto("/reset", { waitUntil: "domcontentloaded" });
await page.locator('a[href="/login"]').click();
await page.locator('[data-ui-id="ui.auth.reset.invalidBackToLogin"]').click();
await expect(page).toHaveURL(/\/login(?:[?#].*)?$/);
await expectNoHorizontalOverflow(page);
});
@@ -154,12 +155,12 @@ test.describe("compact mobile auth pages", () => {
});
}
test("/reset without a token keeps controls disabled at 320px", async ({ page }) => {
test("/reset without a token keeps recovery actions usable at 320px", async ({ page }) => {
await page.goto("/reset", { waitUntil: "domcontentloaded" });
await expect(page.locator(resetEmailInput).first()).toBeVisible();
await expect(page.locator(resetPasswordInput).first()).toBeVisible();
await expect(page.locator(resetSubmitButton).first()).toBeDisabled();
await expect(page.locator('[data-ui-id="ui.auth.reset.invalid"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.auth.reset.requestNew"]').first()).toBeEnabled();
await expect(page.locator('[data-ui-id="ui.auth.reset.invalidBackToLogin"]').first()).toBeEnabled();
await expectNoHorizontalOverflow(page);
});
@@ -1,4 +1,4 @@
import { expect, type Page, test } from "./utils/test";
import { expect, type Locator, type Page, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser, tenantSettingsAccountPath, tenantSettingsProfilePath, tenantSettingsSubscriptionPath } from "./utils/auth";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { compactMobileViewport, expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
@@ -10,7 +10,7 @@ const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const pluginSettingsPath = process.env.E2E_PLUGIN_SETTINGS_PATH;
const workflowBuilderPath = process.env.E2E_WORKFLOW_BUILDER_PATH;
const workflowRunManualPath = process.env.E2E_WORKFLOW_RUN_MANUAL_PATH;
const mobileSidebarSelector = '[data-ui-id="ui.surface.app.sidebar.mobile"]';
const mobileSidebarSelector = '[data-ui-id="ui.surface.app.sidebar"]';
type MobileShellRouteCheck = {
name: string;
@@ -22,6 +22,21 @@ function requireMobileShellInputs(reason: string): void {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], reason);
}
async function isMobileSidebarOpen(sidebar: Locator): Promise<boolean> {
return sidebar.evaluate((element) => element.classList.contains("max-md:translate-x-0"));
}
async function expectMobileSidebarOpen(sidebar: Locator): Promise<void> {
await expect(sidebar).toBeVisible();
await expect(sidebar).toHaveClass(/(?:^|\s)max-md:translate-x-0(?:\s|$)/u);
await expect(sidebar).not.toHaveAttribute("aria-hidden", "true");
}
async function expectMobileSidebarClosed(sidebar: Locator): Promise<void> {
await expect(sidebar).toHaveClass(/(?:^|\s)max-md:-translate-x-full(?:\s|$)/u);
await expect(sidebar).toHaveAttribute("aria-hidden", "true");
}
async function expectFocusInsideMobileSidebar(page: Page, stepName: string): Promise<void> {
await expect
.poll(
@@ -66,15 +81,15 @@ async function expectMobileShellControlsUsable(page: Page): Promise<void> {
// click can race that close and leave the drawer shut. Retry-open, only
// clicking while it's closed, so the toggle never clobbers an open drawer.
await expect(async () => {
if (!(await mobileSidebar.isVisible())) {
if (!(await isMobileSidebarOpen(mobileSidebar))) {
await sidebarTrigger.click();
}
await expect(mobileSidebar).toBeVisible({ timeout: 2000 });
await expectMobileSidebarOpen(mobileSidebar);
}).toPass({ timeout: 15000 });
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first()).toBeVisible();
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first()).toBeVisible();
await page.keyboard.press("Escape");
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
}
async function expectAuthenticatedMobileShellRoute(page: Page, routeCheck: MobileShellRouteCheck): Promise<void> {
@@ -130,14 +145,14 @@ test.describe("authenticated mobile shell flow", () => {
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar.mobile"], [data-mobile="true"]');
await expect(mobileSidebar).toBeHidden();
const mobileSidebar = page.locator(mobileSidebarSelector);
await expectMobileSidebarClosed(mobileSidebar);
await page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').click();
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
await expect(mobileSidebar).toHaveAttribute("role", "dialog");
await expect(mobileSidebar).toHaveAttribute("aria-modal", "true");
await expect(mobileSidebar).toHaveAccessibleName(/.+/u);
await expect(mobileSidebar).toHaveAccessibleDescription(/.+/u);
const settingsLink = mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first();
await expect(settingsLink).toBeVisible();
@@ -145,7 +160,7 @@ test.describe("authenticated mobile shell flow", () => {
const settingsProfilePath = tenantSettingsProfilePath(dashboardPath);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(settingsProfilePath)}(?:[?#].*)?$`, "u"));
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expectNoHorizontalOverflow(page);
});
@@ -157,16 +172,16 @@ test.describe("authenticated mobile shell flow", () => {
await expectNoHorizontalOverflow(page);
const trigger = page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]');
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar.mobile"], [data-mobile="true"]');
await expect(mobileSidebar).toBeHidden();
const mobileSidebar = page.locator(mobileSidebarSelector);
await expectMobileSidebarClosed(mobileSidebar);
await trigger.click();
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first()).toBeVisible();
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first()).toBeVisible();
await page.keyboard.press("Escape");
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expect(trigger).toBeVisible();
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
@@ -181,13 +196,13 @@ test.describe("authenticated mobile shell flow", () => {
const trigger = page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]');
const mobileSidebar = page.locator(mobileSidebarSelector);
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await trigger.focus();
await expect(trigger).toBeFocused();
await page.keyboard.press("Enter");
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
await expectFocusInsideMobileSidebar(page, "opening");
const focusableItemCount = await countMobileSidebarFocusableItems(page);
@@ -199,7 +214,7 @@ test.describe("authenticated mobile shell flow", () => {
}
await page.keyboard.press("Escape");
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expect(trigger).toBeVisible();
await expect(trigger).toBeFocused();
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
@@ -213,17 +228,17 @@ test.describe("authenticated mobile shell flow", () => {
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
const mobileSidebar = page.locator('[data-mobile="true"]');
await expect(mobileSidebar).toBeHidden();
const mobileSidebar = page.locator(mobileSidebarSelector);
await expectMobileSidebarClosed(mobileSidebar);
await page.keyboard.press("Control+e");
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first()).toBeVisible();
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first()).toBeVisible();
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await page.keyboard.press("Control+e");
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
});
@@ -239,11 +254,12 @@ test.describe("authenticated mobile shell flow", () => {
const profileTarget = page.locator('[data-ui-id="ui.action.shell.profile"]').first();
await expect(profileTarget).toBeVisible();
await expect(profileTarget.locator("xpath=ancestor::a[1]")).toHaveAttribute("href", /settings\/profile/u);
await expect(profileTarget).toHaveAttribute("role", "menuitem");
const signOut = page.locator('[data-ui-id="ui.action.shell.signOut"]').first();
await expect(signOut).toBeVisible();
await expect(signOut.locator("xpath=ancestor::form[1]")).toHaveAttribute("action", /\/logout$/u);
await expect(signOut).toHaveAttribute("role", "menuitem");
await expect(signOut.locator("xpath=ancestor::form[1]")).toHaveCount(0);
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
});
@@ -276,7 +292,7 @@ test.describe("authenticated mobile shell flow", () => {
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
const trigger = page.locator('[data-ui-id="ui.action.shell.search"]');
const trigger = page.locator('[data-ui-id="ui.action.shell.searchMobile"]');
await trigger.click();
const palette = page.locator('[data-ui-id="ui.surface.commandPalette.portal"]');
@@ -302,11 +318,11 @@ test.describe("authenticated mobile shell flow", () => {
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
await page.locator('[data-ui-id="ui.action.shell.search"]').click();
await page.locator('[data-ui-id="ui.action.shell.searchMobile"]').click();
const palette = page.locator('[data-ui-id="ui.surface.commandPalette.portal"]');
const searchInput = page.locator('[data-ui-id="ui.surface.commandPalette.search"]');
const rows = page.locator('[data-ui-id="ui.surface.commandPalette.row"]');
const rows = page.locator('[data-ui-id^="ui.surface.commandPalette.action."], [data-ui-id^="ui.surface.commandPalette.result."]');
await expect(palette).toBeVisible();
await expect(searchInput).toBeFocused();
@@ -331,7 +347,7 @@ test.describe("authenticated mobile shell flow", () => {
const palette = page.locator('[data-ui-id="ui.surface.commandPalette.portal"]');
const searchInput = page.locator('[data-ui-id="ui.surface.commandPalette.search"]');
const rows = page.locator('[data-ui-id="ui.surface.commandPalette.row"]');
const rows = page.locator('[data-ui-id^="ui.surface.commandPalette.action."], [data-ui-id^="ui.surface.commandPalette.result."]');
await expect(palette).toBeVisible();
await expect(searchInput).toBeVisible();
await expect(searchInput).toBeFocused();
@@ -374,18 +390,18 @@ test.describe("authenticated mobile shell flow", () => {
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const mobileSidebar = page.locator('[data-mobile="true"]');
await expect(mobileSidebar).toBeHidden();
const mobileSidebar = page.locator(mobileSidebarSelector);
await expectMobileSidebarClosed(mobileSidebar);
await page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').click();
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
const dashboardLink = mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first();
await expect(dashboardLink).toBeVisible();
await dashboardLink.click();
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expectNoHorizontalOverflow(page);
});
@@ -401,16 +417,16 @@ test.describe("authenticated mobile shell flow", () => {
await expect(form).toBeVisible();
await expect(form.locator('input[name="action"][value="profile"]')).toHaveCount(1);
const email = form.locator('[data-ui-id="ui.settings.profile.email"]').first();
const email = page.locator('[data-ui-id="ui.settings.profile.email"]').first();
await expect(email).toBeVisible();
await expect(email).toBeDisabled();
await expect(email).not.toHaveValue("");
await expect(form.locator('[data-ui-id="ui.settings.profile.firstName"]').first()).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.profile.lastName"]').first()).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.profile.save"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.session.panel"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.danger.delete"]').first()).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.profile.basicInfo.save"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.password.open"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.security.manage"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
});
@@ -420,7 +436,11 @@ test.describe("authenticated mobile shell flow", () => {
const routeChecks = [
{ name: "account settings", path: tenantSettingsAccountPath(dashboardPath) },
{ name: "profile settings", path: tenantSettingsProfilePath(dashboardPath) },
{ name: "subscription settings", path: tenantSettingsSubscriptionPath(dashboardPath), readySelector: '[data-ui-id="ui.subscription.page"]' },
{
name: "subscription settings",
path: tenantSettingsSubscriptionPath(dashboardPath),
readySelector: '[data-ui-id^="ui.billing.selfServiceSubscription."]',
},
...(pluginSettingsPath ? [{ name: "plugin settings", path: pluginSettingsPath }] : []),
...(workflowBuilderPath ? [{ name: "workflow builder", path: workflowBuilderPath }] : []),
];
@@ -449,12 +469,12 @@ test.describe("authenticated mobile shell flow", () => {
await expectNoHorizontalOverflow(page);
await sidebarTrigger.click();
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first()).toBeVisible();
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await page.keyboard.press("Escape");
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await moreTrigger.click();
await expect(page.locator('[data-ui-id="ui.action.shell.signOut"]').first()).toBeVisible();
@@ -577,10 +597,10 @@ test.describe("authenticated mobile shell browser history slice", () => {
const settingsProfilePath = tenantSettingsProfilePath(dashboardPath);
const mobileSidebar = page.locator(mobileSidebarSelector);
await page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').click();
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
await mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first().click();
await expect(page).toHaveURL(pathPattern(settingsProfilePath));
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expectMobileShellControlsUsable(page);
await page.goBack({ waitUntil: "domcontentloaded" });
@@ -602,11 +622,13 @@ test.describe("authenticated mobile shell browser history slice", () => {
const originRoute = { name: "profile settings", path: settingsProfilePath, readySelector: '[data-ui-id="ui.settings.profile.page"]' };
const crossSurfaceRoutes = [
{ name: "subscription settings", path: tenantSettingsSubscriptionPath(dashboardPath), readySelector: '[data-ui-id="ui.subscription.page"]' },
{
name: "subscription settings",
path: tenantSettingsSubscriptionPath(dashboardPath),
readySelector: '[data-ui-id^="ui.billing.selfServiceSubscription."]',
},
...(pluginSettingsPath ? [{ name: "plugin settings", path: pluginSettingsPath, readySelector: '[data-ui-id="ui.plugins.page"]' }] : []),
...(workflowBuilderPath
? [{ name: "workflow builder", path: workflowBuilderPath, readySelector: '[data-ui-id="ui.workflows.builder.canvas"]' }]
: []),
...(workflowBuilderPath ? [{ name: "workflow builder", path: workflowBuilderPath, readySelector: '[data-ui-id="ui.workflows.builder.canvas"]' }] : []),
...(workflowRunManualPath
? [{ name: "workflow manual run", path: workflowRunManualPath, readySelector: '[data-ui-id="ui.workflows.run.manual.form"]' }]
: []),
@@ -638,12 +660,12 @@ test.describe("authenticated compact mobile shell flow", () => {
const sidebarTrigger = page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]');
const mobileSidebar = page.locator(mobileSidebarSelector);
await sidebarTrigger.click();
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first()).toBeVisible();
await expect(mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await page.keyboard.press("Escape");
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expect(sidebarTrigger).toBeFocused();
await expectNoHorizontalOverflow(page);
@@ -657,14 +679,14 @@ test.describe("authenticated compact mobile shell flow", () => {
await expect(moreTrigger).toBeFocused();
await expectNoHorizontalOverflow(page);
const searchTrigger = page.locator('[data-ui-id="ui.action.shell.search"]');
const searchTrigger = page.locator('[data-ui-id="ui.action.shell.searchMobile"]');
await searchTrigger.click();
const palette = page.locator('[data-ui-id="ui.surface.commandPalette.portal"]');
const searchInput = page.locator('[data-ui-id="ui.surface.commandPalette.search"]');
await expect(palette).toBeVisible();
await expect(searchInput).toBeFocused();
await searchInput.fill("settings");
await expect(page.locator('[data-ui-id="ui.surface.commandPalette.row"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id^="ui.surface.commandPalette.action."], [data-ui-id^="ui.surface.commandPalette.result."]').first()).toBeVisible();
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
await page.keyboard.press("Escape");
@@ -674,23 +696,23 @@ test.describe("authenticated compact mobile shell flow", () => {
const settingsProfilePath = tenantSettingsProfilePath(dashboardPath);
await sidebarTrigger.click();
await expect(mobileSidebar).toBeVisible();
await expectMobileSidebarOpen(mobileSidebar);
await mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first().click();
await expect(page).toHaveURL(pathPattern(settingsProfilePath));
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expectNoHorizontalOverflow(page);
// Reopening the drawer right after the settings SPA navigation can race the
// closing Sheet's state, dropping the first trigger click. Retry the open
// (only clicking while it is still closed, so we never toggle it back shut).
await expect(async () => {
if (!(await mobileSidebar.isVisible())) {
if (!(await isMobileSidebarOpen(mobileSidebar))) {
await sidebarTrigger.click();
}
await expect(mobileSidebar).toBeVisible({ timeout: 2000 });
await expectMobileSidebarOpen(mobileSidebar);
}).toPass({ timeout: 15000 });
await page.keyboard.press("Escape");
await expect(mobileSidebar).toBeHidden();
await expectMobileSidebarClosed(mobileSidebar);
await expect(sidebarTrigger).toBeFocused();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -5,7 +5,7 @@ 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;
* -> 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
@@ -16,7 +16,7 @@ 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 }) => {
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!);
@@ -25,12 +25,14 @@ test.describe("notifications smoke", () => {
await expect(page.locator('[data-ui-id="ui.notifications.center"]')).toBeVisible();
// Topbar bell opens the interim drawer (AD-28) instead of navigating.
// 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.locator('[data-ui-id="ui.notifications.drawer"]')).toBeVisible();
await page.locator('[data-ui-id="ui.notifications.drawer.close"]').click();
await expect(page).toHaveURL(new RegExp(`${notificationsPath.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.notifications.center"]')).toBeVisible();
}
});
@@ -0,0 +1,48 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* R-P9 Plantafel-Smoke (DoD D.19): Login -> /projects/plantafel oeffnen ->
* Filterleiste (Suche + Monteur-Auswahl) sichtbar -> auf die Wochenansicht
* wechseln -> Loader-Roundtrip (view=calendar in der URL, Mo-So-Raster samt
* Wochennavigation sichtbar).
*
* Die Route ist modul-gegated (Projekt-Connector) + permission-gegated
* (plantafel.read_own). Bei aktivem Modul + Berechtigung rendert sie die
* interim PlantafelPage mit der Filterleiste
* (`data-ui-id="ui.projects.plantafel.filter"`). Skippt ohne E2E-Credentials /
* wenn die Route im Environment nicht erreichbar ist (404 bei fehlendem
* Modul/Recht).
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const plantafelPath = process.env.E2E_TENANT_PLANTAFEL_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/projects/plantafel");
test.describe("p9 operations smoke", () => {
test("renders the plantafel and switches to the week view", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Plantafel smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(plantafelPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Plantafel path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.projects.plantafel.filter"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.projects.plantafel.filter.search"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.projects.plantafel.filter.assignee"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.projects.plantafel.filter.sort"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.projects.plantafel.filter.past"]')).toBeVisible();
// Main action: switch to the week view. The route reflects it into the URL
// via a server-side re-load, proving the loader roundtrip.
await page.locator('[data-ui-id="ui.projects.plantafel.viewToggle.calendar"]').click();
await page.waitForURL(/[?&]view=calendar(?:&|$)/u);
await expect(page.locator('[data-ui-id="ui.projects.plantafel.week"]')).toBeVisible();
await expect(page.locator('[data-ui-id="ui.projects.plantafel.weekNav"]')).toBeVisible();
// The table-only controls step aside in the week view.
await expect(page.locator('[data-ui-id="ui.projects.plantafel.filter.search"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.projects.plantafel.filter.sort"]')).toHaveCount(0);
});
});
@@ -0,0 +1,57 @@
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const tenantSlug = dashboardPath.split("/").filter(Boolean)[0] ?? "app";
const passwordsPath = process.env.E2E_TENANT_PASSWORDS_PATH ?? `/${tenantSlug}/passwords`;
test.describe("password manager mobile, accessibility and primary flow", () => {
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
test("opens a vault and keeps entries, grants and redacted activities reachable", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Password manager E2E inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(passwordsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Password manager is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.hr.passwordSafe.list"], [data-ui-id="ui.hr.passwordSafe.empty"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page, { include: '[data-ui-id="ui.hr.passwordSafe"]' });
const firstVault = page.locator('[data-ui-id="ui.hr.passwordSafe.list"] [data-row-id]').first();
if ((await firstVault.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("Password manager review fixture needs at least one accessible vault");
}
await firstVault.click();
await expect(page.locator('[data-ui-id="ui.hr.vault"]')).toBeVisible();
await expect(page.getByRole("tab", { name: /Einträge|Entries/u })).toBeVisible();
const reveal = page.locator('[data-ui-id="ui.hr.vault.reveal"]').first();
await expect(reveal).toBeVisible();
await reveal.click();
await expect(page.locator('[data-ui-id="ui.hr.vault.revealed"]').first()).toBeVisible();
await page.getByRole("button", { name: /Ausblenden|Hide/u }).first().click();
await expect(page.locator('[data-ui-id="ui.hr.vault.revealed"]')).toHaveCount(0);
await page.getByRole("tab", { name: /Freigaben|Access/u }).click();
await expect(page.locator('[data-ui-id="ui.hr.vault.access"]')).toBeVisible();
await page.getByRole("button", { name: /Freigaben verwalten|Manage access/u }).click();
const accessDialog = page.locator('[data-ui-id="ui.hr.vault.grantAccess"]');
await expect(accessDialog).toBeVisible();
await expect(accessDialog.getByRole("combobox", { name: /Person|User/u })).toBeVisible();
await expectNoCriticalA11yViolations(page, { include: '[data-ui-id="ui.hr.vault.grantAccess"]' });
await accessDialog.getByRole("button", { name: /Abbrechen|Cancel/u }).click();
await page.getByRole("tab", { name: /Aktivitäten|Activities/u }).click();
await expect(page.locator('[data-ui-id="ui.hr.vault.activities"]')).toBeVisible();
await expect(page.locator("body")).not.toContainText(/passwordCiphertext|usernameCiphertext|notesCiphertext/u);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page, { include: '[data-ui-id="ui.hr.vault"]' });
});
});
@@ -0,0 +1,104 @@
import * as OTPAuth from "otpauth";
import { expect, test, type Page } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { loginAsAdminUser } from "./utils/auth";
import { waitForHydration } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials =
process.env.E2E_ADMIN_EMAIL && process.env.E2E_ADMIN_PASSWORD ? { email: process.env.E2E_ADMIN_EMAIL, password: process.env.E2E_ADMIN_PASSWORD } : null;
const platformLeadsPath = process.env.E2E_ADMIN_PLATFORM_LEADS_PATH ?? "/leads";
const platformLeadSourceName = process.env.E2E_ADMIN_PLATFORM_LEAD_SOURCE_NAME ?? "E2E Readiness Platform Leads";
async function establishTemporaryAdminMfaStepUp(page: Page): Promise<() => Promise<void>> {
if (new URL(page.url()).pathname !== "/settings/profile") return async () => undefined;
const password = page.locator('[data-ui-id="ui.settings.profile.mfa.passwordCurrent"]');
const toggle = page.locator('[data-ui-id="ui.settings.profile.mfa.toggle.submit"]');
await expect(password).toBeVisible();
await password.fill(credentials!.password);
await toggle.click();
const setupUri = page.getByLabel(/Authenticator setup URI|Authenticator-Einrichtungs-URI/iu);
await expect(setupUri).toBeVisible();
const uri = (await setupUri.textContent())?.trim();
expect(uri, "Temporary E2E admin MFA enrollment returned no setup URI").toBeTruthy();
const code = OTPAuth.URI.parse(uri!).generate();
await page.locator('[data-ui-id="ui.settings.profile.mfa.confirm.code"]').fill(code);
await page.locator('[data-ui-id="ui.settings.profile.mfa.confirm.submit"]').click();
await expect(page.getByText(/^(Enabled|Aktiviert)$/iu).first()).toBeVisible();
return async () => {
await page.goto("/settings/profile", { waitUntil: "domcontentloaded" });
await expect(password).toBeVisible();
await password.fill(credentials!.password);
await toggle.click();
await expect(page.getByText(/^(Not enabled|Nicht aktiviert)$/iu).first()).toBeVisible();
};
}
test.describe("R-LEADS platform lead inbox", () => {
test("creates a lead through the native inbox and shows the persisted result", async ({ page }, testInfo) => {
skipOrFailWhenE2eInputsMissing(["E2E_ADMIN_EMAIL", "E2E_ADMIN_PASSWORD"], "Skipping authenticated platform-lead smoke");
await loginAsAdminUser(page, credentials!);
const cleanupMfa = await establishTemporaryAdminMfaStepUp(page);
try {
const newLeadPath = `${platformLeadsPath.replace(/\/$/u, "")}/new`;
const response = await page.goto(newLeadPath, { waitUntil: "domcontentloaded" });
expect(response, "Platform lead intake returned no document response").not.toBeNull();
expect(response!.ok(), `Platform lead intake returned ${response!.status()}`).toBe(true);
expect(new URL(page.url()).pathname).toBe(newLeadPath);
await waitForHydration(page);
const createScreen = page.locator('[data-ui-id="ui.admin.platformLeads.new"]');
await expect(createScreen).toBeVisible();
await expect(page.getByRole("heading", { name: /^(Lead manuell anlegen|Create lead manually)$/iu })).toBeVisible();
const sourceSelect = page.getByRole("combobox", { name: /^(Quelle|Source)$/iu }).first();
await expect(sourceSelect).toBeEnabled();
await sourceSelect.click();
const sourceOption = page.getByRole("option", { name: platformLeadSourceName, exact: true });
await expect(sourceOption, `Seeded platform lead source ${platformLeadSourceName} must be available`).toBeVisible();
await sourceOption.click();
const suffix = `${Date.now()}-${testInfo.workerIndex}`;
const firstName = "E2E";
const lastName = `Smoke ${suffix}`;
const displayName = `${firstName} ${lastName}`;
const company = `HiveGrid E2E ${suffix}`;
const message = `Persisted platform lead smoke ${suffix}`;
await createScreen.locator('input[name="firstName"]').fill(firstName);
await createScreen.locator('input[name="lastName"]').fill(lastName);
await createScreen.locator('input[name="email"]').fill(`platform-lead-${suffix}@example.test`);
await createScreen.locator('input[name="company"]').fill(company);
await createScreen.locator('textarea[name="message"]').fill(message);
await createScreen.getByRole("button", { name: /^(Lead erstellen|Create lead)$/iu }).click();
await page.waitForURL((url) => /^\/leads\/[^/]+$/u.test(url.pathname) && url.searchParams.get("feedback") === "created");
const detailScreen = page.locator('[data-ui-id="ui.admin.platformLeads.detail"]');
await expect(detailScreen).toBeVisible();
await expect(page.getByRole("heading", { name: displayName, exact: true })).toBeVisible();
await expect(detailScreen.getByText(/^(Lead wurde angelegt\.|Lead created\.)$/iu)).toBeVisible();
await expect(detailScreen.getByText(company, { exact: true })).toBeVisible();
await expect(detailScreen.getByText(message, { exact: true })).toBeVisible();
await expect(detailScreen.getByText(platformLeadSourceName, { exact: true })).toBeVisible();
const note = `Verified in platform lead smoke ${suffix}`;
await detailScreen.locator('textarea[name="note"]').fill(note);
await detailScreen.getByRole("button", { name: /^(Notiz hinzufügen|Add note)$/iu }).click();
await page.waitForURL((url) => /^\/leads\/[^/]+$/u.test(url.pathname) && url.searchParams.get("feedback") === "updated");
await expect(detailScreen.getByText(/^(Lead wurde aktualisiert\.|Lead updated\.)$/iu)).toBeVisible();
await expect(detailScreen.getByText(note, { exact: true })).toBeVisible();
await expectNoCriticalA11yViolations(page, { include: '[data-ui-id="ui.admin.platformLeads.detail"]' });
} finally {
// Preserve the primary assertion error if the page is already being
// closed by Playwright's test timeout. A fresh readiness seed also
// clears disposable MFA fixture state before the next live run.
await cleanupMfa().catch(() => undefined);
}
});
});
@@ -135,7 +135,7 @@ test.describe("plugin hook lifecycle mobile a11y", () => {
});
await auditLink.click();
await expect(page).toHaveURL(/\/settings\/plugins\/[^/?#]+\/audit(?:[?#].*)?$/u);
await expect(page).toHaveURL(/\/settings\/integrations\/plugins\/[^/?#]+\/audit(?:[?#].*)?$/u);
// No data-ui-ids exist on the audit route; assert via real rendered text.
await expect(page.getByRole("heading", { name: new RegExp(escapeRegExp(lifecyclePluginId), "u") }).first()).toBeVisible();
@@ -216,8 +216,10 @@ test.describe("plugin hook lifecycle mobile a11y", () => {
await skipIfUnavailable(page, response, "Plugin hook lifecycle deactivate/re-enable path");
let pluginRow = await readinessPluginRow(page);
const lifecycleForm = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
if ((await lifecycleForm.count()) === 0 || !(await lifecycleForm.isVisible())) {
// AK-UI-05: the lifecycle control is a ~/ui button carrying its op in
// `data-op`, not a <Form> with a hidden input.
const lifecycleControl = lifecycleButton(pluginRow);
if ((await lifecycleControl.count()) === 0 || !(await lifecycleControl.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Plugin readiness fixture has no manageable lifecycle controls");
}
@@ -235,22 +237,21 @@ test.describe("plugin hook lifecycle mobile a11y", () => {
pluginRow = await readinessPluginRow(page);
// Deactivate.
await pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"] [data-ui-id="ui.plugins.lifecycle.button"]').first().click();
await expect(pluginRow.locator('input[name="op"]').first()).toHaveValue("enable");
await lifecycleButton(pluginRow).click();
await expect(lifecycleButton(pluginRow)).toHaveAttribute("data-op", "enable");
await page.reload({ waitUntil: "domcontentloaded" });
pluginRow = await readinessPluginRow(page);
await expect(pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"] input[name="op"]').first()).toHaveValue("enable");
await expect(lifecycleButton(pluginRow)).toHaveAttribute("data-op", "enable");
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
// Re-enable.
const enableForm = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
await enableForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').click();
await expect(pluginRow.locator('input[name="op"]').first()).toHaveValue("disable");
await lifecycleButton(pluginRow).click();
await expect(lifecycleButton(pluginRow)).toHaveAttribute("data-op", "disable");
await page.reload({ waitUntil: "domcontentloaded" });
pluginRow = await readinessPluginRow(page);
await expect(pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"] input[name="op"]').first()).toHaveValue("disable");
await expect(lifecycleButton(pluginRow)).toHaveAttribute("data-op", "disable");
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -357,15 +358,22 @@ type CapabilityGrantSnapshot = {
granted: boolean;
};
function capabilityRevokeForm(pluginRow: Locator, capabilityName: string): Locator {
return pluginRow
.locator(`[data-ui-id="ui.plugins.capability.revoke.form"]:has(input[name="capabilityNames[]"][value="${capabilityName}"])`)
.first();
/**
* AK-UI-05: revoking is a per-capability trigger that opens a destructive
* confirm dialog. The trigger only renders while the capability is granted, so
* its presence still IS the "granted" signal.
*/
function capabilityRevokeTrigger(pluginRow: Locator, capabilityName: string): Locator {
return pluginRow.locator(`[data-ui-id="ui.plugins.capability.revoke.button"][data-capability="${capabilityName}"]`).first();
}
function lifecycleButton(pluginRow: Locator): Locator {
return pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first();
}
async function isCapabilityGranted(pluginRow: Locator, capabilityName: string): Promise<boolean> {
const form = capabilityRevokeForm(pluginRow, capabilityName);
return (await form.count()) > 0 && (await form.isVisible());
const trigger = capabilityRevokeTrigger(pluginRow, capabilityName);
return (await trigger.count()) > 0 && (await trigger.isVisible());
}
async function snapshotCapabilityGrant(page: Page, capabilityName: string): Promise<CapabilityGrantSnapshot> {
@@ -387,13 +395,12 @@ async function ensureCapabilityGranted(page: Page, capabilityName: string): Prom
}
await reviewButton.click();
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
await expect(reviewForm).toBeVisible();
const capabilityCheckbox = reviewForm.locator(`input[name="capabilities[]"][value="${capabilityName}"]`).first();
const capabilityCheckbox = reviewForm.locator(`[data-ui-id="ui.plugins.capabilityReview.checkbox"][data-capability="${capabilityName}"]`).first();
if ((await capabilityCheckbox.count()) === 0) {
skipOrFailWhenE2eFixtureMissing(`Plugin readiness fixture review form has no ${capabilityName} capability to grant`);
skipOrFailWhenE2eFixtureMissing(`Plugin readiness fixture review dialog has no ${capabilityName} capability to grant`);
}
const checkboxes = reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"]:not([disabled])');
@@ -429,7 +436,10 @@ async function restoreCapabilityGrant(page: Page, snapshot: CapabilityGrantSnaps
const granted = await isCapabilityGranted(pluginRow, snapshot.capabilityName);
if (granted && !snapshot.granted) {
await capabilityRevokeForm(pluginRow, snapshot.capabilityName).locator('[data-ui-id="ui.plugins.capability.revoke.button"]').click();
await capabilityRevokeTrigger(pluginRow, snapshot.capabilityName).click();
const revokeDialog = page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]').first();
await expect(revokeDialog).toBeVisible();
await revokeDialog.locator('[data-ui-id="ui.plugins.capability.revoke.confirm"]').click();
await page.reload({ waitUntil: "domcontentloaded" });
pluginRow = await readinessPluginRow(page);
} else if (!granted && snapshot.granted) {
@@ -445,9 +455,9 @@ async function restoreCapabilityGrant(page: Page, snapshot: CapabilityGrantSnaps
}
async function lifecycleOperation(pluginRow: Locator): Promise<"enable" | "disable" | null> {
const op = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"] input[name="op"]').first();
if ((await op.count()) === 0) return null;
const value = await op.inputValue();
const button = lifecycleButton(pluginRow);
if ((await button.count()) === 0) return null;
const value = await button.getAttribute("data-op");
return value === "enable" || value === "disable" ? value : null;
}
@@ -462,12 +472,10 @@ async function restoreLifecycleEnabled(page: Page, enabled: boolean): Promise<vo
const currentEnabled = operation === "disable";
if (currentEnabled === enabled) return;
await pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first().click();
await expect(pluginRow.locator('input[name="op"]').first()).toHaveValue(enabled ? "disable" : "enable");
await lifecycleButton(pluginRow).click();
await expect(lifecycleButton(pluginRow)).toHaveAttribute("data-op", enabled ? "disable" : "enable");
await page.reload({ waitUntil: "domcontentloaded" });
await expect((await readinessPluginRow(page)).locator('[data-ui-id="ui.plugins.lifecycle.form"] input[name="op"]').first()).toHaveValue(
enabled ? "disable" : "enable"
);
await expect(lifecycleButton(await readinessPluginRow(page))).toHaveAttribute("data-op", enabled ? "disable" : "enable");
}
async function firstExistingLocator(primary: Locator, fallback: Locator): Promise<Locator> {
@@ -61,23 +61,20 @@ test.describe("plugin settings mobile a11y", () => {
skipOrFailWhenE2eFixtureMissing("Plugin settings fixture has no missing capabilities to review");
}
const reviewPanelId = await reviewButton.getAttribute("aria-controls");
expect(reviewPanelId).toMatch(/.+/u);
// AK-UI-05: the review is a real ~/ui dialog. It is portaled to the body, so
// it is scoped from the page, not from the plugin row. The "reviewed" state
// lives in React (no hidden input any more) — the approve button's enabled
// state IS the observable contract.
await expect(reviewButton).toHaveAttribute("aria-haspopup", "dialog");
await expect(reviewButton).toHaveAttribute("aria-expanded", "false");
await reviewButton.focus();
await expect(reviewButton).toBeFocused();
await page.keyboard.press("Space");
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
await expect(reviewForm).toBeVisible();
await expect(reviewForm).toHaveAttribute("id", reviewPanelId!);
await expect(reviewForm).toHaveAccessibleName(new RegExp(readinessPluginId, "u"));
await expect(reviewForm.locator('input[name="id"]')).toHaveValue(/.+/u);
await expect(reviewForm.locator('input[name="op"]')).toHaveValue(/^(grant|grantAndEnable)$/u);
await expect(reviewForm.locator('input[name="capabilityReviewDigest"]')).toHaveValue(/.+/u);
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("no");
const approveButton = await firstExistingLocator(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.button"]').first(), page.getByRole("button", { name: /approve|freigeben/i }).last());
await expect(approveButton).toBeDisabled();
@@ -87,20 +84,14 @@ test.describe("plugin settings mobile a11y", () => {
for (let index = 0; index < checkboxCount; index += 1) {
await checkboxes.nth(index).check();
}
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("yes");
await expect(approveButton).toBeEnabled();
await checkboxes.first().uncheck();
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("no");
await expect(approveButton).toBeDisabled();
const confirmation = await firstExistingLocator(
checkboxes.first(),
page.getByLabel(/reviewed the requested plugin capabilities|angeforderten plugin-berechtigungen geprüft/i).first(),
);
const confirmation = checkboxes.first();
await expect(confirmation).toBeVisible();
await confirmation.check();
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("yes");
await expect(approveButton).toBeEnabled();
await expectNoHorizontalOverflow(page);
@@ -135,8 +126,7 @@ test.describe("plugin settings mobile a11y", () => {
const submittedPost = await capturePluginPost(page);
await reviewButton.click();
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
await expect(reviewForm).toBeVisible();
const checkboxes = reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"]:not([disabled])');
@@ -151,7 +141,6 @@ test.describe("plugin settings mobile a11y", () => {
for (let index = 0; index < checkboxCount; index += 1) {
await checkboxes.nth(index).check();
}
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("yes");
await expect(approveButton).toBeEnabled();
await denyButton.click();
@@ -160,10 +149,10 @@ test.describe("plugin settings mobile a11y", () => {
await expect(reviewForm).toHaveCount(0);
await expect.poll(submittedPost, { message: "capability deny stays non-mutating", timeout: 500 }).toBeNull();
// Deny drops every tick: re-opening starts from an unreviewed, blocked state.
await reviewButton.click();
await expect(reviewForm).toBeVisible();
await expect(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"]').first()).not.toBeChecked();
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("no");
await expect(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.button"]').first()).toBeDisabled();
await expectNoHorizontalOverflow(page);
@@ -187,8 +176,7 @@ test.describe("plugin settings mobile a11y", () => {
await reviewButton.click();
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
await expect(reviewForm).toBeVisible();
const approveButton = await firstExistingLocator(
reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.button"]').first(),
@@ -205,7 +193,6 @@ test.describe("plugin settings mobile a11y", () => {
for (let index = 0; index < confirmationCount; index += 1) {
await confirmations.nth(index).check();
}
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("yes");
await expect(approveButton).toBeEnabled();
const expectedPathname = new URL(page.url()).pathname;
@@ -226,18 +213,21 @@ test.describe("plugin settings mobile a11y", () => {
});
await approveButton.click();
// AK-UI-05: a rejected grant must NOT tear the dialog down. The error is
// announced inside the dialog the manager is standing in, and the controls
// stay usable so they can retry.
const alert = page.getByRole("alert").filter({ hasText: /capability review is stale|berechtigungsprüfung.*veraltet/i });
await expect(alert).toBeVisible();
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
await expect(alert.first()).toBeVisible();
await expect(reviewForm).toBeVisible();
await expect(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.error"]')).toBeVisible();
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
await expect(approveButton).toBeEnabled();
await reviewButton.focus();
await expect(reviewButton).toBeFocused();
await page.keyboard.press("Enter");
// Escape closes the modal (standard dialog semantics); the trigger reopens it.
await page.keyboard.press("Escape");
await expect(reviewForm).toHaveCount(0);
await expect(reviewButton).toHaveAttribute("aria-expanded", "false");
await page.keyboard.press("Enter");
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
await reviewButton.click();
await expect(reviewForm).toBeVisible();
});
@@ -252,7 +242,7 @@ test.describe("plugin settings mobile a11y", () => {
const initialState = await snapshotPluginCapabilityState(page, readinessPluginId, "audit");
try {
let pluginRow = await readinessPluginRow(page);
await revokeCapabilityIfGranted(pluginRow, "audit");
await revokeCapabilityIfGranted(page, pluginRow, "audit");
await page.reload({ waitUntil: "domcontentloaded" });
pluginRow = await readinessPluginRow(page);
@@ -265,10 +255,9 @@ test.describe("plugin settings mobile a11y", () => {
}
await reviewButton.click();
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
await expect(reviewForm).toBeVisible();
await expect(reviewForm.locator('input[name="capabilities[]"][value="audit"]')).toHaveCount(1);
await expect(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"][data-capability="audit"]')).toHaveCount(1);
const approveButton = await firstExistingLocator(
reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.button"]').first(),
@@ -293,20 +282,19 @@ test.describe("plugin settings mobile a11y", () => {
// fetch, so the reloaded loader can read stale (pre-grant) state and the
// revoke form never appears.
pluginRow = await readinessPluginRow(page);
await expect(capabilityRevokeForm(pluginRow, "audit")).toBeVisible();
await expect(capabilityRevokeTrigger(pluginRow, "audit")).toBeVisible();
await page.reload({ waitUntil: "domcontentloaded" });
pluginRow = await readinessPluginRow(page);
const auditRevokeForm = capabilityRevokeForm(pluginRow, "audit");
await expect(auditRevokeForm).toBeVisible();
await expect(capabilityRevokeTrigger(pluginRow, "audit")).toBeVisible();
await auditRevokeForm.locator('[data-ui-id="ui.plugins.capability.revoke.button"]').click();
// Same race on revoke: let the revalidation drop the revoke form before the
// explicit reload re-asserts persistence.
await expect(capabilityRevokeForm(await readinessPluginRow(page), "audit")).toHaveCount(0);
await confirmCapabilityRevoke(page, pluginRow, "audit");
// Same race on revoke: let the revalidation drop the revoke trigger before
// the explicit reload re-asserts persistence.
await expect(capabilityRevokeTrigger(await readinessPluginRow(page), "audit")).toHaveCount(0);
await page.reload({ waitUntil: "domcontentloaded" });
pluginRow = await readinessPluginRow(page);
await expect(capabilityRevokeForm(pluginRow, "audit")).toHaveCount(0);
await expect(capabilityRevokeTrigger(pluginRow, "audit")).toHaveCount(0);
const restoredReviewButton = await firstExistingLocator(
pluginRow.locator('[data-ui-id="ui.plugins.capabilityReview.toggle"]').first(),
@@ -343,7 +331,7 @@ test.describe("plugin settings mobile a11y", () => {
await expect(manifestButton).toHaveAttribute("aria-expanded", "false");
await page.keyboard.press("Enter");
await expect(manifestButton).toHaveAttribute("aria-expanded", "true");
const manifestRow = manifestButton.locator("xpath=ancestor::li[1]");
const manifestRow = manifestButton.locator('xpath=ancestor::*[@data-ui-id="ui.plugins.item"][1]');
const manifestPanel = await firstExistingLocator(manifestRow.locator('[data-ui-id="ui.plugins.manifest.panel"]').first(), pluginRow.locator(`[id="${manifestPanelId}"]`).first());
await expect(manifestPanel).toBeVisible();
await expect(manifestPanel).toContainText(readinessPluginId);
@@ -360,33 +348,25 @@ test.describe("plugin settings mobile a11y", () => {
await skipIfUnavailable(page, response, "Plugin settings lifecycle path");
const pluginRow = await readinessPluginRow(page);
const lifecycleForm = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
if ((await lifecycleForm.count()) === 0 || !(await lifecycleForm.isVisible())) {
const lifecycleControl = lifecycleButton(pluginRow);
if ((await lifecycleControl.count()) === 0 || !(await lifecycleControl.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Plugin fixture has no manageable lifecycle controls");
}
const lifecycleButton = lifecycleForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first();
const form = lifecycleForm;
await expect(form).toHaveCount(1);
await expect(form.locator('input[name="id"]')).toHaveValue(/.+/u);
await expect(form.locator('input[name="op"]')).toHaveValue(/^(enable|disable)$/u);
const csrf = form.locator('input[name="csrf"]');
if ((await csrf.count()) > 0) {
await expect(csrf).toHaveValue(/.+/u);
}
// AK-UI-05: there is no hidden-input form any more. The wire contract is now
// only observable on the POST body — which is exactly what it always was.
await expect(lifecycleControl).toHaveAttribute("data-op", /^(enable|disable)$/u);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const submittedPost = await capturePluginPost(page);
await lifecycleButton.click();
await lifecycleControl.click();
await expect.poll(submittedPost, { message: "lifecycle POST payload was captured" }).not.toBeNull();
const postData = submittedPost()?.postData ?? null;
expect(postDataIncludesField(postData, "id", /.+/u)).toBe(true);
expect(postDataIncludesField(postData, "op", /^(enable|disable)$/u)).toBe(true);
if ((await csrf.count()) > 0) {
expect(postDataIncludesField(postData, "csrf", /.+/u)).toBe(true);
}
expect(postDataIncludesField(postData, "csrf", /.+/u)).toBe(true);
});
test("lifecycle errors stay announced and keep controls retryable", async ({ page }) => {
@@ -396,13 +376,12 @@ test.describe("plugin settings mobile a11y", () => {
await skipIfUnavailable(page, response, "Plugin settings lifecycle error path");
const pluginRow = await readinessPluginRow(page);
const lifecycleForm = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
if ((await lifecycleForm.count()) === 0 || !(await lifecycleForm.isVisible())) {
const lifecycleControl = lifecycleButton(pluginRow);
if ((await lifecycleControl.count()) === 0 || !(await lifecycleControl.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Plugin fixture has no manageable lifecycle controls");
}
const lifecycleButton = lifecycleForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first();
const initialOperation = await lifecycleForm.locator('input[name="op"]').inputValue();
const initialOperation = await lifecycleControl.getAttribute("data-op");
expect(initialOperation).toMatch(/^(enable|disable)$/u);
const expectedPathname = new URL(page.url()).pathname;
@@ -424,17 +403,19 @@ test.describe("plugin settings mobile a11y", () => {
await route.continue();
});
await lifecycleButton.focus();
await expect(lifecycleButton).toBeFocused();
await lifecycleControl.focus();
await expect(lifecycleControl).toBeFocused();
await page.keyboard.press("Enter");
const alert = page.getByRole("alert").filter({ hasText: /plugin lifecycle temporarily unavailable/i });
await expect(alert).toBeVisible();
await expect(alert.first()).toBeVisible();
await expect.poll(() => attempts, { message: "lifecycle error POST was intercepted" }).toBe(1);
await expect(lifecycleForm.locator('input[name="op"]')).toHaveValue(initialOperation);
await expect(lifecycleButton).toBeEnabled();
await lifecycleButton.focus();
await expect(lifecycleButton).toBeFocused();
// The rejected mutation left the plugin state untouched, so the control still
// offers the same operation and stays retryable.
await expect(lifecycleControl).toHaveAttribute("data-op", initialOperation!);
await expect(lifecycleControl).toBeEnabled();
await lifecycleControl.focus();
await expect(lifecycleControl).toBeFocused();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -449,31 +430,30 @@ test.describe("plugin settings mobile a11y", () => {
await skipIfUnavailable(page, response, "Plugin settings persisted lifecycle path");
const pluginRow = await pluginRowById(page, lifecyclePluginId);
const lifecycleForm = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
if ((await lifecycleForm.count()) === 0 || !(await lifecycleForm.isVisible())) {
const lifecycleControl = lifecycleButton(pluginRow);
if ((await lifecycleControl.count()) === 0 || !(await lifecycleControl.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Lifecycle plugin fixture has no manageable lifecycle controls");
}
const initialState = await snapshotPluginLifecycleState(page, lifecyclePluginId);
try {
await expect(lifecycleForm.locator('input[name="op"]')).toHaveValue("disable");
await expect(lifecycleControl).toHaveAttribute("data-op", "disable");
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
await lifecycleForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').click();
await expect(pluginRow.locator('input[name="op"]').first()).toHaveValue("enable");
await lifecycleControl.click();
await expect(lifecycleButton(pluginRow)).toHaveAttribute("data-op", "enable");
await page.reload({ waitUntil: "domcontentloaded" });
const disabledPluginRow = await pluginRowById(page, lifecyclePluginId);
await expect(disabledPluginRow.locator('input[name="op"]').first()).toHaveValue("enable");
await expect(lifecycleButton(disabledPluginRow)).toHaveAttribute("data-op", "enable");
const enableForm = disabledPluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
await enableForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').click();
await expect(disabledPluginRow.locator('input[name="op"]').first()).toHaveValue("disable");
await lifecycleButton(disabledPluginRow).click();
await expect(lifecycleButton(disabledPluginRow)).toHaveAttribute("data-op", "disable");
await page.reload({ waitUntil: "domcontentloaded" });
const enabledPluginRow = await pluginRowById(page, lifecyclePluginId);
await expect(enabledPluginRow.locator('input[name="op"]').first()).toHaveValue("disable");
await expect(lifecycleButton(enabledPluginRow)).toHaveAttribute("data-op", "disable");
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -492,7 +472,7 @@ test.describe("plugin settings mobile a11y", () => {
const settingsLink = pluginRow.locator('[data-ui-id="ui.plugins.settings.open"]').first();
if ((await settingsLink.count()) > 0 && (await settingsLink.isVisible())) {
await settingsLink.click();
await expect(page).toHaveURL(/\/settings\/plugins\/[^/?#]+(?:[?#].*)?$/u);
await expect(page).toHaveURL(/\/settings\/integrations\/plugins\/[^/?#]+(?:[?#].*)?$/u);
}
await expect(page.locator('[data-ui-id="ui.plugins.settings.page"]').first()).toBeVisible();
@@ -659,42 +639,39 @@ test.describe("plugin settings mobile a11y", () => {
}
});
test("capability revoke controls expose a non-mutating form contract", async ({ page }) => {
test("capability revoke confirms in a dialog and keeps the revoke wire contract", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(pluginSettingsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Plugin settings revoke path");
const pluginRow = await readinessPluginRow(page);
const form = pluginRow.locator('[data-ui-id="ui.plugins.capability.revoke.form"]').first();
if ((await form.count()) === 0 || !(await form.isVisible())) {
const trigger = pluginRow.locator('[data-ui-id="ui.plugins.capability.revoke.button"]').first();
if ((await trigger.count()) === 0 || !(await trigger.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Plugin fixture has no granted capability revoke controls");
}
await expect(form.locator('input[name="id"]')).toHaveValue(/.+/u);
await expect(form.locator('input[name="pluginId"]')).toHaveValue(readinessPluginId);
await expect(form.locator('input[name="op"]')).toHaveValue("revoke");
await expect(form.locator('input[name="capabilityNames[]"]')).toHaveValue(/.+/u);
await expect(form.locator('[data-ui-id="ui.plugins.capability.revoke.button"]')).toBeVisible();
const csrf = form.locator('input[name="csrf"]');
if ((await csrf.count()) > 0) {
await expect(csrf).toHaveValue(/.+/u);
}
await expect(trigger).toHaveAttribute("data-capability", /.+/u);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
// AK-UI-05: revoking disables the plugin, so it is gated behind a destructive
// confirm dialog. Opening it must not mutate anything.
const submittedPost = await capturePluginPost(page);
await form.locator('[data-ui-id="ui.plugins.capability.revoke.button"]').click();
await trigger.click();
const dialog = page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]').first();
await expect(dialog).toBeVisible();
await expect.poll(submittedPost, { message: "opening the revoke dialog stays non-mutating", timeout: 500 }).toBeNull();
await expectNoCriticalA11yViolations(page);
await dialog.locator('[data-ui-id="ui.plugins.capability.revoke.confirm"]').click();
await expect.poll(submittedPost, { message: "capability revoke POST payload was captured" }).not.toBeNull();
const postData = submittedPost()?.postData ?? null;
expect(postDataIncludesField(postData, "id", /.+/u)).toBe(true);
expect(postDataIncludesField(postData, "pluginId", new RegExp(`^${escapeRegExp(readinessPluginId)}$`, "u"))).toBe(true);
expect(postDataIncludesField(postData, "op", /^revoke$/u)).toBe(true);
expect(postDataIncludesField(postData, "capabilityNames[]", /.+/u)).toBe(true);
if ((await csrf.count()) > 0) {
expect(postDataIncludesField(postData, "csrf", /.+/u)).toBe(true);
}
expect(postDataIncludesField(postData, "csrf", /.+/u)).toBe(true);
});
});
@@ -719,8 +696,8 @@ test.describe("plugin settings read-only permissions", () => {
await expect(pluginRow).toBeVisible();
await expect(pluginRow.locator('[data-ui-id="ui.plugins.manifest.toggle"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.form"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.button"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capability.revoke.button"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.toggle"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]')).toHaveCount(0);
@@ -755,7 +732,7 @@ test.describe("plugin settings read-only permissions", () => {
const manifestPanelId = await manifestButton.getAttribute("aria-controls");
expect(manifestPanelId).toMatch(/.+/u);
const manifestRow = manifestButton.locator("xpath=ancestor::li[1]");
const manifestRow = manifestButton.locator('xpath=ancestor::*[@data-ui-id="ui.plugins.item"][1]');
const manifestPanel = await firstExistingLocator(
manifestRow.locator('[data-ui-id="ui.plugins.manifest.panel"]').first(),
pluginRow.locator(`[id="${manifestPanelId}"]`).first()
@@ -763,8 +740,8 @@ test.describe("plugin settings read-only permissions", () => {
await expect(manifestPanel).toBeVisible();
await expect(manifestPanel).toContainText(readinessPluginId);
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.form"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.button"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capability.revoke.button"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.toggle"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]')).toHaveCount(0);
await expect.poll(submittedPost, { message: "manifest disclosure stays non-mutating", timeout: 500 }).toBeNull();
@@ -781,7 +758,7 @@ test.describe("plugin settings read-only permissions", () => {
await expect(page.locator('[data-ui-id="ui.plugins.page"]').first()).toBeVisible();
await expect(await readinessPluginRow(page)).toBeVisible();
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.form"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.button"]')).toHaveCount(0);
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]')).toHaveCount(0);
const expectedRedirectPath = new URL(page.url()).pathname;
@@ -896,7 +873,7 @@ async function openReadinessPluginSettingsFrame(page: Page, reason: string): Pro
skipOrFailWhenE2eFixtureMissing(`${reason}: plugin fixture has no settings link`);
}
await settingsLink.click();
await expect(page).toHaveURL(/\/settings\/plugins\/[^/?#]+(?:[?#].*)?$/u);
await expect(page).toHaveURL(/\/settings\/integrations\/plugins\/[^/?#]+(?:[?#].*)?$/u);
}
await expect(page.locator('[data-ui-id="ui.plugins.settings.page"]').first()).toBeVisible();
@@ -1006,7 +983,7 @@ async function restorePluginCapabilityState(page: Page, state: PluginCapabilityS
const row = await pluginRowById(page, state.pluginId);
const granted = await isCapabilityGranted(row, state.capabilityName);
if (granted && !state.granted) {
await revokeCapabilityIfGranted(row, state.capabilityName);
await revokeCapabilityIfGranted(page, row, state.capabilityName);
await page.reload({ waitUntil: "domcontentloaded" });
} else if (!granted && state.granted) {
await grantMissingCapabilities(page, row);
@@ -1049,39 +1026,53 @@ async function ensurePluginEnabledState(page: Page, pluginId: string, enabled: b
throw new Error(`Unable to restore ${pluginId} lifecycle state because lifecycle controls are unavailable`);
}
const form = row.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
await form.locator('[data-ui-id="ui.plugins.lifecycle.button"]').click();
await expect(row.locator('input[name="op"]').first()).toHaveValue(enabled ? "disable" : "enable");
// AK-UI-05: the lifecycle control is a ~/ui button carrying its op, not a
// hidden form input. A plugin that is enabled offers "disable" and vice versa.
await row.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first().click();
await expect(lifecycleButton(row)).toHaveAttribute("data-op", enabled ? "disable" : "enable");
await page.reload({ waitUntil: "domcontentloaded" });
await expect((await pluginRowById(page, pluginId)).locator('input[name="op"]').first()).toHaveValue(enabled ? "disable" : "enable");
await expect(lifecycleButton(await pluginRowById(page, pluginId))).toHaveAttribute("data-op", enabled ? "disable" : "enable");
}
function lifecycleButton(pluginRow: Locator): Locator {
return pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first();
}
async function getPluginLifecycleOperation(pluginRow: Locator): Promise<"enable" | "disable" | null> {
const op = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"] input[name="op"]').first();
if ((await op.count()) === 0) return null;
const value = await op.inputValue();
const button = lifecycleButton(pluginRow);
if ((await button.count()) === 0) return null;
const value = await button.getAttribute("data-op");
return value === "enable" || value === "disable" ? value : null;
}
function capabilityRevokeForm(pluginRow: Locator, capabilityName: string): Locator {
return pluginRow
.locator(
`[data-ui-id="ui.plugins.capability.revoke.form"]:has(input[name="capabilityNames[]"][value="${capabilityName}"])`
)
.first();
/**
* AK-UI-05: revoking is no longer an inline <Form> but a per-capability trigger
* that opens a destructive confirm dialog. The trigger only exists while the
* capability is granted, so its presence still IS the "granted" signal.
*/
function capabilityRevokeTrigger(pluginRow: Locator, capabilityName: string): Locator {
return pluginRow.locator(`[data-ui-id="ui.plugins.capability.revoke.button"][data-capability="${capabilityName}"]`).first();
}
async function revokeCapabilityIfGranted(pluginRow: Locator, capabilityName: string): Promise<void> {
const form = capabilityRevokeForm(pluginRow, capabilityName);
if ((await form.count()) === 0 || !(await form.isVisible())) {
/** Clicks the revoke trigger and confirms in the ~/ui dialog it opens. */
async function confirmCapabilityRevoke(page: Page, pluginRow: Locator, capabilityName: string): Promise<void> {
await capabilityRevokeTrigger(pluginRow, capabilityName).click();
const dialog = page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]').first();
await expect(dialog).toBeVisible();
await dialog.locator('[data-ui-id="ui.plugins.capability.revoke.confirm"]').click();
}
async function revokeCapabilityIfGranted(page: Page, pluginRow: Locator, capabilityName: string): Promise<void> {
const trigger = capabilityRevokeTrigger(pluginRow, capabilityName);
if ((await trigger.count()) === 0 || !(await trigger.isVisible())) {
return;
}
await form.locator('[data-ui-id="ui.plugins.capability.revoke.button"]').click();
await confirmCapabilityRevoke(page, pluginRow, capabilityName);
}
async function isCapabilityGranted(pluginRow: Locator, capabilityName: string): Promise<boolean> {
const form = capabilityRevokeForm(pluginRow, capabilityName);
return (await form.count()) > 0 && (await form.isVisible());
const trigger = capabilityRevokeTrigger(pluginRow, capabilityName);
return (await trigger.count()) > 0 && (await trigger.isVisible());
}
async function grantMissingCapabilities(page: Page, pluginRow: Locator): Promise<void> {
@@ -1094,8 +1085,7 @@ async function grantMissingCapabilities(page: Page, pluginRow: Locator): Promise
}
await reviewButton.click();
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
await expect(reviewForm).toBeVisible();
const checkboxes = reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"]:not([disabled])');
const checkboxCount = await checkboxes.count();
@@ -1,49 +0,0 @@
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const portalManagementPaths = [
{ name: "analytics", path: process.env.E2E_TENANT_PORTAL_ANALYTICS_PATH },
{ name: "settings", path: process.env.E2E_TENANT_PORTAL_SETTINGS_PATH },
].filter((target): target is { name: string; path: string } => Boolean(target.path));
test.describe("portal management mobile a11y", () => {
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
test("portal management pages have no mobile overflow or critical a11y violations", async ({ page }) => {
if (!credentials) {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping portal mobile a11y");
}
if (portalManagementPaths.length === 0) {
skipOrFailWhenE2eFixtureMissing("E2E_TENANT_PORTAL_ANALYTICS_PATH or E2E_TENANT_PORTAL_SETTINGS_PATH is required for portal mobile a11y");
}
await loginAsTenantUser(page, credentials!);
for (const target of portalManagementPaths) {
await page.goto(target.path, { waitUntil: "domcontentloaded" });
// The portals plugin module is gated out of the route config by default
// (app.$tenant/__portals/** in defaultDisabledPluginRouteFilePatterns), so
// the path redirects home when it isn't mounted. Treat that as an
// unavailable optional feature here; the readiness lane
// (REQUIRE_E2E_READINESS=1) still fails loudly so a deployment that ships
// portals is verified there.
const landedOnPortal = new RegExp(`${escapeRegExp(target.path)}(?:[?#].*)?$`, "u").test(page.url());
if (!landedOnPortal) {
skipOrFailWhenE2eFixtureMissing(`Portal route ${target.path} is not mounted (portals module disabled)`);
}
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(target.path)}(?:[?#].*)?$`, "u"));
await expect(page.locator("body")).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
}
});
});
function escapeRegExp(value: string): string {
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
}
@@ -0,0 +1,153 @@
// AK-P21 — smoke for the privacy interim screens (AD-28): hub, export jobs,
// tenant deletion, subprocessors, AVV. Non-mutating: dialogs are opened and
// closed again, no export is started and no deletion is requested. Admin
// sub-areas are permission-gated; the smoke only visits sections whose entry
// cards the hub actually shows for the test user.
import { expect, test, type Page } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { compactMobileViewport, expectNoHorizontalOverflow } from "./utils/mobile";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const privacyPath = process.env.E2E_TENANT_PRIVACY_PATH ?? tenantPath("settings/profile/data");
const SECTION_PAGES = {
export: "ui.settings.privacy.exportJobs.page",
deletion: "ui.settings.privacy.deletion.page",
subprocessors: "ui.settings.privacy.subprocessors.page",
avv: "ui.settings.privacy.avv.page",
} as const;
type SectionKey = keyof typeof SECTION_PAGES;
const SECTION_PATHS: Record<SectionKey, string> = {
export: tenantPath("settings/compliance/data-export"),
deletion: tenantPath("settings/compliance/tenant-deletion"),
subprocessors: tenantPath("settings/compliance/subprocessors"),
avv: tenantPath("settings/compliance/avv"),
};
test.describe("AK-P21 privacy interim smoke", () => {
test("renders the privacy hub with self-service controls", async ({ page }) => {
requireTenantLoginInputs("Privacy hub smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(privacyPath, { waitUntil: "domcontentloaded" });
expect(response?.ok(), `Privacy hub returned ${response?.status() ?? "no response"}`).toBe(true);
await expect(page.locator('[data-ui-id="ui.settings.privacy.page"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.privacy.export.form"]').first()).toBeVisible();
const deleteForm = page.locator('[data-ui-id="ui.settings.privacy.delete.form"]').first();
const reactivateForm = page.locator('[data-ui-id="ui.settings.privacy.reactivate.form"]').first();
await expect.poll(async () => (await deleteForm.count()) + (await reactivateForm.count())).toBeGreaterThan(0);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("opens the permission-gated admin sections from the hub", async ({ page }) => {
requireTenantLoginInputs("Privacy sections smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
for (const section of Object.keys(SECTION_PAGES) as SectionKey[]) {
const visible = await visitSectionFromHub(page, section);
if (!visible) continue;
await expect(
page.locator(`[data-ui-id="${SECTION_PAGES[section]}"], [data-ui-id="ui.settings.privacy.${sectionUiKey(section)}.empty"]`).first()
).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
}
});
test("opens and closes the export start dialog without mutating data", async ({ page }) => {
requireTenantLoginInputs("Privacy export smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const visible = await visitSectionFromHub(page, "export");
if (!visible) {
skipOrFailWhenE2eFixtureMissing("Export section is not visible for the test user");
}
const start = page.locator('[data-ui-id="ui.settings.privacy.exportJobs.startUser"], [data-ui-id="ui.settings.privacy.exportJobs.startEmpty"]').first();
if ((await start.count()) > 0 && (await start.isEnabled())) {
await start.click();
await expect(page.locator('[data-ui-id="ui.settings.privacy.exportJobs.startDialog"]')).toBeVisible();
await page.keyboard.press("Escape");
await expect(page.locator('[data-ui-id="ui.settings.privacy.exportJobs.startDialog"]')).toBeHidden();
}
});
test("opens and closes the tenant deletion wizard without submitting", async ({ page }) => {
requireTenantLoginInputs("Privacy deletion smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const visible = await visitSectionFromHub(page, "deletion");
if (!visible) {
skipOrFailWhenE2eFixtureMissing("Deletion section is not visible for the test user");
}
const open = page.locator('[data-ui-id="ui.settings.privacy.deletion.open"]');
if ((await open.count()) > 0 && (await open.isVisible()) && (await open.isEnabled())) {
await open.click();
await expect(page.locator('[data-ui-id="ui.settings.privacy.deletion.wizard"]')).toBeVisible();
await page.keyboard.press("Escape");
await expect(page.locator('[data-ui-id="ui.settings.privacy.deletion.wizard"]')).toBeHidden();
} else {
// A pending request shows the grace banner with the cancel action instead.
await expect(page.locator('[data-ui-id="ui.settings.privacy.deletion.grace"]')).toBeVisible();
}
});
});
test.describe("AK-P21 privacy compact mobile smoke", () => {
test.use({ viewport: compactMobileViewport, isMobile: true, hasTouch: true });
test("keeps the privacy hub and visible sections readable at 320px", async ({ page }) => {
requireTenantLoginInputs("Privacy compact mobile inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(privacyPath, { waitUntil: "domcontentloaded" });
expect(response?.ok(), `Privacy hub returned ${response?.status() ?? "no response"}`).toBe(true);
await expect(page.locator('[data-ui-id="ui.settings.privacy.page"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
for (const section of Object.keys(SECTION_PAGES) as SectionKey[]) {
const visible = await visitSectionFromHub(page, section);
if (!visible) continue;
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
}
});
});
function sectionUiKey(section: SectionKey): string {
return section === "export" ? "exportJobs" : section;
}
async function visitSectionFromHub(page: Page, section: SectionKey): Promise<boolean> {
const response = await page.goto(privacyPath, { waitUntil: "domcontentloaded" });
expect(response?.ok(), `Privacy hub returned ${response?.status() ?? "no response"}`).toBe(true);
const openButton = page.locator(`[data-ui-id="ui.settings.privacy.sections.${section}.open"]`);
if ((await openButton.count()) === 0) return false;
await Promise.all([page.waitForURL((url) => url.pathname === SECTION_PATHS[section]), openButton.click()]);
const pageUiId = SECTION_PAGES[section];
const emptyUiId = pageUiId.replace(/\.page$/u, ".empty");
await expect(page.locator(`[data-ui-id="${pageUiId}"], [data-ui-id="${emptyUiId}"]`).first()).toBeVisible();
return true;
}
function requireTenantLoginInputs(reason: string): void {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"], reason);
}
function tenantPath(path: string): string {
const normalizedDashboard = dashboardPath.startsWith("/") ? dashboardPath : `/${dashboardPath}`;
const marker = "/dashboard";
const tenantBase = normalizedDashboard.endsWith(marker) ? normalizedDashboard.slice(0, -marker.length) : "/app";
return `${tenantBase}/${path}`;
}
@@ -96,5 +96,5 @@ test.describe("privacy self-service mobile a11y", () => {
function derivePrivacyPath(path: string | undefined): string | undefined {
if (!path) return undefined;
const normalized = path.startsWith("/") ? path : `/${path}`;
return normalized.endsWith("/dashboard") ? normalized.replace(/\/dashboard$/u, "/settings/privacy") : undefined;
return normalized.endsWith("/dashboard") ? normalized.replace(/\/dashboard$/u, "/settings/profile/data") : undefined;
}
@@ -8,6 +8,7 @@ import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const profilePath = process.env.E2E_TENANT_SETTINGS_PROFILE_PATH ?? (dashboardPath ? tenantSettingsProfilePath(dashboardPath) : undefined);
const securityPath = profilePath ? `${profilePath}/security` : undefined;
test.describe("profile security mobile a11y", () => {
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
@@ -22,7 +23,7 @@ test.describe("profile security mobile a11y", () => {
}
});
test("renders security, MFA, session, and danger controls without mobile overflow or critical a11y violations", async ({ page }) => {
test("renders profile security dialogs and the dedicated session page on mobile", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(profilePath!, { waitUntil: "domcontentloaded" });
@@ -31,13 +32,20 @@ test.describe("profile security mobile a11y", () => {
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(profilePath!)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.settings.profile.page"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.form"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.mfa.panel"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.mfa.status"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.mfa.toggle.form"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.password.form"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.session.panel"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.profile.danger.delete"]').first()).toBeVisible();
const passwordOpen = page.locator('[data-ui-id="ui.settings.profile.password.open"]').first();
const mfaManage = page.locator('[data-ui-id="ui.settings.profile.mfa.manage"]').first();
await expect(passwordOpen).toBeVisible();
await expect(mfaManage).toBeVisible();
await passwordOpen.click();
await expect(page.locator('[data-ui-id="ui.settings.profile.password.modal"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
await page.locator('[data-ui-id="ui.settings.profile.password.close"]').first().click();
const securityResponse = await page.goto(securityPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, securityResponse, `Tenant security path ${securityPath}`);
await expect(page.locator('[data-ui-id="ui.settings.security.page"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.security.sessions"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
@@ -48,7 +56,8 @@ test.describe("profile security mobile a11y", () => {
const response = await page.goto(profilePath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant profile path ${profilePath}`);
const form = page.locator('[data-ui-id="ui.settings.profile.password.form"]').first();
await page.locator('[data-ui-id="ui.settings.profile.password.open"]').first().click();
const form = page.locator('[data-ui-id="ui.settings.profile.password.modal"] form').first();
await expect(form).toBeVisible();
await form.locator('[data-ui-id="ui.settings.profile.password.current"]').fill("current-password-for-contract");
await form.locator('[data-ui-id="ui.settings.profile.password.new"]').fill("NewPassword123!");
@@ -71,18 +80,19 @@ test.describe("profile security mobile a11y", () => {
const response = await page.goto(profilePath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant profile path ${profilePath}`);
const form = page.locator('[data-ui-id="ui.settings.profile.mfa.toggle.form"]').first();
if ((await form.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("Profile MFA toggle form is not visible for this fixture");
await page.locator('[data-ui-id="ui.settings.profile.mfa.manage"]').first().click();
const form = page.locator('[data-ui-id="ui.settings.profile.mfa.gate"] form').first();
if ((await form.count()) === 0 || !(await form.isVisible())) {
skipOrFailWhenE2eFixtureMissing("Profile MFA password gate is not visible for this fixture");
}
await expect(form).toBeVisible();
await form.locator('[data-ui-id="ui.settings.profile.mfa.passwordCurrent"]').fill("current-password-for-contract");
await form.locator('[data-ui-id="ui.settings.profile.mfa.gatePassword"]').fill("current-password-for-contract");
const submitted = await interceptCurrentRoutePost(page, { status: 204 });
await form.locator('[data-ui-id="ui.settings.profile.mfa.toggle.submit"]').click();
await form.locator('[data-ui-id="ui.settings.profile.mfa.gateSubmit"]').click();
await expect.poll(() => submitted.value).not.toBeNull();
expect(postDataIncludesField(submitted.value, "action", /^(startTotpEnrollment|disableTotpEnrollment)$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "action", /^startTotpEnrollment$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "passwordCurrent", /^current-password-for-contract$/u)).toBe(true);
});
@@ -0,0 +1,41 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Projekt-Pipeline-Smoke (R-P8a/R-P8b / DoD D.19): Login -> /projects (Kanban)
* oeffnen -> Board-Toolbar sichtbar -> Suche anwenden -> Loader-Roundtrip
* (Query in der URL).
*
* Die Route ist modul-gegated (Projekt-Connector) + permission-gegated
* (projekt.read_own). Bei aktivem Modul + Berechtigung rendert sie die interim
* PipelineKanbanPage mit der Board-Toolbar (`data-ui-id="ui.projects.board.toolbar"`);
* die Board-Suche navigiert mit `?q=<suche>` (server-seitiger Re-Load). Skippt
* ohne E2E-Credentials / wenn die Route im Environment nicht erreichbar ist
* (404 bei fehlendem Modul/Recht).
*/
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const projectsPath = process.env.E2E_TENANT_PROJECTS_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/projects");
test.describe("projekt smoke", () => {
test("renders the pipeline kanban board and applies a search", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Projekt smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(projectsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Projects path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.projects.board.toolbar"]')).toBeVisible();
// Main action: type a board search term and apply it. The route reflects the
// query into the URL via a server-side re-load, proving the loader roundtrip.
const search = page.locator('[data-ui-id="ui.projects.board.search"]');
await search.fill("smoke");
await search.press("Enter");
await page.waitForURL(/[?&]q=smoke(?:&|$)/u);
await expect(page.locator('[data-ui-id="ui.projects.board.toolbar"]')).toBeVisible();
});
});
@@ -9,8 +9,6 @@ const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const subscriptionPath = process.env.E2E_TENANT_SUBSCRIPTION_PATH;
const pluginSettingsPath = process.env.E2E_PLUGIN_SETTINGS_PATH;
const workflowBuilderPath = process.env.E2E_WORKFLOW_BUILDER_PATH;
const workflowRunManualPath = process.env.E2E_WORKFLOW_RUN_MANUAL_PATH;
test.describe("readiness golden path mobile a11y", () => {
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
@@ -27,8 +25,6 @@ test.describe("readiness golden path mobile a11y", () => {
"E2E_TENANT_DASHBOARD_PATH",
"E2E_TENANT_SUBSCRIPTION_PATH",
"E2E_PLUGIN_SETTINGS_PATH",
"E2E_WORKFLOW_BUILDER_PATH",
"E2E_WORKFLOW_RUN_MANUAL_PATH",
],
"Readiness golden path inputs not configured"
);
@@ -41,59 +37,25 @@ test.describe("readiness golden path mobile a11y", () => {
await expect(page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').first()).toBeVisible();
await expectReadinessPage(page);
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar.mobile"], [data-mobile="true"]').first();
await expect(mobileSidebar).toBeHidden();
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar"]').first();
await expect(mobileSidebar).toHaveAttribute("aria-hidden", "true");
await page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').first().click();
await expect(mobileSidebar).toBeVisible();
await expect(mobileSidebar).not.toHaveAttribute("aria-hidden", "true");
await clickAndExpectPath(mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first(), page, /\/settings\/profile(?:[?#].*)?$/u);
await expect(mobileSidebar).toBeHidden();
await expect(mobileSidebar).toHaveAttribute("aria-hidden", "true");
await expectReadinessPage(page);
await clickVisibleLinkToPath(page, subscriptionPath!, "Subscription settings link");
await expect(page.locator('[data-ui-id="ui.subscription.page"]').first()).toBeVisible({ timeout: 10_000 });
await expect(page.locator('[data-ui-id^="ui.billing.selfServiceSubscription."]').first()).toBeVisible({ timeout: 10_000 });
await expectReadinessPage(page);
const checkoutLink = page.locator('[data-ui-id="ui.subscription.checkout.link"]').first();
if (!(await isVisible(checkoutLink))) {
skipOrFailWhenE2eFixtureMissing("No checkout catalog link rendered for this fixture");
}
await clickAndExpectPath(checkoutLink, page, /\/subscribe\/[^/?#]+(?:[?#].*)?$/u);
await expect(page.locator('[data-ui-id="ui.subscription.checkout.page"]').first()).toBeVisible({ timeout: 10_000 });
await expectReadinessPage(page);
await clickVisibleLinkToPath(page, subscriptionPath!, "Checkout back-to-subscription link");
await expect(page.locator('[data-ui-id="ui.subscription.page"]').first()).toBeVisible({ timeout: 10_000 });
await expect(page.locator('[data-ui-id="ui.billing.selfServiceSubscription.builder"]').first()).toBeVisible({ timeout: 10_000 });
await expect(page.locator('[data-ui-id="ui.billing.selfServiceSubscription.preview"]').first()).toBeVisible({ timeout: 10_000 });
await clickVisibleLinkToPath(page, pluginSettingsPath!, "Plugin settings link");
await expect(page.locator('[data-ui-id="ui.plugins.page"]').first()).toBeVisible({ timeout: 10_000 });
await expectReadinessPage(page);
await page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').first().click();
await expect(mobileSidebar).toBeVisible();
await clickAndExpectPath(mobileSidebar.locator('[data-ui-id="ui.nav.app.workflowEngine"]').first(), page, /\/workflow-engine(?:[?#].*)?$/u);
await expect(mobileSidebar).toBeHidden();
await clickVisibleLinkToPath(page, workflowListPathFromBuilderPath(workflowBuilderPath!), "Workflow list link");
await clickVisibleLinkToPath(page, workflowBuilderPath!, "Workflow builder link");
await expect(page.locator('[data-ui-id="ui.workflows.builder.canvas"]').first()).toBeVisible({ timeout: 10_000 });
await expectReadinessPage(page);
const runTrigger = page.locator('[data-ui-id="ui.workflows.run.dropdown.trigger"]').first();
if (!(await isVisible(runTrigger))) {
skipOrFailWhenE2eFixtureMissing("Workflow builder did not render a run dropdown trigger");
}
const runTriggerButton = runTrigger.locator("xpath=ancestor::button[1]");
if (!(await runTriggerButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("Workflow run dropdown is disabled; provide a live deterministic workflow path");
}
await runTrigger.click();
const manualRunOption = page.locator('[data-ui-id="ui.workflows.run.dropdown.manual"]').first();
await expect(manualRunOption).toBeVisible();
await clickAndExpectPath(manualRunOption, page, pathPattern(workflowRunManualPath!));
await expect(page.locator('[data-ui-id="ui.workflows.run.manual.form"]').first()).toBeVisible({ timeout: 10_000 });
await expectReadinessPage(page);
});
});
@@ -128,30 +90,64 @@ async function clickVisibleLinkToPath(page: Page, path: string, label: string):
if (await trySelectSettingsTabToPath(page, path)) {
return;
}
// Cross-section settings links are intentionally absent from each section's
// local tab bar. Return to the canonical settings hub and use its card link,
// matching the user-visible navigation hierarchy.
const settingsMarker = "/settings/";
const settingsIndex = path.indexOf(settingsMarker);
if (settingsIndex >= 0) {
const hubSegment = path.slice(settingsIndex + settingsMarker.length).split("/")[0];
const settingsHubPath = `${path.slice(0, settingsIndex)}${settingsMarker}${hubSegment}`;
await page.goto(settingsHubPath, { waitUntil: "domcontentloaded" });
if (new URL(page.url()).pathname === path.split("?")[0]) {
return;
}
if (await tryClickVisibleLinkToPath(page, path)) {
return;
}
}
skipOrFailWhenE2eFixtureMissing(`${label} was not rendered for ${path}`);
}
async function trySelectSettingsTabToPath(page: Page, path: string): Promise<boolean> {
const combobox = page.getByRole("combobox", { name: "Select..." }).first();
const combobox = page.getByRole("combobox", { name: /Select\.\.\.|Tab navigation/i }).first();
if (!(await isVisible(combobox))) {
return false;
}
const segment = path.split("?")[0].replace(/\/+$/u, "").split("/").pop() ?? "";
if (!segment) {
const pathname = path.split("?")[0].replace(/\/+$/u, "");
const settingsMarker = "/settings/";
const settingsIndex = pathname.indexOf(settingsMarker);
const settingsSegments = settingsIndex >= 0 ? pathname.slice(settingsIndex + settingsMarker.length).split("/") : [];
if (settingsSegments.length === 0) {
return false;
}
const optionName = segment
.split("-")
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(" ");
const hubSegment = settingsSegments[0]!;
const optionName =
{
billing: /Billing|Abrechnung/i,
integrations: /Extensions|Erweiterungen|Integrationen/i,
profile: /My account|Mein Konto/i,
workspace: /Workspace|Arbeitsbereich/i,
compliance: /Compliance|Datenschutz/i,
team: /Team/i,
}[hubSegment] ??
new RegExp(
hubSegment
.split("-")
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(" "),
"i"
);
await combobox.click();
const option = page.getByRole("option", { name: optionName, exact: true }).first();
const option = page.getByRole("option", { name: optionName }).first();
if (!(await isVisible(option))) {
await page.keyboard.press("Escape").catch(() => undefined);
return false;
}
await Promise.all([page.waitForURL(pathPattern(path)), option.click()]);
return true;
const hubPath = `${pathname.slice(0, settingsIndex)}${settingsMarker}${hubSegment}`;
await Promise.all([page.waitForURL((url) => url.pathname === hubPath || url.pathname.startsWith(`${hubPath}/`)), option.click()]);
if (new URL(page.url()).pathname === pathname) return true;
return tryClickVisibleLinkToPath(page, path);
}
async function tryClickVisibleLinkToPath(page: Page, path: string): Promise<boolean> {
@@ -196,10 +192,3 @@ function hrefMatchesPath(href: string | null, path: string): boolean {
function pathPattern(path: string): RegExp {
return new RegExp(`${escapeRegExp(path)}(?:[?#].*)?$`, "u");
}
function workflowListPathFromBuilderPath(path: string): string {
const marker = "/workflow-engine/workflows/";
const index = path.indexOf(marker);
if (index === -1) return path;
return `${path.slice(0, index)}${marker.slice(0, -1)}`;
}
@@ -1,9 +1,28 @@
import { expect, test } from "./utils/test";
import { expect, test, type Page } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { expectAllPasswordRequirementsMet, expectPasswordRequirementsVisible, expectSomePasswordRequirementsMissing } from "./utils/auth";
import { expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { skipOrFailWhenE2eFixtureMissing } from "./utils/readiness";
async function openRegistrationPlanStep(page: Page): Promise<void> {
const planStep = page.locator('[data-ui-id="ui.auth.register.planStep"]');
if (await planStep.isVisible()) return;
const email = page.locator('[data-ui-id="ui.auth.register.email"]').first();
if ((await email.inputValue()) === "") await email.fill(`registration-contract-${Date.now()}@example.test`);
const password = page.locator('[data-ui-id="ui.auth.register.password"]').first();
if ((await password.count()) > 0 && (await password.isVisible()) && (await password.inputValue()) === "") await password.fill("LongEnough1!");
const firstName = page.locator('[data-ui-id="ui.auth.register.firstName"]').first();
const lastName = page.locator('[data-ui-id="ui.auth.register.lastName"]').first();
const company = page.locator('[data-ui-id="ui.auth.register.company"]').first();
if ((await firstName.count()) > 0 && (await firstName.inputValue()) === "") await firstName.fill("E2E");
if ((await lastName.count()) > 0 && (await lastName.inputValue()) === "") await lastName.fill("Registration");
if ((await company.count()) > 0 && (await company.inputValue()) === "") await company.fill("E2E Registration");
await page.locator('[data-ui-id="ui.auth.register.toPlanStep"]').click();
await expect(planStep).toBeVisible();
}
test.describe("register page a11y", () => {
test("/register has no critical or serious axe violations", async ({ page }) => {
await page.goto("/register", { waitUntil: "domcontentloaded" });
@@ -40,6 +59,26 @@ test.describe("register page a11y", () => {
await expectAllPasswordRequirementsMet(requirements);
});
test("/register shows the canonical paid plans and honors a deep-linked choice", async ({ page }) => {
await page.goto("/register?plan=business", { waitUntil: "domcontentloaded" });
if (/\/login(?:[?#].*)?$/u.test(page.url())) {
skipOrFailWhenE2eFixtureMissing("Registration redirects to login in this environment");
}
await openRegistrationPlanStep(page);
const planSelection = page.locator('[data-ui-id="ui.auth.register.planSelection"]');
await expect(planSelection).toBeVisible();
await expect(planSelection.getByText("Core", { exact: true })).toBeVisible();
await expect(planSelection.getByText("Swarm", { exact: true })).toBeVisible();
await expect(planSelection.getByText("Colony", { exact: true })).toBeVisible();
await expect(planSelection.getByRole("radio")).toHaveCount(3);
const colony = planSelection.getByRole("radio", { name: /^Colony/iu });
await expect(colony).toBeChecked();
await expect(page.locator('input[name="selectedSubscriptionPriceId"]')).toHaveValue((await colony.getAttribute("value")) ?? "");
});
test("/register submit contract posts expected fields without creating an account", async ({ page }) => {
const redirectTo = "/app/dashboard";
await page.goto(`/register?redirect=${encodeURIComponent(redirectTo)}`, { waitUntil: "domcontentloaded" });
@@ -72,6 +111,9 @@ test.describe("register page a11y", () => {
const hasLastNameInput = (await lastNameInput.count()) > 0;
if (hasFirstNameInput) await firstNameInput.fill(firstName);
if (hasLastNameInput) await lastNameInput.fill(lastName);
await openRegistrationPlanStep(page);
await page.locator('[data-ui-id="ui.auth.register.consentTerms"]').click();
await page.locator('[data-ui-id="ui.auth.register.consentPrivacy"]').click();
const currentPathname = new URL(page.url()).pathname;
let resolveSubmitted!: (formData: URLSearchParams) => void;
@@ -98,6 +140,7 @@ test.describe("register page a11y", () => {
});
});
const selectedSubscriptionPriceId = await form.locator('input[name="selectedSubscriptionPriceId"]').inputValue();
await form.locator('button[type="submit"]').first().click();
const formData = await submitted;
@@ -105,6 +148,7 @@ test.describe("register page a11y", () => {
expect(formData.get("email")).toBe(email);
expect(formData.get("password")).toBe("LongEnough1!");
expect(formData.get("redirectTo")).toBe(redirectTo);
expect(formData.get("selectedSubscriptionPriceId")).toBe(selectedSubscriptionPriceId);
if (hasCompanyInput) expect(formData.get("company")).toBe(company);
if (hasFirstNameInput) expect(formData.get("first-name")).toBe(firstName);
if (hasLastNameInput) expect(formData.get("last-name")).toBe(lastName);
@@ -134,21 +178,22 @@ test.describe("register validation mobile a11y", () => {
const lastNameInput = page.locator('input[name="last-name"]').first();
if ((await lastNameInput.count()) > 0) await lastNameInput.fill("Validation");
await emailInput.fill("not-an-email");
await passwordInput.fill("short");
await emailInput.fill("registration-validation@example.test");
await passwordInput.fill("LongEnough1!");
await openRegistrationPlanStep(page);
const officeSeats = page.locator('[data-ui-id="ui.auth.register.officeSeats"]');
await officeSeats.fill("0");
await page.locator('[data-ui-id="ui.auth.register.consentTerms"]').click();
await page.locator('[data-ui-id="ui.auth.register.consentPrivacy"]').click();
await page.locator('button[type="submit"]').first().click();
const formError = page.locator('#form-error-message [role="alert"]').first();
const nativeEmailInvalid = await emailInput.evaluate((input) => (input as HTMLInputElement).validationMessage.length > 0);
if ((await formError.count()) > 0 && (await formError.isVisible())) {
await expect(formError).toBeVisible();
} else {
expect(nativeEmailInvalid).toBe(true);
}
const formError = page.getByRole("alert").first();
await expect(formError).toBeVisible();
await expect(officeSeats).toBeEnabled();
const requirements = page.locator('[aria-live="polite"]').first();
if ((await requirements.count()) > 0) {
await expectSomePasswordRequirementsMissing(requirements);
await expectAllPasswordRequirementsMet(requirements);
}
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "./utils/test";
import { expect, test, type Locator, type Page } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import {
expectAllPasswordRequirementsMet,
@@ -11,7 +11,14 @@ import {
tenantSettingsSubscriptionPath,
} from "./utils/auth";
import { compactMobileViewport, expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { escapeRegExp, failOnPaymentProviderNetworkRequests, interceptCurrentRoutePost, postDataIncludesField, singleFetchActionError, skipIfUnavailable } from "./utils/navigation";
import {
escapeRegExp,
failOnPaymentProviderNetworkRequests,
interceptCurrentRoutePost,
postDataIncludesField,
singleFetchActionError,
skipIfUnavailable,
} from "./utils/navigation";
import { optionalE2eBooleanInput, skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing, skipOrFailWhenE2eOptInMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
@@ -24,6 +31,16 @@ const appSidebarSelector =
const zeroTenantAccountStatePattern =
/(?:you belong to 0|0 accounts?|no organizations|no organisations|no account belongs|does not belong to (?:an|any) account|keinem konto|keiner organisation)/iu;
async function acceptRequiredRegistrationConsents(form: Locator): Promise<void> {
const planStep = form.locator('[data-ui-id="ui.auth.register.planStep"]');
if (!(await planStep.isVisible())) {
await form.locator('[data-ui-id="ui.auth.register.toPlanStep"]').click();
await expect(planStep).toBeVisible();
}
await form.locator('[data-ui-id="ui.auth.register.consentTerms"]').click();
await form.locator('[data-ui-id="ui.auth.register.consentPrivacy"]').click();
}
// On mobile the app nav lives inside the sidebar Sheet, which is closed by
// default; open it via the trigger (only when the link is not already mounted,
// to avoid toggling an already-open sidebar shut) before asserting the link.
@@ -42,7 +59,9 @@ async function expectDashboardNavLink(page: Page, dashboardPath: string): Promis
// Restore the default closed state so subsequent overflow/a11y scans don't
// run against an open drawer overlay.
await page.keyboard.press("Escape").catch(() => undefined);
await expect(link).toHaveCount(0).catch(() => undefined);
await expect(link)
.toHaveCount(0)
.catch(() => undefined);
}
}
@@ -82,7 +101,7 @@ test.describe("registration to account dashboard mobile a11y", () => {
await passwordInput.fill("LongEnough1!");
await expectAllPasswordRequirementsMet(requirements);
await expect(page.locator('[data-ui-id="ui.auth.register.submit"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.auth.register.toPlanStep"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
@@ -146,6 +165,7 @@ test.describe("registration to account dashboard mobile a11y", () => {
const hasLastNameInput = (await lastNameInput.count()) > 0;
if (hasFirstNameInput) await firstNameInput.fill(firstName);
if (hasLastNameInput) await lastNameInput.fill(lastName);
await acceptRequiredRegistrationConsents(form);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -209,6 +229,7 @@ test.describe("registration to account dashboard mobile a11y", () => {
if ((await lastNameInput.count()) > 0) {
await lastNameInput.fill("Provisioning");
}
await acceptRequiredRegistrationConsents(form);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -292,6 +313,7 @@ test.describe("registration to account dashboard mobile a11y", () => {
if ((await lastNameInput.count()) > 0) {
await lastNameInput.fill("Verification");
}
await acceptRequiredRegistrationConsents(form);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -307,7 +329,7 @@ test.describe("registration to account dashboard mobile a11y", () => {
await expectNoCriticalA11yViolations(page);
});
test("announces registration errors without leaving the form stuck", async ({ page }) => {
test("announces duplicate registration errors without leaving the form stuck", async ({ page }) => {
await page.goto("/register", { waitUntil: "domcontentloaded" });
if (/\/login(?:[?#].*)?$/u.test(page.url())) {
@@ -322,19 +344,25 @@ test.describe("registration to account dashboard mobile a11y", () => {
skipOrFailWhenE2eFixtureMissing("Registration form is not rendered in this environment");
}
await emailInput.fill(`mobile-error-${Date.now()}@example.test`);
await passwordInput.fill("short");
await emailInput.fill(getTenantCredentials()?.email ?? "e2e.readiness@example.test");
await passwordInput.fill("LongEnough1!aB");
const companyInput = form.locator('[data-ui-id="ui.auth.register.company"], input[name="company"]').first();
const firstNameInput = form.locator('[data-ui-id="ui.auth.register.firstName"], input[name="first-name"]').first();
const lastNameInput = form.locator('[data-ui-id="ui.auth.register.lastName"], input[name="last-name"]').first();
if ((await companyInput.count()) > 0) await companyInput.fill("Duplicate Registration");
if ((await firstNameInput.count()) > 0) await firstNameInput.fill("Duplicate");
if ((await lastNameInput.count()) > 0) await lastNameInput.fill("Registration");
await acceptRequiredRegistrationConsents(form);
// Let the real server validate (a short password fails before any account is
// created); a faked JSON body is not valid single-fetch turbo-stream and would
// break RR7's decoder, so we assert the genuine inline error instead.
// Let the real server reject the existing email. A faked JSON body is not a
// valid single-fetch turbo-stream and would break RR7's decoder.
const submitted = await interceptCurrentRoutePost(page, { passthrough: true });
await submitButton.click();
await expect.poll(() => submitted.value, { timeout: 5_000 }).not.toBeNull();
await expect(form).toBeVisible();
await expect(page.getByRole("alert")).toContainText(
/password is required|password must be|passwort.*(erforderlich|mindestens|zeichen)/i
/already (exists|registered)|conflicts with a previous request|existiert bereits|bereits.*(konto|registriert)|konflikt.*anfrage/i
);
await expect(submitButton).toBeEnabled();
await expectNoHorizontalOverflow(page);
@@ -367,6 +395,11 @@ test.describe("registration to account dashboard mobile a11y", () => {
if ((await companyInput.count()) > 0) {
await companyInput.fill("Duplicate Registration");
}
const firstNameInput = form.locator('[data-ui-id="ui.auth.register.firstName"], input[name="first-name"]').first();
const lastNameInput = form.locator('[data-ui-id="ui.auth.register.lastName"], input[name="last-name"]').first();
if ((await firstNameInput.count()) > 0) await firstNameInput.fill("Duplicate");
if ((await lastNameInput.count()) > 0) await lastNameInput.fill("Registration");
await acceptRequiredRegistrationConsents(form);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -376,7 +409,9 @@ test.describe("registration to account dashboard mobile a11y", () => {
await expect.poll(() => submitted.value, { timeout: 5_000 }).not.toBeNull();
await expect(form).toBeVisible();
await expect(page.getByRole("alert")).toContainText(/already (exists|registered)|existiert bereits|bereits.*(konto|registriert)/i);
await expect(page.getByRole("alert")).toContainText(
/already (exists|registered)|conflicts with a previous request|existiert bereits|bereits.*(konto|registriert)|konflikt.*anfrage/i
);
await expect(emailInput).toHaveValue(email);
await expect(passwordInput).toHaveValue(password);
await expect(submitButton).toBeEnabled();
@@ -552,8 +587,8 @@ test.describe("registration to account dashboard mobile a11y", () => {
const sidebarTrigger = page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').first();
if ((await sidebarTrigger.count()) > 0 && (await sidebarTrigger.isVisible())) {
await sidebarTrigger.click();
const mobileSidebar = page.locator('[data-mobile="true"]').first();
await expect(mobileSidebar).toBeVisible();
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar"]').first();
await expect(mobileSidebar).not.toHaveAttribute("aria-hidden", "true");
const dashboardLink = mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first();
await expect(dashboardLink).toBeVisible();
await dashboardLink.click();
@@ -599,8 +634,7 @@ test.describe("registration to account dashboard mobile a11y", () => {
expect(subscriptionResponse?.status() ?? 200).toBeLessThan(500);
await skipIfUnavailable(page, subscriptionResponse, `Subscription settings path ${subscriptionPath}`);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(subscriptionPath)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.subscription.page"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.subscription.billing.portal"]').first()).toHaveAttribute("type", "button");
await expect(page.locator('[data-ui-id^="ui.billing.selfServiceSubscription."]').first()).toBeVisible();
const checkoutLink = page.locator('[data-ui-id="ui.subscription.checkout.link"]').first();
if ((await checkoutLink.count()) > 0 && (await checkoutLink.isVisible())) {
@@ -636,49 +670,34 @@ test.describe("registration to account dashboard mobile a11y", () => {
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar.mobile"], [data-mobile="true"]').first();
await expect(mobileSidebar).toBeHidden();
const mobileSidebar = page.locator('[data-ui-id="ui.surface.app.sidebar"]').first();
await expect(mobileSidebar).toHaveAttribute("aria-hidden", "true");
await page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').first().click();
await expect(mobileSidebar).toBeVisible();
await expect(mobileSidebar).not.toHaveAttribute("aria-hidden", "true");
const dashboardLink = mobileSidebar.locator('[data-ui-id="ui.nav.app.dashboard"]').first();
await expect(dashboardLink).toBeVisible();
await dashboardLink.click();
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(dashboardPath)}(?:[?#].*)?$`, "u"));
await expect(mobileSidebar).toBeHidden();
await expect(mobileSidebar).toHaveAttribute("aria-hidden", "true");
await expect(page.locator('[data-ui-id="ui.dashboard.page"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
// The "more" overflow is a popover whose trigger may not have hydrated yet right
// after the SPA navigation to the dashboard; a single click can no-op or open and
// re-close. Retry-open until the subscription action mounts (only clicking while
// it's hidden so we never toggle an open popover shut).
const moreTrigger = page.locator('[data-ui-id="ui.action.shell.more"]').first();
const subscriptionAction = page.locator('[data-ui-id="ui.action.shell.subscription"]').first();
await expect(async () => {
if (!(await subscriptionAction.isVisible())) {
await moreTrigger.click();
}
await expect(subscriptionAction).toBeVisible({ timeout: 2000 });
}).toPass({ timeout: 15000 });
const subscriptionPath = process.env.E2E_TENANT_SUBSCRIPTION_PATH ?? tenantSettingsSubscriptionPath(dashboardPath);
const subscriptionLink = await findVisibleLinkByPath(page, '[data-ui-id="ui.action.shell.subscription"]', subscriptionPath);
if (!subscriptionLink) {
skipOrFailWhenE2eFixtureMissing("No mobile shell subscription settings link rendered for this fixture");
}
await expect(subscriptionLink).toHaveAttribute("href", new RegExp(`${escapeRegExp(subscriptionPath)}(?:[?#].*)?$`, "u"));
const subscriptionResponsePromise = page
.waitForResponse((response) => new URL(response.url()).pathname === normalizePathname(subscriptionPath) && response.request().method() === "GET", {
timeout: 5_000,
})
.catch(() => null);
await subscriptionLink.click();
const subscriptionResponse = await subscriptionResponsePromise;
await skipIfUnavailable(page, subscriptionResponse, `Subscription settings path ${subscriptionPath}`);
await page.locator('[data-ui-id="ui.action.shell.sidebarTrigger"]').first().click();
await expect(mobileSidebar).not.toHaveAttribute("aria-hidden", "true");
const settingsLink = mobileSidebar.locator('[data-ui-id="ui.nav.app.settings"]').first();
await Promise.all([page.waitForURL(/\/settings\/profile(?:[?#].*)?$/u), settingsLink.click()]);
const settingsHubNavigation = page.getByRole("combobox", { name: /Tab navigation|Select\.\.\./i }).first();
await expect(settingsHubNavigation).toBeVisible();
await settingsHubNavigation.click();
const billingOption = page.getByRole("option", { name: /Billing|Abrechnung/i }).first();
await expect(billingOption).toBeVisible();
await Promise.all([page.waitForURL(new RegExp(`${escapeRegExp(subscriptionPath)}(?:[?#].*)?$`, "u")), billingOption.click()]);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(subscriptionPath)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.subscription.page"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.subscription.products"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.subscription.billing.portal"]').first()).toHaveAttribute("type", "button");
await expect(page.locator('[data-ui-id^="ui.billing.selfServiceSubscription."]').first()).toBeVisible();
expect(page.url()).not.toMatch(/mollie\.com/u);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -966,7 +985,10 @@ async function expectProvisionedDashboardContinuity(page: Page, createdDashboard
async function expectSeededTenantAccountContext(page: Page, context: string): Promise<void> {
await expect(page, `${context} should stay in an authenticated tenant account context`).not.toHaveURL(/\/(?:login|new-account)(?:[?#].*)?$/u);
await expect(page.locator('[data-ui-id="ui.account.create.form"]').first(), `${context} should not show account creation for the seeded tenant user`).toHaveCount(0);
await expect(
page.locator('[data-ui-id="ui.account.create.form"]').first(),
`${context} should not show account creation for the seeded tenant user`
).toHaveCount(0);
await expect(page.locator("body"), `${context} should not render a zero-account tenant state`).not.toContainText(zeroTenantAccountStatePattern);
}
@@ -1016,7 +1038,7 @@ async function expectProvisionedSubscriptionPage(page: Page, createdDashboardPat
await skipIfUnavailable(page, response, `Provisioned subscription settings path ${subscriptionPath}`);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(subscriptionPath)}(?:[?#].*)?$`, "u"));
await expect(page).not.toHaveURL(/\/login(?:[?#].*)?$/u);
await expect(page.locator('[data-ui-id="ui.subscription.page"]').first()).toBeVisible({ timeout: 10_000 });
await expect(page.locator('[data-ui-id^="ui.billing.selfServiceSubscription."]').first()).toBeVisible({ timeout: 10_000 });
await expectDashboardNavLink(page, createdDashboardPath);
await expect(page.locator('[data-ui-id="ui.subscription.billing.portal"]').first()).toBeVisible();
@@ -1040,32 +1062,6 @@ function tenantSlugFromSettingsPath(path: string): string {
return settingsIndex > 0 ? segments[settingsIndex - 1] : (segments.at(-1) ?? "app");
}
async function findVisibleLinkByPath(page: Page, actionSelector: string, expectedPath: string) {
// The action lives inside a Radix popover that mounts its content in a portal
// after the trigger click; wait for it to attach before the one-shot scan so we
// don't read zero links and false-trip the fixture guard.
await page.locator(actionSelector).first().waitFor({ state: "visible", timeout: 3000 }).catch(() => undefined);
const links = page.locator(`${actionSelector} >> xpath=ancestor::a[1]`);
const expectedPathname = normalizePathname(expectedPath);
const count = await links.count();
for (let index = 0; index < count; index += 1) {
const link = links.nth(index);
if (!(await link.isVisible())) continue;
const href = await link.getAttribute("href");
if (href && new URL(href, page.url()).pathname === expectedPathname) {
return link;
}
}
return null;
}
function normalizePathname(pathOrUrl: string): string {
return new URL(pathOrUrl, "http://e2e.local").pathname;
}
test.describe("registration compact mobile a11y", () => {
test.use({ viewport: compactMobileViewport, isMobile: true, hasTouch: true });
@@ -1100,7 +1096,7 @@ test.describe("registration compact mobile a11y", () => {
await passwordInput.fill("LongEnough1!");
await expectAllPasswordRequirementsMet(requirements);
await expect(page.locator('[data-ui-id="ui.auth.register.submit"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.auth.register.toPlanStep"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
@@ -0,0 +1,161 @@
// R-P11a interim-UI smoke (AD-28, DoD 19): the tenant-wide search lives only
// in the Spotlight palette. The readiness user is a real indexed entity, so
// the smoke covers the protected search resource and recent-search write too.
import { expect, type Page, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const membersPath = process.env.E2E_TENANT_MEMBERS_PATH ?? "/app/settings/team";
const searchApiPattern = /\/search\/api(?:\.data)?(?:\?.*)?$/u;
type SearchApiObservation = {
getRequests: URL[];
postRequests: Array<{ body: string; contentType: string }>;
};
test.describe("global Spotlight search (R-P11a)", () => {
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping authenticated Spotlight search smoke");
});
test("opens with Ctrl/Cmd+K and the desktop header trigger, then records and opens a result", async ({ page }) => {
const searchApi = observeSearchApi(page);
await openDashboard(page);
const palette = page.locator('[data-ui-id="ui.surface.commandPalette.portal"]');
const input = page.locator('[data-ui-id="ui.surface.commandPalette.search"]');
const desktopTrigger = page.locator('[data-ui-id="ui.action.shell.search"]');
await expect(desktopTrigger).toBeVisible();
for (const shortcut of ["Control+K", "Meta+K"] as const) {
await page.keyboard.press(shortcut);
await expect(palette).toBeVisible();
await expect(input).toBeFocused();
await page.keyboard.press("Escape");
await expect(palette).toBeHidden();
await expect(desktopTrigger).toBeFocused();
}
await desktopTrigger.click();
await expect(palette).toBeVisible();
await expect(input).toBeFocused();
await input.fill("Readiness");
await expect.poll(() => searchApi.getRequests.filter((url) => url.searchParams.get("q") === "Readiness").length).toBe(1);
const result = page.locator(
'[data-ui-id-pattern="ui.surface.commandPalette.result.{entityType}.{entityId}"][data-ui-id-param-entitytype="user"]'
);
await expect(result).toBeVisible();
await expect(result).toContainText("E2E Readiness");
await result.click();
await expect(page).toHaveURL(urlPattern(membersPath));
await expect(palette).toBeHidden();
await expect.poll(() => searchApi.postRequests.length).toBe(1);
expectPostedField(searchApi.postRequests[0]!, "intent", "recordRecent");
expectPostedField(searchApi.postRequests[0]!, "query", "Readiness");
expectPostedField(searchApi.postRequests[0]!, "selectedEntityType", "user");
expectPostedFieldMatches(searchApi.postRequests[0]!, "selectedEntityId", /\S+/u);
});
});
test.describe("global Spotlight search mobile (R-P11a)", () => {
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping authenticated mobile Spotlight search smoke");
});
test("opens from the mobile header as a viewport overlay and navigates to the selected result", async ({ page }) => {
const searchApi = observeSearchApi(page);
await openDashboard(page);
const desktopTrigger = page.locator('[data-ui-id="ui.action.shell.search"]');
const mobileTrigger = page.locator('[data-ui-id="ui.action.shell.searchMobile"]');
const palette = page.locator('[data-ui-id="ui.surface.commandPalette.portal"]');
const input = page.locator('[data-ui-id="ui.surface.commandPalette.search"]');
await expect(desktopTrigger).toBeHidden();
await expect(mobileTrigger).toBeVisible();
await mobileTrigger.click();
await expect(palette).toBeVisible();
await expect(input).toBeFocused();
const viewport = page.viewportSize();
const overlayBox = await palette.boundingBox();
expect(viewport).not.toBeNull();
expect(overlayBox).not.toBeNull();
expect(Math.abs(overlayBox!.x)).toBeLessThanOrEqual(1);
expect(Math.abs(overlayBox!.y)).toBeLessThanOrEqual(1);
expect(overlayBox!.width).toBeGreaterThanOrEqual(viewport!.width - 1);
expect(overlayBox!.height).toBeGreaterThanOrEqual(viewport!.height - 1);
await expectNoHorizontalOverflow(page);
await input.fill("Readiness");
await expect.poll(() => searchApi.getRequests.filter((url) => url.searchParams.get("q") === "Readiness").length).toBe(1);
const result = page.locator(
'[data-ui-id-pattern="ui.surface.commandPalette.result.{entityType}.{entityId}"][data-ui-id-param-entitytype="user"]'
);
await expect(result).toBeVisible();
await result.click();
await expect(page).toHaveURL(urlPattern(membersPath));
await expect.poll(() => searchApi.postRequests.length).toBe(1);
expectPostedField(searchApi.postRequests[0]!, "query", "Readiness");
expectPostedField(searchApi.postRequests[0]!, "selectedEntityType", "user");
expectPostedFieldMatches(searchApi.postRequests[0]!, "selectedEntityId", /\S+/u);
await expectNoHorizontalOverflow(page);
});
});
async function openDashboard(page: Page) {
await loginAsTenantUser(page, credentials!);
await page.goto(dashboardPath, { waitUntil: "domcontentloaded" });
await expect(page).toHaveURL(urlPattern(dashboardPath));
await expect(page.locator('[data-ui-id="ui.surface.shell.header"]')).toBeVisible();
}
function observeSearchApi(page: Page): SearchApiObservation {
const state: SearchApiObservation = { getRequests: [], postRequests: [] };
page.on("request", (request) => {
const url = new URL(request.url());
if (!searchApiPattern.test(url.pathname + url.search)) return;
if (request.method() === "POST") {
state.postRequests.push({
body: request.postData() ?? "",
contentType: request.headers()["content-type"] ?? "",
});
return;
}
state.getRequests.push(url);
});
return state;
}
function expectPostedField(request: SearchApiObservation["postRequests"][number], name: string, value: string) {
expectPostedFieldMatches(request, name, new RegExp(`^${escapeRegExp(value)}$`, "u"));
}
function expectPostedFieldMatches(request: SearchApiObservation["postRequests"][number], name: string, valuePattern: RegExp) {
if (request.contentType.includes("application/x-www-form-urlencoded")) {
expect(new URLSearchParams(request.body).get(name)).toMatch(valuePattern);
return;
}
const match = request.body.match(new RegExp(`name="${escapeRegExp(name)}"\\r?\\n\\r?\\n([^\\r\\n-]+)`, "u"));
expect(match?.[1]?.trim()).toMatch(valuePattern);
}
function urlPattern(path: string): RegExp {
return new RegExp(`${escapeRegExp(path)}(?:[?#].*)?$`, "u");
}
function escapeRegExp(value: string): string {
return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
}
@@ -2,18 +2,23 @@ import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
// D-D0a — Smoke: Login -> /select-tenant -> Profil-Karte sichtbar -> Karte klicken -> Tenant-Space.
// D-D0a — Smoke: Login -> /select-tenant -> single-tenant redirect or picker -> Tenant-Space.
const credentials = getTenantCredentials();
test.describe("select-tenant (Login Tenantauswahl)", () => {
test("renders the profile picker and enters a tenant on card click", async ({ page }) => {
test("enters a single tenant directly or selects one from the profile picker", async ({ page }) => {
if (!credentials) {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Skipping select-tenant smoke flow");
}
await loginAsTenantUser(page, credentials!);
await page.goto("/select-tenant", { waitUntil: "domcontentloaded" });
await page.goto(new URL("/select-tenant", page.url()).href, { waitUntil: "domcontentloaded" });
if (/\/dashboard(?:[?#].*)?$/u.test(page.url())) {
await expect(page).toHaveURL(/\/dashboard(?:[?#].*)?$/u);
return;
}
await expect(page.locator('[data-ui-id="ui.auth.selectTenant.page"]')).toBeVisible();
const firstCard = page.locator('[data-ui-id="ui.auth.selectTenant.card"]').first();
@@ -0,0 +1,177 @@
import { expect, test } from "./utils/test";
import { singleFetchActionData } from "./utils/navigation";
const SERVICE_WORKER_TIMEOUT_MS = 20_000;
test.describe("service-worker asset delivery", () => {
test("keeps CSS and JavaScript available after taking control", async ({ page, request }) => {
await page.goto("/login", { waitUntil: "domcontentloaded" });
await expect(page.locator("html")).toHaveAttribute("data-hydrated", "true", {
timeout: SERVICE_WORKER_TIMEOUT_MS,
});
await skipOnDevServer(page);
await expect
.poll(
() =>
page.evaluate(async () => {
const registration = await navigator.serviceWorker.getRegistration();
return {
active: Boolean(registration?.active),
controlled: Boolean(navigator.serviceWorker.controller),
};
}),
{ timeout: SERVICE_WORKER_TIMEOUT_MS }
)
.toEqual({ active: true, controlled: true });
const origin = new URL(page.url()).origin;
const failedAssets: string[] = [];
page.on("requestfailed", (failedRequest) => {
const url = new URL(failedRequest.url());
if (url.origin === origin && url.pathname.startsWith("/assets/")) {
failedAssets.push(`${url.pathname}: ${failedRequest.failure()?.errorText ?? "unknown failure"}`);
}
});
await page.reload({ waitUntil: "domcontentloaded" });
await expect(page.locator("html")).toHaveAttribute("data-hydrated", "true", {
timeout: SERVICE_WORKER_TIMEOUT_MS,
});
await skipOnDevServer(page);
await expect
.poll(() => page.evaluate(() => Boolean(navigator.serviceWorker.controller)), {
timeout: SERVICE_WORKER_TIMEOUT_MS,
})
.toBe(true);
const stylesheets = await page.locator('link[rel="stylesheet"][href*="/assets/"]').evaluateAll((links) =>
links.map((link) => ({
href: (link as HTMLLinkElement).href,
loaded: (link as HTMLLinkElement).sheet !== null,
}))
);
expect(stylesheets.length).toBeGreaterThan(0);
expect(stylesheets.every((stylesheet) => stylesheet.loaded)).toBe(true);
const assetProbe = await page.evaluate(async (assetUrl) => {
const probeUrl = new URL(assetUrl);
probeUrl.searchParams.set("sw-e2e-probe", "1");
try {
const response = await fetch(probeUrl, { cache: "no-store" });
const body = await response.arrayBuffer();
return {
bodyBytes: body.byteLength,
contentType: response.headers.get("content-type"),
error: null,
ok: response.ok,
status: response.status,
};
} catch (error) {
return {
bodyBytes: 0,
contentType: null,
error: error instanceof Error ? error.message : String(error),
ok: false,
status: 0,
};
}
}, stylesheets[0].href);
expect(assetProbe).toMatchObject({ error: null, ok: true, status: 200 });
expect(assetProbe.bodyBytes).toBeGreaterThan(0);
expect(assetProbe.contentType).toContain("text/css");
expect(failedAssets).toEqual([]);
const serviceWorkerResponse = await request.get(new URL("/sw.js", page.url()).href);
expect(serviceWorkerResponse.ok()).toBe(true);
const serviceWorkerPolicy = serviceWorkerResponse.headers()["content-security-policy"] ?? "";
expect(serviceWorkerPolicy).toContain("default-src 'none'");
expect(serviceWorkerPolicy).toContain("connect-src 'self'");
expect(serviceWorkerPolicy).not.toContain("connect-src 'none'");
});
test("keeps the login form actionable after taking control", async ({ page }) => {
await page.goto("/login", { waitUntil: "domcontentloaded" });
await expect(page.locator("html")).toHaveAttribute("data-hydrated", "true", {
timeout: SERVICE_WORKER_TIMEOUT_MS,
});
await skipOnDevServer(page);
await expect
.poll(() => page.evaluate(() => Boolean(navigator.serviceWorker.controller)), {
timeout: SERVICE_WORKER_TIMEOUT_MS,
})
.toBe(true);
await page.reload({ waitUntil: "domcontentloaded" });
await expect(page.locator("html")).toHaveAttribute("data-hydrated", "true", {
timeout: SERVICE_WORKER_TIMEOUT_MS,
});
await expect
.poll(() => page.evaluate(() => Boolean(navigator.serviceWorker.controller)), {
timeout: SERVICE_WORKER_TIMEOUT_MS,
})
.toBe(true);
const form = page.locator('[data-ui-id="ui.auth.login.form"]');
const emailInput = form.locator('input[name="email"]');
const passwordInput = form.locator('input[name="password"]');
const submitButton = form.locator('[data-ui-id="ui.auth.login.submit"]');
await expect(form).toBeVisible();
await expect(emailInput).toBeEditable();
await expect(passwordInput).toBeEditable();
await expect(passwordInput).toHaveValue("");
await expect(submitButton).toBeEnabled();
const passwordPlaceholder = (await passwordInput.getAttribute("placeholder")) ?? "";
expect(passwordPlaceholder).not.toMatch(/^[*\u2022\u25cf\u00b7]+$/u);
let resolveSubmitted!: (formData: URLSearchParams) => void;
const submitted = new Promise<URLSearchParams>((resolve) => {
resolveSubmitted = resolve;
});
const currentUrl = new URL(page.url());
await page.route("**/*", async (route) => {
const request = route.request();
const requestUrl = new URL(request.url());
const matchesLoginAction =
requestUrl.origin === currentUrl.origin &&
(requestUrl.pathname === currentUrl.pathname || requestUrl.pathname === `${currentUrl.pathname}.data`);
if (request.method() !== "POST" || !matchesLoginAction) {
await route.fallback();
return;
}
resolveSubmitted(new URLSearchParams(request.postData() ?? ""));
await route.fulfill(
await singleFetchActionData(
{
fieldErrors: { email: undefined, password: "E2E login password error" },
fields: { email: "login-contract@example.test" },
},
400
)
);
});
await emailInput.fill("login-contract@example.test");
await passwordInput.fill("LoginContract1!");
await submitButton.click();
const formData = await submitted;
expect(formData.get("action")).toBe("login");
expect(formData.get("csrf") ?? "").not.toBe("");
expect(formData.get("email")).toBe("login-contract@example.test");
expect(formData.get("password")).toBe("LoginContract1!");
await expect(page.getByText("E2E login password error")).toBeVisible();
await expect(passwordInput).toHaveValue("");
await expect(passwordInput).toBeFocused();
});
});
async function skipOnDevServer(page: import("@playwright/test").Page): Promise<void> {
const viteClient = await page.request.get(new URL("/@vite/client", page.url()).href);
const isViteDevServer = viteClient.ok() && (viteClient.headers()["content-type"] ?? "").includes("text/javascript");
test.skip(isViteDevServer, "Service-worker delivery is a production-build gate; registration is intentionally disabled on the Vite dev server");
}
@@ -0,0 +1,38 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const settingsBase = dashboardPath?.replace(/\/dashboard\/?$/u, "/settings");
const hubs = [
["account", "profile"],
["team", "team"],
["workspace", "workspace"],
["billing", "billing"],
["integrations", "integrations"],
["compliance", "compliance"],
["customerPortal", "customer-portal"],
] as const;
test.describe("AK-SET-01 settings hub smoke", () => {
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"],
"Settings hub E2E inputs not configured"
);
});
for (const [hubId, path] of hubs) {
test(`opens the ${hubId} hub with its persistent tabs`, async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(`${settingsBase}/${path}`, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Settings hub ${hubId}`);
await expect(page.locator(`[data-ui-id="ui.settings.hub.${hubId}"]`)).toBeVisible();
await expect(page.locator(`[data-ui-id^="ui.settings.hub.${hubId}.tab."]`).first()).toBeVisible();
});
}
});
@@ -0,0 +1,31 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Signatur smoke (AK-P16d / DoD D.19): Login -> Projekt-Detail oeffnen ->
* Signatur-Panel sichtbar.
*
* Das Panel (`data-ui-id="ui.projects.operations.signature"`) haengt am
* Projekt-Kern und rendert im Projekt-Detail oberhalb der Unterbereichs-Tabs.
* Braucht ein erreichbares Projekt im Ziel-Environment; der Pfad kommt aus
* `E2E_TENANT_PROJECT_PATH` (z.B. /demo-pro-crm/projects/<id>). Der
* Projektpfad skippt bewusst weich (kein REQUIRE_E2E_READINESS-fail-closed):
* die Readiness-Lane seedet (noch) kein Projekt-Fixture.
*/
const credentials = getTenantCredentials();
const projectPath = process.env.E2E_TENANT_PROJECT_PATH;
test.describe("signature smoke", () => {
test("renders the project signature panel", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Signature smoke inputs not configured");
test.skip(!projectPath?.trim(), "E2E_TENANT_PROJECT_PATH not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(projectPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Project path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.projects.operations.signature"]')).toBeVisible();
});
});
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,58 @@
// AK-P15a interim-UI smoke (AD-28): login -> open the tenant call list ->
// trigger a safe loader revalidation -> keep the current call result visible.
// The probe does not require live Aircall credentials and never mutates data.
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const callsPath = dashboardPath?.replace(/\/dashboard\/?$/u, "/calls");
test.describe("AK-P15a Aircall telephony interim smoke", () => {
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"], "Aircall telephony smoke inputs not configured");
if (!callsPath || callsPath === dashboardPath) {
skipOrFailWhenE2eFixtureMissing("Tenant call-list path could not be derived from E2E_TENANT_DASHBOARD_PATH");
}
});
test("opens the call list and refreshes the visible result without mutating data", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(callsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Telephony call-list path ${callsPath}`);
expect(response?.ok(), `Telephony call list returned ${response?.status() ?? "no response"}`).toBe(true);
const screen = page.locator('[data-ui-id="ui.telephony.calls.page"]').first();
await expect(screen).toBeVisible();
const refresh = page.getByRole("button", { name: /^(Aktualisieren|Refresh)$/iu }).first();
await expect(refresh).toBeVisible();
await expect(refresh).toBeEnabled();
const routePath = new URL(callsPath!, page.url()).pathname;
const refreshResponse = page.waitForResponse((candidate) => {
const url = new URL(candidate.url());
return (
candidate.request().method() === "GET" &&
(url.pathname === routePath || url.pathname === `${routePath}.data`) &&
candidate.request().resourceType() === "fetch"
);
});
await refresh.click();
expect((await refreshResponse).ok(), "Call-list refresh returned a successful loader response").toBe(true);
await expect(screen).toBeVisible();
await expect(refresh).toBeEnabled();
await expect(
page
.locator('[data-ui-id="ui.telephony.calls.table"]')
.or(page.getByText(/^(Noch keine Anrufe synchronisiert|No calls synchronized yet)$/iu))
.first()
).toBeVisible();
});
});
@@ -7,18 +7,17 @@ import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from
const credentials = getTenantCredentials();
const apiPath = process.env.E2E_TENANT_API_PATH;
const apiDocsPath = process.env.E2E_TENANT_API_DOCS_PATH;
const apiKeysPath = process.env.E2E_TENANT_API_KEYS_PATH;
const apiLogsPath = process.env.E2E_TENANT_API_LOGS_PATH;
const readinessEndpoint = "/v1/e2e-readiness";
test.describe("tenant API docs and logs mobile a11y", () => {
test.describe("tenant API logs mobile a11y", () => {
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_API_PATH", "E2E_TENANT_API_KEYS_PATH", "E2E_TENANT_API_DOCS_PATH", "E2E_TENANT_API_LOGS_PATH"],
"Tenant API docs/logs E2E inputs not configured"
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_API_PATH", "E2E_TENANT_API_KEYS_PATH", "E2E_TENANT_API_LOGS_PATH"],
"Tenant API logs E2E inputs not configured"
);
});
@@ -66,42 +65,19 @@ test.describe("tenant API docs and logs mobile a11y", () => {
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("renders API docs editor and keeps API tabs reachable", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(apiDocsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant API docs path ${apiDocsPath}`);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(apiDocsPath!)}(?:[?#].*)?$`, "u"));
await expectApiTabs(page);
await expect(page.getByRole("link", { name: /openapi/i }).first()).toBeVisible();
const editor = page.locator(".monaco-editor, textarea").first();
// The docs editor is Monaco, lazy-loaded client-only (React.lazy + Suspense),
// so the server render emits only an empty fallback div. Wait for it to attach
// after hydration before the one-shot count() guard.
await editor.waitFor({ state: "attached", timeout: 15_000 }).catch(() => undefined);
if ((await editor.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("Tenant API docs editor is not visible for this fixture");
}
await expect(editor).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
});
test.describe("tenant API docs and logs compact mobile a11y", () => {
test.describe("tenant API logs compact mobile a11y", () => {
test.use({ viewport: compactMobileViewport, isMobile: true, hasTouch: true });
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_API_PATH", "E2E_TENANT_API_KEYS_PATH", "E2E_TENANT_API_DOCS_PATH", "E2E_TENANT_API_LOGS_PATH"],
"Tenant API docs/logs E2E inputs not configured"
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_API_PATH", "E2E_TENANT_API_KEYS_PATH", "E2E_TENANT_API_LOGS_PATH"],
"Tenant API logs E2E inputs not configured"
);
});
test("keeps logs and docs usable at 320px", async ({ page }) => {
test("keeps logs usable at 320px", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const logsResponse = await page.goto(`${apiLogsPath!}?method=GET&endpoint=%2Fv1%2Fe2e-readiness`, { waitUntil: "domcontentloaded" });
@@ -114,22 +90,6 @@ test.describe("tenant API docs and logs compact mobile a11y", () => {
await expect(page.locator('form button:has-text("Delete"), form button:has-text("Löschen")')).toHaveCount(0);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
const docsResponse = await page.goto(apiDocsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, docsResponse, `Tenant API docs path ${apiDocsPath}`);
await expectApiTabs(page);
await expect(page.getByRole("link", { name: /openapi/i }).first()).toBeVisible();
const editor = page.locator(".monaco-editor, textarea").first();
// The docs editor is Monaco, lazy-loaded client-only (React.lazy + Suspense),
// so the server render emits only an empty fallback div. Wait for it to attach
// after hydration before the one-shot count() guard.
await editor.waitFor({ state: "attached", timeout: 15_000 }).catch(() => undefined);
if ((await editor.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("Tenant API docs editor is not visible for this fixture");
}
await expect(editor).toBeVisible({ timeout: 10_000 });
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
});
@@ -141,5 +101,4 @@ async function expectApiTabs(page: import("@playwright/test").Page) {
await expect(page.locator(`a[href="${apiPath!}"]`).first()).toBeAttached();
await expect(page.locator(`a[href="${apiLogsPath!}"]`).first()).toBeAttached();
await expect(page.locator(`a[href="${apiKeysPath!}"]`).first()).toBeAttached();
await expect(page.locator(`a[href="${apiDocsPath!}"]`).first()).toBeAttached();
}
@@ -27,7 +27,7 @@ test.describe("tenant API keys mobile a11y", () => {
skipOrFailWhenE2eFixtureMissing("Tenant API key create link is not visible for this fixture");
}
await newLink.click();
await expect(page).toHaveURL(/\/settings\/api\/keys\/new(?:[?#].*)?$/u);
await expect(page).toHaveURL(/\/settings\/integrations\/api\/keys\/new(?:[?#].*)?$/u);
const form = page.locator('form:has(input[name="action"][value="create"])').first();
await expect(form).toBeVisible();
@@ -35,13 +35,11 @@ test.describe("tenant API keys mobile a11y", () => {
await expect(form.locator('input[name="expires"]').first()).toBeVisible();
await expect(form.locator('input[name="active"]').first()).toBeAttached();
await expect(form.locator('input[name="csrf"]').first()).not.toHaveValue("");
await expect.poll(async () => form.locator('input[name="entities[]"]').count()).toBeGreaterThan(0);
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
test("submits create contract with alias, entity permissions, and csrf without mutating data", async ({ page }) => {
test("submits create contract with alias, active state, and csrf without mutating data", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const response = await page.goto(apiKeysPath!, { waitUntil: "domcontentloaded" });
@@ -56,9 +54,6 @@ test.describe("tenant API keys mobile a11y", () => {
const form = page.locator('form:has(input[name="action"][value="create"])').first();
await expect(form).toBeVisible();
await form.locator('input[name="alias"]').fill(`e2e-contract-${Date.now()}`);
if ((await form.locator('input[name$="-read"]').count()) > 0) {
await form.locator('input[name$="-read"]').first().click({ force: true });
}
const submitted = await interceptCurrentRoutePost(page, {
status: 200,
@@ -71,6 +66,6 @@ test.describe("tenant API keys mobile a11y", () => {
expect(postDataIncludesField(submitted.value, "action", /^create$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "alias", /^e2e-contract-/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "entities[]", /"entityId"/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "active", /^(on|true)$/u)).toBe(true);
});
});
@@ -13,10 +13,7 @@ test.describe("tenant audit export mobile a11y", () => {
test.use({ isMobile: true, hasTouch: true });
test.beforeEach(() => {
skipOrFailWhenE2eInputsMissing(
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"],
"Tenant audit export E2E inputs not configured"
);
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"], "Tenant audit export E2E inputs not configured");
if (!auditExportPath) {
skipOrFailWhenE2eFixtureMissing("Tenant audit export path could not be derived; set E2E_TENANT_AUDIT_EXPORT_PATH");
}
@@ -31,22 +28,29 @@ test.describe("tenant audit export mobile a11y", () => {
await skipIfUnavailable(page, response, `Tenant audit export path ${auditExportPath}`);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(auditExportPath!)}(?:[?#].*)?$`, "u"));
const form = page.locator('[data-ui-id="ui.settings.auditExport.form"]').first();
await expect(page.locator('[data-ui-id="ui.settings.auditExport.page"]').first()).toBeVisible();
await expect(form).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.auditExport.from"]')).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.auditExport.to"]')).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.auditExport.regulatoryScope"]')).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.auditExport.actorType"]')).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.auditExport.outcome"]')).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.auditExport.downloadCsv"]')).toBeVisible();
await expect(form.locator('[data-ui-id="ui.settings.auditExport.downloadPdf"]')).toBeVisible();
const auditExport = page.locator('[data-ui-id="ui.audit.export"]').first();
const form = auditExport.locator('[data-ui-id="ui.audit.export.form"]').first();
const from = form.locator('input[name="from"]');
const to = form.locator('input[name="to"]');
const regulatoryScope = form.locator('select[name="regulatoryScope"]');
const actorType = form.locator('select[name="actorType"]');
const outcome = form.locator('select[name="outcome"]');
await form.locator('[data-ui-id="ui.settings.auditExport.from"]').fill("2026-01-01");
await form.locator('[data-ui-id="ui.settings.auditExport.to"]').fill("2026-01-31");
await form.locator('[data-ui-id="ui.settings.auditExport.regulatoryScope"]').selectOption("soc2");
await form.locator('[data-ui-id="ui.settings.auditExport.actorType"]').selectOption("user");
await form.locator('[data-ui-id="ui.settings.auditExport.outcome"]').selectOption("success");
await expect(auditExport).toBeVisible();
await expect(form).toBeVisible();
await expect(from).toBeVisible();
await expect(to).toBeVisible();
await expect(regulatoryScope).toBeAttached();
await expect(actorType).toBeAttached();
await expect(outcome).toBeAttached();
await expect(form.locator('[data-ui-id="ui.audit.export.csv"]')).toBeVisible();
await expect(form.locator('[data-ui-id="ui.audit.export.pdf"]')).toBeVisible();
await from.fill("2026-01-01");
await to.fill("2026-01-31");
await regulatoryScope.selectOption("soc2", { force: true });
await actorType.selectOption("user", { force: true });
await outcome.selectOption("success", { force: true });
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -25,15 +25,16 @@ test.describe("tenant governance settings desktop a11y", () => {
const response = await page.goto(policiesPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant policies path ${policiesPath}`);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(policiesPath!)}(?:[?#].*)?$`, "u"));
await expect(page.getByRole("heading", { name: /account policies|kontorichtlinien/iu })).toBeVisible();
await expect(page.getByRole("heading", { name: /^(Workspace|Arbeitsbereich)$/iu })).toBeVisible();
await expect(page.getByRole("heading", { name: /membership policy|mitgliedschaftsrichtlinie/iu })).toBeVisible();
for (const path of [
"settings/members",
"settings/roles-and-permissions",
"settings/subscription",
"settings/notifications",
"settings/logs",
"settings/api",
"settings/team",
"settings/team/roles",
"settings/billing",
"settings/profile/notifications",
"settings/compliance",
"settings/integrations/api",
]) {
await expect(page.locator(`a[href$="${path}"]`).first()).toBeVisible();
}
@@ -10,12 +10,12 @@ const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const policiesPath = process.env.E2E_TENANT_POLICIES_PATH ?? (dashboardPath ? tenantSettingsPoliciesPath(dashboardPath) : undefined);
const policyLinks = [
"settings/members",
"settings/roles-and-permissions",
"settings/subscription",
"settings/notifications",
"settings/logs",
"settings/api",
"settings/team",
"settings/team/roles",
"settings/billing",
"settings/profile/notifications",
"settings/compliance",
"settings/integrations/api",
] as const;
const policySections = ["membership", "roles", "billing", "notifications", "audit", "api"] as const;
@@ -43,7 +43,7 @@ test.describe("tenant governance settings mobile a11y", () => {
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(policiesPath!)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.settings.policies.page"]').first()).toBeVisible();
await expect(page.getByRole("heading", { name: /account policies|kontorichtlinien/iu })).toBeVisible();
await expect(page.getByRole("heading", { level: 1, name: /workspace|arbeitsbereich/iu })).toBeVisible();
const policiesPage = page.locator('[data-ui-id="ui.settings.policies.page"]').first();
for (const section of policySections) {
@@ -48,26 +48,20 @@ test.describe("tenant notification settings mobile a11y", () => {
const response = await page.goto(notificationsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant notification settings path ${notificationsPath}`);
const form = page.locator('[data-ui-id="ui.settings.notifications.preference.team.email"]').first();
await expect(form).toBeVisible();
const checkbox = form.locator('input[name="enabled"]').first();
await checkbox.setChecked(true);
const csrf = form.locator('input[name="csrf"]').first();
if ((await csrf.count()) > 0) {
await expect(csrf).not.toHaveValue("");
}
const preference = page.locator('[data-ui-id="ui.settings.notifications.preference.team.email"]').first();
await expect(preference).toBeVisible();
const toggle = preference.getByRole("switch");
await expect(toggle).toBeVisible();
const initialState = (await toggle.getAttribute("aria-checked")) === "true";
const submitted = await interceptCurrentRoutePost(page, { status: 204 });
await form.locator('button[type="submit"]').first().click();
await toggle.click();
await expect.poll(() => submitted.value).not.toBeNull();
expect(postDataIncludesField(submitted.value, "action", /^update-preference$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "category", /^team$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "channel", /^EMAIL$/u)).toBe(true);
expect(postDataIncludesField(submitted.value, "enabled", /^(on|true)$/u)).toBe(true);
if ((await csrf.count()) > 0) {
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
}
expect(postDataIncludesField(submitted.value, "enabled", new RegExp(`^${String(!initialState)}$`, "u"))).toBe(true);
expect(postDataIncludesField(submitted.value, "csrf", /.+/u)).toBe(true);
});
});
@@ -1,6 +1,12 @@
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser, tenantRolesAndPermissionsPath } from "./utils/auth";
import {
getTenantCredentials,
loginAsTenantUser,
tenantLegacyRolesAndPermissionsPath,
tenantRolesAndPermissionsPath,
tenantSettingsMembersPath,
} from "./utils/auth";
import { expectNoHorizontalOverflow } from "./utils/mobile";
import { escapeRegExp, skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
@@ -11,8 +17,9 @@ import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const rolesAndPermissionsPath =
process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? (dashboardPath ? tenantRolesAndPermissionsPath(dashboardPath) : undefined);
const rolesAndPermissionsPath = process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? (dashboardPath ? tenantRolesAndPermissionsPath(dashboardPath) : undefined);
const legacyRolesAndPermissionsPath = dashboardPath ? tenantLegacyRolesAndPermissionsPath(dashboardPath) : undefined;
const membersPath = process.env.E2E_TENANT_MEMBERS_PATH ?? (dashboardPath ? tenantSettingsMembersPath(dashboardPath) : undefined);
test.describe("tenant roles and permissions desktop a11y", () => {
test.use({ viewport: { width: 1440, height: 900 } });
@@ -22,7 +29,7 @@ test.describe("tenant roles and permissions desktop a11y", () => {
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"],
"Tenant roles and permissions E2E inputs not configured"
);
if (!rolesAndPermissionsPath) {
if (!rolesAndPermissionsPath || !legacyRolesAndPermissionsPath || !membersPath) {
skipOrFailWhenE2eFixtureMissing("Tenant roles and permissions path could not be derived; set E2E_TENANT_ROLES_AND_PERMISSIONS_PATH");
}
});
@@ -33,15 +40,13 @@ test.describe("tenant roles and permissions desktop a11y", () => {
const response = await page.goto(rolesAndPermissionsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant roles and permissions path ${rolesAndPermissionsPath}`);
const rolesPath = `${rolesAndPermissionsPath}/roles`;
// Index redirects into the merged S02 roles tab.
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(rolesPath)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.page"]').first()).toBeVisible();
// The helper resolves directly to the canonical Team-Hub roles tab.
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(rolesAndPermissionsPath!)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.settings.hub.team"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.roles"] table').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.roles.filter"]').first()).toBeVisible();
// S01/S02 tab bar: link back to the members tab.
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.tab.members"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.hub.team.tab.members"]').first()).toBeVisible();
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
@@ -50,12 +55,12 @@ test.describe("tenant roles and permissions desktop a11y", () => {
test("redirects the legacy users and permissions sub-tabs", async ({ page }) => {
await loginAsTenantUser(page, credentials!);
const usersResponse = await page.goto(`${rolesAndPermissionsPath!}/users`, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, usersResponse, `Tenant roles users path ${rolesAndPermissionsPath}/users`);
const usersResponse = await page.goto(`${legacyRolesAndPermissionsPath!}/users`, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, usersResponse, `Tenant roles users path ${legacyRolesAndPermissionsPath}/users`);
// Matrix is superseded by the inline role dropdown in the members list (D01).
await expect(page).toHaveURL(/\/settings\/members(?:[?#].*)?$/u);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(membersPath!)}(?:[?#].*)?$`, "u"));
await page.goto(`${rolesAndPermissionsPath!}/permissions`, { waitUntil: "domcontentloaded" });
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(`${rolesAndPermissionsPath}/roles`)}(?:[?#].*)?$`, "u"));
await page.goto(`${legacyRolesAndPermissionsPath!}/permissions`, { waitUntil: "domcontentloaded" });
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(rolesAndPermissionsPath!)}(?:[?#].*)?$`, "u"));
});
});
@@ -1,18 +1,24 @@
import { expect, test } from "./utils/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser, tenantRolesAndPermissionsPath, tenantSettingsMembersPath } from "./utils/auth";
import {
getTenantCredentials,
loginAsTenantUser,
tenantLegacyRolesAndPermissionsPath,
tenantRolesAndPermissionsPath,
tenantSettingsMembersPath,
} from "./utils/auth";
import { compactMobileViewport, expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
import { escapeRegExp, interceptCurrentRoutePost, postDataIncludesField, skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
// R-P2b (D-P2 Admin RBAC): one merged "Rollen und Berechtigungen" tab (S02);
// role assignment happens inline in the members list (D01 dropdown) instead of
// the old users matrix (route redirects to settings/members).
// the old users matrix (route redirects to settings/team).
const credentials = getTenantCredentials();
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const rolesAndPermissionsPath =
process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? (dashboardPath ? tenantRolesAndPermissionsPath(dashboardPath) : undefined);
const rolesAndPermissionsPath = process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? (dashboardPath ? tenantRolesAndPermissionsPath(dashboardPath) : undefined);
const legacyRolesAndPermissionsPath = dashboardPath ? tenantLegacyRolesAndPermissionsPath(dashboardPath) : undefined;
const membersPath = process.env.E2E_TENANT_MEMBERS_PATH ?? (dashboardPath ? tenantSettingsMembersPath(dashboardPath) : undefined);
test.describe("tenant roles and permissions mobile a11y", () => {
@@ -23,7 +29,7 @@ test.describe("tenant roles and permissions mobile a11y", () => {
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"],
"Tenant roles and permissions mobile E2E inputs not configured"
);
if (!rolesAndPermissionsPath) {
if (!rolesAndPermissionsPath || !legacyRolesAndPermissionsPath) {
skipOrFailWhenE2eFixtureMissing("Tenant roles and permissions path could not be derived; set E2E_TENANT_ROLES_AND_PERMISSIONS_PATH");
}
});
@@ -36,11 +42,9 @@ test.describe("tenant roles and permissions mobile a11y", () => {
const response = await page.goto(rolesAndPermissionsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant roles and permissions path ${rolesAndPermissionsPath}`);
const rolesPath = `${rolesAndPermissionsPath}/roles`;
// Index redirects into the merged S02 roles tab.
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(rolesPath)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.page"]').first()).toBeVisible();
// The helper resolves directly to the canonical Team-Hub roles tab.
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(rolesAndPermissionsPath!)}(?:[?#].*)?$`, "u"));
await expect(page.locator('[data-ui-id="ui.settings.hub.team"]').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.roles"] table').first()).toBeVisible();
await expect(page.locator('[data-ui-id="ui.settings.rolesAndPermissions.roles.filter"]').first()).toBeVisible();
@@ -54,8 +58,8 @@ test.describe("tenant roles and permissions mobile a11y", () => {
await expectNoCriticalA11yViolations(page);
// Legacy permissions sub-tab redirects into the merged roles tab.
await page.goto(`${rolesAndPermissionsPath}/permissions`, { waitUntil: "domcontentloaded" });
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(rolesPath)}(?:[?#].*)?$`, "u"));
await page.goto(`${legacyRolesAndPermissionsPath}/permissions`, { waitUntil: "domcontentloaded" });
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(rolesAndPermissionsPath!)}(?:[?#].*)?$`, "u"));
await expectNoHorizontalOverflow(page);
await expectNoCriticalA11yViolations(page);
});
@@ -69,8 +73,8 @@ test.describe("tenant roles and permissions mobile a11y", () => {
skipOrFailWhenE2eFixtureMissing("Tenant members path could not be derived; set E2E_TENANT_MEMBERS_PATH");
}
// The old users matrix redirects to the members list; D01 lives there now.
const response = await page.goto(`${rolesAndPermissionsPath}/users`, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant roles users path ${rolesAndPermissionsPath}/users`);
const response = await page.goto(`${legacyRolesAndPermissionsPath}/users`, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `Tenant roles users path ${legacyRolesAndPermissionsPath}/users`);
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(membersPath!)}(?:[?#].*)?$`, "u"));
const roleDropdown = page.locator('[data-ui-id="ui.settings.members.roleDropdown"]').first();
@@ -1,5 +1,7 @@
import { expect, type Locator, type Page } from "@playwright/test";
import { waitForHydration } from "./navigation";
export type TenantCredentials = {
email: string;
password: string;
@@ -29,8 +31,9 @@ const LOGIN_OFF_URL_TIMEOUT_MS = 15_000;
// back off for the rate-limit case and surface other errors immediately.
const RATE_LIMIT_TEXT_PATTERN = /too many|zu viele/iu;
async function attemptLogin(page: Page, credentials: TenantCredentials): Promise<boolean> {
await page.goto("/login", { waitUntil: "domcontentloaded" });
async function attemptLogin(page: Page, credentials: TenantCredentials, loginPageUrl: string): Promise<boolean> {
await page.goto(loginPageUrl, { waitUntil: "domcontentloaded" });
await waitForHydration(page);
await page.locator('[data-ui-id="ui.auth.login.email"], input[type="email"], input[name="email"], input#email').first().fill(credentials.email);
await page
@@ -50,10 +53,9 @@ async function attemptLogin(page: Page, credentials: TenantCredentials): Promise
// Cache the authenticated cookies after the first real login and reuse them for
// every later spec in the same (workers:1) run. Re-logging-in per test
// saturates the server auth rate limit (10/60s per IP+email), which surfaces as
// flaky "stayed on /login" failures across the large serial suite. /login
// redirects an authenticated session away, so the cache can be validated
// cheaply and a stale entry (e.g. after a sign-out test) falls back to a real
// login.
// flaky "stayed on /login" failures across the large serial suite. The cache is
// validated against an authenticated surface; a stale entry (e.g. after a
// sign-out test) falls back to a real login.
//
// The cache is keyed by EMAIL: the suite logs in as multiple users (the tenant
// admin AND a read-only fixture). A single global cache would hand a later
@@ -61,27 +63,70 @@ async function attemptLogin(page: Page, credentials: TenantCredentials): Promise
// (so /login redirects away and the cache "matches"), silently running the
// read-only test as the admin — which then sees mutation controls and fails.
type StoredCookies = Awaited<ReturnType<ReturnType<Page["context"]>["cookies"]>>;
const cachedCookiesByEmail = new Map<string, StoredCookies>();
const cachedCookiesByIdentity = new Map<string, StoredCookies>();
async function reuseCachedLogin(page: Page, credentials: TenantCredentials): Promise<boolean> {
const cached = cachedCookiesByEmail.get(credentials.email);
async function reuseCachedLogin(page: Page, credentials: TenantCredentials, loginPageUrl: string, sessionProbeUrl: string): Promise<boolean> {
const cacheKey = loginCacheKey(credentials, loginPageUrl);
const cached = cachedCookiesByIdentity.get(cacheKey);
if (!cached || cached.length === 0) return false;
await page.context().addCookies(cached);
await page.goto("/login", { waitUntil: "domcontentloaded" });
await page.goto(sessionProbeUrl, { waitUntil: "domcontentloaded" });
if (!LOGIN_URL_PATTERN.test(page.url())) return true;
cachedCookiesByEmail.delete(credentials.email);
cachedCookiesByIdentity.delete(cacheKey);
return false;
}
async function reuseContextLogin(page: Page, sessionProbeUrl: string): Promise<boolean> {
const probeUrl = new URL(sessionProbeUrl, process.env.E2E_BASE_URL ?? "http://localhost:3000");
const cookies = await page.context().cookies(probeUrl.origin);
if (cookies.length === 0) return false;
await page.goto(sessionProbeUrl, { waitUntil: "domcontentloaded" });
return !LOGIN_URL_PATTERN.test(page.url());
}
export async function loginAsTenantUser(page: Page, credentials: TenantCredentials): Promise<void> {
if (await reuseCachedLogin(page, credentials)) {
await loginAt(page, credentials, "/login");
}
export async function loginAsAdminUser(page: Page, credentials: TenantCredentials): Promise<void> {
await loginAt(page, credentials, resolveAdminLoginUrl(), resolveAdminDashboardUrl());
}
export function resolveAdminLoginUrl(env: NodeJS.ProcessEnv = process.env): string {
return resolveAdminSurfaceUrl("/login", env);
}
export function resolveAdminDashboardUrl(env: NodeJS.ProcessEnv = process.env): string {
return resolveAdminSurfaceUrl("/dashboard", env);
}
function resolveAdminSurfaceUrl(pathname: string, env: NodeJS.ProcessEnv): string {
const explicitAdminUrl = env.E2E_ADMIN_BASE_URL?.trim();
const baseUrl = explicitAdminUrl || env.E2E_BASE_URL?.trim() || "http://localhost:3000";
const url = new URL(baseUrl);
if (!explicitAdminUrl) {
url.hostname = url.hostname === "localhost" ? "admin.localhost" : url.hostname.replace(/^app\./u, "admin.");
}
url.pathname = pathname;
url.search = "";
url.hash = "";
return url.toString();
}
async function loginAt(page: Page, credentials: TenantCredentials, loginPageUrl: string, sessionProbeUrl: string = loginPageUrl): Promise<void> {
if (await reuseContextLogin(page, sessionProbeUrl)) {
return;
}
const cacheKey = loginCacheKey(credentials, loginPageUrl);
if (await reuseCachedLogin(page, credentials, loginPageUrl, sessionProbeUrl)) {
return;
}
let rateLimited = false;
for (let attempt = 0; attempt < LOGIN_MAX_ATTEMPTS; attempt += 1) {
if (await attemptLogin(page, credentials)) {
cachedCookiesByEmail.set(credentials.email, await page.context().cookies());
if (await attemptLogin(page, credentials, loginPageUrl)) {
cachedCookiesByIdentity.set(cacheKey, await page.context().cookies());
return;
}
@@ -107,6 +152,10 @@ export async function loginAsTenantUser(page: Page, credentials: TenantCredentia
await expect(page, `Expected to leave /login after submitting tenant credentials but stayed on ${page.url()}.${hint}`).not.toHaveURL(LOGIN_URL_PATTERN);
}
function loginCacheKey(credentials: TenantCredentials, loginPageUrl: string): string {
return `${credentials.email.trim().toLowerCase()}@${new URL(loginPageUrl, "http://localhost").origin}`;
}
export async function expectPasswordRequirementsVisible(requirements: Locator): Promise<void> {
await expect(requirements).toBeVisible();
const items = requirements.locator("li");
@@ -138,39 +187,43 @@ export function tenantSettingsProfilePath(dashboardPath: string): string {
}
export function tenantSettingsAccountPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "account", process.env.E2E_TENANT_SETTINGS_ACCOUNT_PATH ?? "/app/settings/account");
return tenantSettingsPath(dashboardPath, "workspace", process.env.E2E_TENANT_SETTINGS_ACCOUNT_PATH ?? "/app/settings/workspace");
}
export function tenantSettingsSubscriptionPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "subscription", process.env.E2E_TENANT_SUBSCRIPTION_PATH ?? "/app/settings/subscription");
return tenantSettingsPath(dashboardPath, "billing", process.env.E2E_TENANT_SUBSCRIPTION_PATH ?? "/app/settings/billing");
}
export function tenantSettingsPoliciesPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "policies", process.env.E2E_TENANT_POLICIES_PATH ?? "/app/settings/policies");
return tenantSettingsPath(dashboardPath, "workspace/policies", process.env.E2E_TENANT_POLICIES_PATH ?? "/app/settings/workspace/policies");
}
export function tenantSettingsNotificationsPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "notifications", process.env.E2E_TENANT_NOTIFICATIONS_PATH ?? "/app/settings/notifications");
return tenantSettingsPath(dashboardPath, "profile/notifications", process.env.E2E_TENANT_NOTIFICATIONS_PATH ?? "/app/settings/profile/notifications");
}
export function tenantSettingsMembersPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "members", process.env.E2E_TENANT_MEMBERS_PATH ?? "/app/settings/members");
return tenantSettingsPath(dashboardPath, "team", process.env.E2E_TENANT_MEMBERS_PATH ?? "/app/settings/team");
}
export function tenantSettingsLogsPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "logs", process.env.E2E_TENANT_LOGS_PATH ?? "/app/settings/logs");
return tenantSettingsPath(dashboardPath, "compliance", process.env.E2E_TENANT_LOGS_PATH ?? "/app/settings/compliance");
}
export function tenantSettingsLogEventsPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "logs/events", process.env.E2E_TENANT_LOG_EVENTS_PATH ?? "/app/settings/logs/events");
return tenantSettingsPath(dashboardPath, "compliance/events", process.env.E2E_TENANT_LOG_EVENTS_PATH ?? "/app/settings/compliance/events");
}
export function tenantSettingsAuditExportPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "audit-export", process.env.E2E_TENANT_AUDIT_EXPORT_PATH ?? "/app/settings/audit-export");
return tenantSettingsPath(dashboardPath, "compliance/audit-export", process.env.E2E_TENANT_AUDIT_EXPORT_PATH ?? "/app/settings/compliance/audit-export");
}
export function tenantRolesAndPermissionsPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "roles-and-permissions", process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? "/app/settings/roles-and-permissions");
return tenantSettingsPath(dashboardPath, "team/roles", process.env.E2E_TENANT_ROLES_AND_PERMISSIONS_PATH ?? "/app/settings/team/roles");
}
export function tenantLegacyRolesAndPermissionsPath(dashboardPath: string): string {
return tenantSettingsPath(dashboardPath, "roles-and-permissions", "/app/settings/roles-and-permissions");
}
function tenantSettingsPath(dashboardPath: string, section: string, fallbackPath: string): string {
@@ -0,0 +1,25 @@
import { expect, type Page } from "./test";
const captchaTokenSelector = 'input[name="cap-token"], input[name="mcaptcha__token"]';
export async function solveCaptchaIfPresent(page: Page): Promise<void> {
const mount = page.locator('[data-ui-id="ui.captcha.mount"]');
if ((await mount.count()) === 0) return;
if (await hasCaptchaToken(page)) return;
const verify = mount.getByRole("button", {
name: /^(Click to verify you're a human|Verify you're human|Ich bin ein Mensch|Klicken, um zu bestätigen, dass Sie ein Mensch sind)$/iu,
});
await expect(verify).toBeVisible({ timeout: 10_000 });
await verify.click();
await expect.poll(() => hasCaptchaToken(page), { message: "self-hosted captcha did not produce a token", timeout: 60_000 }).toBe(true);
}
async function hasCaptchaToken(page: Page): Promise<boolean> {
const tokens = page.locator(captchaTokenSelector);
for (let index = 0; index < (await tokens.count()); index += 1) {
if ((await tokens.nth(index).inputValue()).trim().length > 0) return true;
}
return false;
}
@@ -0,0 +1,28 @@
const E2E_LOCAL_PATH_ORIGIN = "https://hivegrid-e2e.invalid";
export function requireCanonicalE2eLocalPath(value: string, inputName: string): string {
let resolved: URL;
try {
resolved = new URL(value, E2E_LOCAL_PATH_ORIGIN);
} catch {
throw invalidLocalPath(inputName);
}
if (
!value.startsWith("/") ||
value.startsWith("//") ||
value.includes("\\") ||
value.includes("%") ||
/[\u0000-\u001f\u007f]/u.test(value) ||
resolved.origin !== E2E_LOCAL_PATH_ORIGIN ||
resolved.pathname !== value ||
resolved.search ||
resolved.hash
) {
throw invalidLocalPath(inputName);
}
return value;
}
function invalidLocalPath(inputName: string): Error {
return new Error(`${inputName} must be a canonical app-local absolute path without query or fragment.`);
}
@@ -1,5 +1,4 @@
import { test, type Page, type Response } from "@playwright/test";
import { encode } from "turbo-stream";
const SKIPPABLE_STATUSES = new Set([400, 403, 404]);
const MOLLIE_HOST_PATTERN = /(^|\.)mollie\.com$/u;
@@ -78,18 +77,46 @@ export function singleFetchActionError(message: string): { status: number; body:
};
}
async function encodeTurboStream(value: unknown): Promise<string> {
const stream = encode(value);
const reader = stream.getReader();
const decoder = new TextDecoder();
let out = "";
for (;;) {
const { done, value: chunk } = await reader.read();
if (done) break;
out += decoder.decode(chunk, { stream: true });
function encodeSingleFetchJson(value: unknown): string {
const values: string[] = [];
const indices = new Map<unknown, number>();
function flatten(input: unknown): number {
if (input === undefined) return -7;
if (input === null) return -5;
if (typeof input === "number") {
if (Number.isNaN(input)) return -2;
if (input === Number.NEGATIVE_INFINITY) return -3;
if (Object.is(input, -0)) return -4;
if (input === Number.POSITIVE_INFINITY) return -6;
}
const existing = indices.get(input);
if (existing !== undefined) return existing;
const index = values.length;
indices.set(input, index);
values.push("");
if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
values[index] = JSON.stringify(input);
return index;
}
if (Array.isArray(input)) {
values[index] = `[${input.map((item) => flatten(item)).join(",")}]`;
return index;
}
if (typeof input === "object" && Object.getPrototypeOf(input) === Object.prototype) {
const entries = Object.entries(input).map(([key, item]) => `"_${flatten(key)}":${flatten(item)}`);
values[index] = `{${entries.join(",")}}`;
return index;
}
throw new TypeError("Single-fetch test fixtures must contain only JSON-compatible values");
}
out += decoder.decode();
return out;
const root = flatten(value);
return root < 0 ? `${root}\n` : `[${values.join(",")}]\n`;
}
/**
@@ -99,9 +126,9 @@ async function encodeTurboStream(value: unknown): Promise<string> {
* turbo-stream and the client (`unwrapSingleFetchResult`) hands `.data` to
* `useActionData()`. Fulfilling the `.data` POST with raw `application/json`
* instead breaks RR7's turbo-stream decoder, so `actionData` is never populated
* and the result/waiting UI never renders. We call the real `turbo-stream`
* `encode` (same package RR7 uses) so arbitrarily-shaped payloads — e.g. a full
* waiting-block execution — encode exactly as the server would. The
* and the result/waiting UI never renders. The test helper emits the JSON-only
* subset of React Router's inlined v2 wire format, which covers these fixture
* payloads without retaining a vulnerable standalone serializer dependency. The
* `X-Remix-Response: yes` header is required or RR7 rejects the response.
*/
export async function singleFetchActionData(
@@ -111,7 +138,7 @@ export async function singleFetchActionData(
return {
status,
contentType: "text/x-script",
body: await encodeTurboStream({ data: payload }),
body: encodeSingleFetchJson({ data: payload }),
headers: { "x-remix-response": "yes" },
};
}
@@ -0,0 +1,35 @@
import type { Page } from "@playwright/test";
export type OperatorCheckpointId = "starter-addon-checkout" | "domain-ownership-txt" | "domain-setup-checkout";
type OperatorCheckpointTestInfo = {
readonly project: {
readonly use: {
readonly headless?: boolean;
};
};
readonly annotations: Array<{ type: string; description?: string }>;
};
export async function pauseForOperatorCheckpoint(
page: Pick<Page, "pause">,
testInfo: OperatorCheckpointTestInfo,
checkpoint: OperatorCheckpointId,
env: NodeJS.ProcessEnv = process.env
): Promise<boolean> {
const configured = env.E2E_OPERATOR_CHECKPOINTS?.trim();
if (!configured || configured === "0") return false;
if (configured !== "1") {
throw new Error("E2E_OPERATOR_CHECKPOINTS must be unset, 0, or 1.");
}
if (env.CI?.trim()) {
throw new Error("E2E_OPERATOR_CHECKPOINTS is forbidden in CI.");
}
if (testInfo.project.use.headless !== false) {
throw new Error("E2E_OPERATOR_CHECKPOINTS requires a headed Playwright run.");
}
testInfo.annotations.push({ type: "operator-checkpoint", description: checkpoint });
await page.pause();
return true;
}
@@ -0,0 +1,301 @@
import type { APIRequestContext, APIResponse } from "@playwright/test";
export type PortalInvitationEntrypoint = "admin" | "contact" | "project";
export const portalSetupMailFixtureInputs = ["E2E_PORTAL_SETUP_MAIL_FIXTURE_URL", "E2E_PORTAL_SETUP_MAIL_FIXTURE_KEY"] as const;
const DEFAULT_POLL_TIMEOUT_MS = 45_000;
const MAX_POLL_TIMEOUT_MS = 90_000;
const POLL_INTERVAL_MS = 1_000;
const DELIVERY_TIMESTAMP_TOLERANCE_MS = 5_000;
const SETUP_TOKEN_PATTERN = /^[A-Za-z0-9_-]{43}$/u;
type PortalSetupMailFixtureResponse = {
readonly correlationKey?: unknown;
readonly recipient?: unknown;
readonly source?: unknown;
readonly purpose?: unknown;
readonly deliveredAt?: unknown;
readonly setupUrl?: unknown;
};
export type PortalSetupJourneyContext = {
readonly origin: string;
readonly tenantPathPrefix: string;
readonly portalRootPath: string;
readonly projectsPath: string;
};
/**
* Test-only mailbox contract for VA-P26a.
*
* The endpoint receives a POST with `{ correlationKey, recipient, source,
* purpose: "setup", deliveredAfter }`. `202`, `204`, and `404` mean that the
* freshly delivered message in the dedicated disposable inbox is not visible
* yet. A ready response is `200` JSON and must echo those fields plus
* `deliveredAt` and the capability-bearing `setupUrl`. The adapter must observe
* actual provider delivery; reading HiveGrid's database, outbox, or queue is not
* a valid implementation of this contract. The endpoint, response body, and
* setup URL are deliberately never included in thrown errors because they can
* contain credentials or a live one-time token.
*/
export async function waitForPortalSetupMailLink(
request: APIRequestContext,
input: {
readonly endpoint: string;
readonly fixtureToken?: string;
readonly correlationKey: string;
readonly recipient: string;
readonly entrypoint: PortalInvitationEntrypoint;
readonly deliveredAfter: Date;
readonly portalBaseUrl: string;
readonly portalCustomDomainBaseUrl?: string;
readonly tenantSlug: string;
readonly timeoutMs?: number;
/** Unit-test seam; production callers use the fixed one-second interval. */
readonly pollIntervalMs?: number;
}
): Promise<string> {
const endpoint = requireSafeFixtureEndpoint(input.endpoint, Boolean(input.fixtureToken));
const expectedPortalOrigin = requireSafeOrigin(input.portalBaseUrl, "E2E_PORTAL_BASE_URL");
const expectedCustomPortalOrigin = input.portalCustomDomainBaseUrl
? requireSafeHttpsRootOrigin(input.portalCustomDomainBaseUrl, "E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL")
: undefined;
const timeoutMs = input.timeoutMs ?? portalSetupMailFixtureTimeoutMs();
const source = input.entrypoint === "admin" ? "portal_admin_invite" : input.entrypoint === "contact" ? "portal_contact_invite" : "portal_project_invite";
const deadline = Date.now() + timeoutMs;
const pollIntervalMs = normalizePollInterval(input.pollIntervalMs);
for (;;) {
const remainingMs = deadline - Date.now();
if (remainingMs <= 0) {
throw new Error("Portal setup mail fixture did not return a fresh matching setup mail before the configured timeout.");
}
let response: APIResponse;
try {
response = await request.post(endpoint.href, {
data: {
correlationKey: input.correlationKey,
recipient: input.recipient,
source,
purpose: "setup",
deliveredAfter: input.deliveredAfter.toISOString(),
},
failOnStatusCode: false,
headers: {
"Cache-Control": "no-store",
...(input.fixtureToken ? { Authorization: `Bearer ${input.fixtureToken}` } : {}),
},
maxRedirects: 0,
timeout: Math.min(5_000, remainingMs),
});
} catch {
// A mailbox/readiness adapter may briefly be unavailable while the mail
// worker or provider catches up. Keep the live capability and endpoint
// out of errors and retry only within the bounded poll deadline.
await wait(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
continue;
}
if ([202, 204, 404].includes(response.status())) {
await wait(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
continue;
}
if ([408, 425, 429].includes(response.status()) || response.status() >= 500) {
await wait(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
continue;
}
if (response.status() !== 200) {
throw new Error(`Portal setup mail fixture returned unexpected HTTP status ${response.status()}.`);
}
const payload = (await response.json().catch(() => null)) as PortalSetupMailFixtureResponse | null;
if (!payload || typeof payload !== "object") {
throw new Error("Portal setup mail fixture returned an invalid JSON contract.");
}
if (
payload.correlationKey !== input.correlationKey ||
normalizeEmail(payload.recipient) !== normalizeEmail(input.recipient) ||
payload.source !== source ||
payload.purpose !== "setup"
) {
throw new Error("Portal setup mail fixture returned a response for a different invitation contract.");
}
const deliveredAt = typeof payload.deliveredAt === "string" ? new Date(payload.deliveredAt) : null;
if (!deliveredAt || !Number.isFinite(deliveredAt.getTime())) {
throw new Error("Portal setup mail fixture returned an invalid delivery timestamp.");
}
// Provider timestamps often have only second precision and the browser
// runner and mailbox adapter can differ by a few seconds. The unique
// correlation key + recipient remains the primary freshness boundary.
if (deliveredAt.getTime() + DELIVERY_TIMESTAMP_TOLERANCE_MS < input.deliveredAfter.getTime()) {
await wait(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
continue;
}
if (typeof payload.setupUrl !== "string") {
throw new Error("Portal setup mail fixture response is missing its setup URL.");
}
return requireSafeSetupUrl(payload.setupUrl, expectedPortalOrigin, input.tenantSlug, expectedCustomPortalOrigin);
}
}
/**
* Re-validates the capability without exposing it and derives the only portal
* origin/path mode the browser journey may use. Standard-host routes retain
* the tenant prefix; an explicitly allowlisted custom host uses root routes.
*/
export function derivePortalSetupJourneyContext(
setupUrl: string,
input: {
readonly portalBaseUrl: string;
readonly portalCustomDomainBaseUrl?: string;
readonly tenantSlug: string;
}
): PortalSetupJourneyContext {
const standardOrigin = requireSafeOrigin(input.portalBaseUrl, "E2E_PORTAL_BASE_URL");
const customOrigin = input.portalCustomDomainBaseUrl
? requireSafeHttpsRootOrigin(input.portalCustomDomainBaseUrl, "E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL")
: undefined;
const safeSetupUrl = requireSafeSetupUrl(setupUrl, standardOrigin, input.tenantSlug, customOrigin);
const effectiveOrigin = new URL(safeSetupUrl).origin;
const tenantPathPrefix = effectiveOrigin === standardOrigin ? `/${encodeURIComponent(input.tenantSlug)}` : "";
return {
origin: effectiveOrigin,
tenantPathPrefix,
portalRootPath: tenantPathPrefix || "/",
projectsPath: `${tenantPathPrefix}/projects`,
};
}
export function isExpectedPortalJourneyLocation(url: URL, journey: PortalSetupJourneyContext, expectedPath: string): boolean {
return url.origin === journey.origin && normalizePortalPath(url.pathname) === expectedPath && !url.search && !url.hash;
}
export function isExpectedPortalProjectDetailLocation(url: URL, journey: PortalSetupJourneyContext): boolean {
if (url.origin !== journey.origin || url.search || url.hash) return false;
const prefix = `${journey.projectsPath}/`;
if (!url.pathname.startsWith(prefix)) return false;
const projectId = url.pathname.slice(prefix.length);
return projectId.length > 0 && !projectId.includes("/");
}
export function assertPortalSetupNavigationHasNoRedirect(response: { readonly request: () => { readonly redirectedFrom: () => unknown | null } }): void {
if (response.request().redirectedFrom() !== null) {
throw new Error("VA-P26a setup capability navigation used a forbidden redirect chain.");
}
}
export function portalSetupMailFixtureTimeoutMs(env: NodeJS.ProcessEnv = process.env): number {
const raw = env.E2E_PORTAL_SETUP_MAIL_FIXTURE_TIMEOUT_MS?.trim();
if (!raw) return DEFAULT_POLL_TIMEOUT_MS;
const value = Number(raw);
if (!Number.isSafeInteger(value) || value < 1_000 || value > MAX_POLL_TIMEOUT_MS) {
throw new Error(`E2E_PORTAL_SETUP_MAIL_FIXTURE_TIMEOUT_MS must be an integer from 1000 to ${MAX_POLL_TIMEOUT_MS}.`);
}
return value;
}
function normalizePollInterval(value: number | undefined): number {
if (value === undefined) return POLL_INTERVAL_MS;
if (!Number.isSafeInteger(value) || value < 1 || value > POLL_INTERVAL_MS) {
throw new Error(`Portal setup mail fixture poll interval must be an integer from 1 to ${POLL_INTERVAL_MS}.`);
}
return value;
}
export function portalSetupMailFixtureNeedsToken(rawEndpoint: string): boolean {
const endpoint = parseHttpUrl(rawEndpoint, "E2E_PORTAL_SETUP_MAIL_FIXTURE_URL");
const loopback = isLoopbackHostname(endpoint.hostname);
if (!loopback && endpoint.protocol !== "https:") {
throw new Error("E2E_PORTAL_SETUP_MAIL_FIXTURE_URL must use HTTPS outside loopback.");
}
return !loopback;
}
function requireSafeFixtureEndpoint(rawEndpoint: string, hasToken: boolean): URL {
const endpoint = parseHttpUrl(rawEndpoint, "E2E_PORTAL_SETUP_MAIL_FIXTURE_URL");
const loopback = isLoopbackHostname(endpoint.hostname);
if (loopback && hasToken) {
throw new Error("E2E_PORTAL_SETUP_MAIL_FIXTURE_TOKEN must be unset for a loopback mail fixture.");
}
if (!loopback && endpoint.protocol !== "https:") {
throw new Error("E2E_PORTAL_SETUP_MAIL_FIXTURE_URL must use HTTPS outside loopback.");
}
if (!loopback && !hasToken) {
throw new Error("E2E_PORTAL_SETUP_MAIL_FIXTURE_TOKEN is required for a non-loopback mail fixture.");
}
return endpoint;
}
function requireSafeOrigin(rawUrl: string, inputName: string): string {
const url = parseHttpUrl(rawUrl, inputName);
if (!isLoopbackHostname(url.hostname) && url.protocol !== "https:") {
throw new Error(`${inputName} must use HTTPS outside loopback.`);
}
return url.origin;
}
function requireSafeHttpsRootOrigin(rawUrl: string, inputName: string): string {
const url = parseHttpUrl(rawUrl, inputName);
if (url.protocol !== "https:" || url.pathname !== "/" || url.search || url.hash) {
throw new Error(`${inputName} must be an exact HTTPS root origin.`);
}
return url.origin;
}
function requireSafeSetupUrl(rawUrl: string, expectedOrigin: string, tenantSlug: string, expectedCustomOrigin?: string): string {
const setupUrl = parseHttpUrl(rawUrl, "portal setup mail fixture setupUrl");
if (setupUrl.username || setupUrl.password || setupUrl.search || setupUrl.hash) {
throw new Error("Portal setup mail fixture returned a setup URL outside the expected portal host contract.");
}
const expectedPrefix =
setupUrl.origin === expectedOrigin
? `/${encodeURIComponent(tenantSlug)}/setup/`
: expectedCustomOrigin && setupUrl.origin === expectedCustomOrigin
? "/setup/"
: null;
if (!expectedPrefix) {
throw new Error("Portal setup mail fixture returned a setup URL outside the expected portal host contract.");
}
if (!setupUrl.pathname.startsWith(expectedPrefix)) {
throw new Error("Portal setup mail fixture returned a setup URL outside the expected setup route.");
}
const token = setupUrl.pathname.slice(expectedPrefix.length);
if (!SETUP_TOKEN_PATTERN.test(token)) {
throw new Error("Portal setup mail fixture returned an invalid setup capability shape.");
}
return setupUrl.href;
}
function parseHttpUrl(rawUrl: string, inputName: string): URL {
let url: URL;
try {
url = new URL(rawUrl);
} catch {
throw new Error(`${inputName} must be an absolute HTTP(S) URL.`);
}
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) {
throw new Error(`${inputName} must be an absolute HTTP(S) URL without embedded credentials.`);
}
return url;
}
function normalizeEmail(value: unknown): string | null {
return typeof value === "string" ? value.trim().toLocaleLowerCase("en-US") : null;
}
function normalizePortalPath(pathname: string): string {
return pathname === "/" ? pathname : pathname.replace(/\/$/u, "");
}
function isLoopbackHostname(hostname: string): boolean {
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]";
}
async function wait(milliseconds: number): Promise<void> {
await new Promise<void>((resolve) => setTimeout(resolve, milliseconds));
}
@@ -0,0 +1,106 @@
import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser, tenantSettingsSubscriptionPath, type TenantCredentials } from "./utils/auth";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { failOnPaymentProviderNetworkRequests, postDataIncludesField, skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
const dashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH ?? "/app/dashboard";
const subscriptionPath = process.env.E2E_TENANT_SUBSCRIPTION_PATH ?? tenantSettingsSubscriptionPath(dashboardPath);
const credentials = getTenantCredentials() ?? canonicalLocalCredentials();
test.describe("VA-P24a self-service subscription smoke", () => {
test("validates plan and seats on the server without starting Mollie checkout", async ({ page }) => {
requireTenantCredentials();
await failOnPaymentProviderNetworkRequests(page);
const checkoutSubmissions: string[] = [];
page.on("request", (request) => {
if (request.method() === "POST" && postDataIncludesField(request.postData(), "intent", /^checkout$/u)) {
checkoutSubmissions.push(request.url());
}
});
await loginAsTenantUser(page, credentials!);
const response = await page.goto(subscriptionPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `VA-P24a subscription path ${subscriptionPath} is unavailable`);
expect(response?.ok(), `Subscription settings returned ${response?.status() ?? "no response"}`).toBe(true);
await expect(page.locator('[data-ui-id="ui.billing.selfServiceSubscription.page"]')).toBeVisible();
const builder = page.locator('[data-ui-id="ui.billing.selfServiceSubscription.builder"]');
await expect(builder).toBeVisible();
const planGroup = builder.getByRole("radiogroup", { name: /^(Tarif|Plan)$/iu });
const planOptions = planGroup.getByRole("radio");
if ((await planOptions.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("VA-P24a fixture needs at least one public plan with a recurring price");
}
await expect(planGroup).toBeVisible();
await expect(planOptions.first()).toBeVisible();
await expect(planGroup.locator('[role="radio"][aria-checked="true"]').first()).toBeVisible();
await expect(builder.getByRole("radiogroup", { name: /^(Abrechnungszeitraum|Billing period)$/iu })).toBeVisible();
const officeSeats = page.locator('[data-ui-id="ui.billing.selfServiceSubscription.officeSeats"]');
const fieldSeats = page.locator('[data-ui-id="ui.billing.selfServiceSubscription.fieldSeats"]');
await expect(officeSeats).toBeVisible();
await expect(fieldSeats).toBeVisible();
if (!(await officeSeats.isEnabled()) || !(await fieldSeats.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("VA-P24a fixture user needs subscription update permission");
}
const minimumOfficeSeats = Number(await officeSeats.getAttribute("min")) || 1;
const currentOfficeSeats = Number(await officeSeats.inputValue()) || minimumOfficeSeats;
const previewOfficeSeats = Math.max(minimumOfficeSeats, currentOfficeSeats) + 1;
await officeSeats.fill(String(previewOfficeSeats));
await expect(officeSeats).toHaveValue(String(previewOfficeSeats));
const previewButton = page.locator('[data-ui-id="ui.billing.selfServiceSubscription.preview"]');
await expect(previewButton).toBeVisible();
if (!(await previewButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("VA-P24a fixture cannot submit the server-side price preview");
}
const previewResponsePromise = page.waitForResponse((previewResponse) => {
const request = previewResponse.request();
if (request.method() !== "POST" || !postDataIncludesField(request.postData(), "intent", /^preview$/u)) return false;
const requestPath = new URL(request.url()).pathname.replace(/\/$/u, "");
const expectedPath = new URL(subscriptionPath, "http://e2e.local").pathname.replace(/\/$/u, "");
return requestPath === expectedPath || requestPath === `${expectedPath}.data`;
});
await previewButton.click();
const previewResponse = await previewResponsePromise;
expect(previewResponse.ok(), `Server preview returned ${previewResponse.status()}`).toBe(true);
const dialog = page.locator('[data-ui-id="ui.billing.selfServiceSubscription.previewDialog"]');
await expect(dialog).toBeVisible();
const recurringLabel = dialog.getByText(/^(Monatlicher Nettobetrag|Monthly net amount)$/iu).first();
await expect(recurringLabel).toBeVisible();
const recurringValue = recurringLabel.locator("..").locator("span").last();
await expect(recurringValue).toHaveText(/\d/u);
await expect(recurringValue).toHaveText(/\//u);
const effectiveLabel = dialog.getByText(/^(Wirksam ab|Effective from)$/iu).first();
await expect(effectiveLabel).toBeVisible();
const effectiveValue = effectiveLabel.locator("..").locator("span").last();
await expect(effectiveValue).toHaveText(/(Sofort|Immediately|Ende|end|\d)/iu);
const checkoutButton = dialog.locator('[data-ui-id="ui.billing.selfServiceSubscription.checkout"]');
await expect(checkoutButton).toBeVisible();
await expectNoCriticalA11yViolations(page);
await dialog.getByRole("button", { name: /^(Auswahl ändern|Change selection)$/iu }).click();
await expect(dialog).toBeHidden();
expect(checkoutSubmissions).toEqual([]);
expect(page.url()).not.toMatch(/mollie\.com/iu);
});
});
function canonicalLocalCredentials(): TenantCredentials | null {
const target = new URL(process.env.E2E_BASE_URL ?? "http://localhost:3000");
const local = target.hostname === "localhost" || target.hostname === "127.0.0.1" || target.hostname === "::1" || target.hostname.endsWith(".localhost");
return local ? { email: "admin@email.com", password: "password" } : null;
}
function requireTenantCredentials(): void {
if (credentials) return;
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "VA-P24a subscription smoke needs tenant credentials for a non-local target");
}
@@ -0,0 +1,649 @@
import type { Browser, BrowserContext } from "@playwright/test";
import { CUSTOMER_PORTAL_UAT_PROJECT_ID } from "../../scripts/customer-portal-uat/contracts";
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser, type TenantCredentials } from "./utils/auth";
import { requireCanonicalE2eLocalPath } from "./utils/local-path";
import { skipIfUnavailable, waitForHydration } from "./utils/navigation";
import {
assertPortalSetupNavigationHasNoRedirect,
derivePortalSetupJourneyContext,
isExpectedPortalJourneyLocation,
isExpectedPortalProjectDetailLocation,
portalSetupMailFixtureInputs,
portalSetupMailFixtureNeedsToken,
portalSetupMailFixtureTimeoutMs,
type PortalInvitationEntrypoint,
type PortalSetupJourneyContext,
waitForPortalSetupMailLink,
} from "./utils/portal-setup-mail-fixture";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing, skipOrFailWhenE2eOptInMissing } from "./utils/readiness";
import { expect, test, type Page } from "./utils/test";
const portalBaseUrl = process.env.E2E_PORTAL_BASE_URL;
const tenantSlug = process.env.E2E_PORTAL_TENANT_SLUG;
const email = process.env.E2E_PORTAL_EMAIL;
const password = process.env.E2E_PORTAL_PASSWORD;
const invitationMutationOptIn = "E2E_ALLOW_CUSTOMER_PORTAL_P26A_INVITATION_MUTATION";
const portalSessionCookieName = "__Host-hivegrid_portal_session";
const captchaTokenSelector = 'input[name="cap-token"], input[name="mcaptcha__token"]';
async function solveCaptchaIfPresent(page: Page): Promise<void> {
const mount = page.locator('[data-ui-id="ui.captcha.mount"]');
if ((await mount.count()) === 0) return;
const hasToken = async () => {
const tokens = page.locator(captchaTokenSelector);
for (let index = 0; index < (await tokens.count()); index += 1) {
if ((await tokens.nth(index).inputValue()).trim()) return true;
}
return false;
};
if (await hasToken()) return;
const verify = page.getByRole("button", {
name: /^(Click to verify you're a human|Verify you're human|Ich bin ein Mensch|Klicken, um zu bestätigen, dass Sie ein Mensch sind)$/iu,
});
await expect(verify).toBeVisible({ timeout: 20_000 });
await verify.click();
await expect.poll(hasToken, { message: "self-hosted captcha did not produce a token", timeout: 60_000 }).toBe(true);
}
const invitationCommonInputs = [
"E2E_TENANT_EMAIL",
"E2E_TENANT_PASSWORD",
"E2E_PORTAL_BASE_URL",
"E2E_PORTAL_TENANT_SLUG",
"E2E_PORTAL_INVITATION_ENTRYPOINT",
"E2E_PORTAL_INVITATION_EMAIL",
"E2E_PORTAL_INVITATION_EXPECTED_PROJECT",
"E2E_PORTAL_INVITATION_SETUP_PASSWORD",
...portalSetupMailFixtureInputs,
] as const;
// One disposable invitation is exercised per run. `admin` additionally needs
// E2E_TENANT_CUSTOMER_PORTAL_SETTINGS_PATH plus first/last name; `contact`
// needs contact-detail and portal-settings paths; `project` needs an explicit
// project-detail path and ProjektKontakt row id. The fixture key must select
// only the newly delivered mail for the configured recipient.
type InvitationContractBase = {
readonly entrypoint: PortalInvitationEntrypoint;
readonly tenantCredentials: TenantCredentials;
readonly portalBaseUrl: string;
readonly portalCustomDomainBaseUrl?: string;
readonly tenantSlug: string;
readonly recipient: string;
readonly expectedProject: string;
readonly setupPassword: string;
readonly mailFixtureUrl: string;
readonly mailFixtureKey: string;
readonly mailFixtureToken?: string;
readonly mailFixtureTimeoutMs: number;
};
type InvitationContract =
| (InvitationContractBase & {
readonly entrypoint: "admin";
readonly settingsPath: string;
readonly firstName: string;
readonly lastName: string;
})
| (InvitationContractBase & {
readonly entrypoint: "contact";
readonly contactPath: string;
readonly settingsPath: string;
})
| (InvitationContractBase & {
readonly entrypoint: "project";
readonly projectPath: string;
readonly projectContactRowId: string;
});
test.use({ trace: "off", video: "off" });
test.describe.configure({ mode: "serial" });
test.describe("VA-P26a customer portal interim smoke", () => {
test("signs in through the separate portal session and opens an access-scoped project", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
["E2E_PORTAL_BASE_URL", "E2E_PORTAL_TENANT_SLUG", "E2E_PORTAL_EMAIL", "E2E_PORTAL_PASSWORD"],
"Customer-portal smoke inputs not configured"
);
const loginUrl = new URL(`/${tenantSlug}/login`, portalBaseUrl).toString();
const loginResponse = await page.goto(loginUrl, { waitUntil: "domcontentloaded" });
const loginStatus = loginResponse?.status() ?? 0;
if (!loginResponse || [400, 403, 404].includes(loginStatus)) {
skipOrFailWhenE2eFixtureMissing(`VA-P26a portal login ${loginUrl} returned ${loginStatus || "no response"}`);
}
expect(loginStatus).toBeGreaterThanOrEqual(200);
expect(loginStatus).toBeLessThan(400);
await expect(page.locator('[data-ui-id="ui.customerPortal.publicShell"]')).toBeVisible();
await page.getByRole("button", { name: /^(Stattdessen mit Passwort anmelden|Sign in with a password instead)$/iu }).click();
await page.locator('input[name="email"]').fill(email!);
await page.locator('input[name="password"]').fill(password!);
await solveCaptchaIfPresent(page);
await page.getByRole("button", { name: /^(Stattdessen mit Passwort anmelden|Sign in with a password instead)$/iu }).click();
await page.waitForURL((url) => url.pathname.replace(/\/$/u, "") === `/${tenantSlug}`, { timeout: 20_000 });
await expect(page.locator('[data-ui-id="ui.customerPortal.portalShell"]')).toBeVisible();
await page
.getByRole("button", { name: /^(Projekte|Projects)$/iu })
.first()
.click();
await page.waitForURL((url) => url.pathname.replace(/\/$/u, "") === `/${tenantSlug}/projects`);
const projectCards = page.locator('[data-ui-id="ui.customerPortal.projectCard"]');
if ((await projectCards.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("VA-P26a fixture needs at least one active PortalProjectAccess row");
}
await expect(projectCards.first()).toBeVisible();
await projectCards
.first()
.getByRole("button", { name: /^(Projekt öffnen|Open project)$/iu })
.click();
await page.waitForURL(new RegExp(`/${tenantSlug}/projects/[^/?#]+$`, "u"));
await expect(page.locator('[data-ui-id="ui.customerPortal.portalShell"]')).toBeVisible();
await expectNoCriticalA11yViolations(page);
});
test.describe("stateful invitation lifecycle", () => {
// A failed attempt may already have created the disposable portal identity.
// Retrying or repeating this mutation in every browser project would turn
// the expected duplicate-email guard into test flakiness.
test.describe.configure({ retries: 0 });
test("invites through the configured admin, contact, or project entrypoint, completes setup, and rejects replay", async ({
page,
browser,
request,
}, testInfo) => {
test.setTimeout(240_000);
test.skip(testInfo.project.name !== "chromium", "VA-P26a invitation lifecycle mutates one disposable fixture exactly once");
skipOrFailWhenE2eOptInMissing(invitationMutationOptIn, "skipping mutating VA-P26a invitation lifecycle");
const contract = requireInvitationContract();
await loginAsTenantUser(page, contract.tenantCredentials);
const invitation = await triggerInvitation(page, contract);
const setupUrl = await waitForPortalSetupMailLink(request, {
endpoint: contract.mailFixtureUrl,
...(contract.mailFixtureToken ? { fixtureToken: contract.mailFixtureToken } : {}),
correlationKey: contract.mailFixtureKey,
recipient: contract.recipient,
entrypoint: contract.entrypoint,
deliveredAfter: invitation.deliveredAfter,
portalBaseUrl: contract.portalBaseUrl,
...(contract.portalCustomDomainBaseUrl ? { portalCustomDomainBaseUrl: contract.portalCustomDomainBaseUrl } : {}),
tenantSlug: contract.tenantSlug,
timeoutMs: contract.mailFixtureTimeoutMs,
});
await proveSetupSessionProjectAndReplay(browser, setupUrl, { ...contract, expectedProject: invitation.expectedProject });
});
});
});
function requireInvitationContract(): InvitationContract {
skipOrFailWhenE2eInputsMissing(invitationCommonInputs, "VA-P26a invitation lifecycle inputs not configured");
const entrypoint = requiredInput("E2E_PORTAL_INVITATION_ENTRYPOINT");
if (entrypoint !== "admin" && entrypoint !== "contact" && entrypoint !== "project") {
throw new Error("E2E_PORTAL_INVITATION_ENTRYPOINT must be admin, contact, or project.");
}
const conditionalInputs =
entrypoint === "admin"
? ["E2E_TENANT_CUSTOMER_PORTAL_SETTINGS_PATH", "E2E_PORTAL_INVITATION_FIRST_NAME", "E2E_PORTAL_INVITATION_LAST_NAME"]
: entrypoint === "contact"
? ["E2E_PORTAL_INVITATION_CONTACT_PATH", "E2E_TENANT_CUSTOMER_PORTAL_SETTINGS_PATH"]
: ["E2E_PORTAL_INVITATION_PROJECT_PATH", "E2E_PORTAL_INVITATION_PROJECT_CONTACT_ROW_ID"];
skipOrFailWhenE2eInputsMissing(conditionalInputs, `VA-P26a ${entrypoint} invitation inputs not configured`);
const mailFixtureUrl = requiredInput("E2E_PORTAL_SETUP_MAIL_FIXTURE_URL");
if (portalSetupMailFixtureNeedsToken(mailFixtureUrl)) {
skipOrFailWhenE2eInputsMissing(["E2E_PORTAL_SETUP_MAIL_FIXTURE_TOKEN"], "VA-P26a non-loopback mail fixture authentication not configured");
}
const tenantCredentials = getTenantCredentials();
if (!tenantCredentials) {
skipOrFailWhenE2eFixtureMissing("VA-P26a tenant credentials were not available after the readiness input gate");
}
const setupPassword = requiredSecretInput("E2E_PORTAL_INVITATION_SETUP_PASSWORD");
if (setupPassword.length < 12) {
throw new Error("E2E_PORTAL_INVITATION_SETUP_PASSWORD must contain at least 12 characters.");
}
const portalCustomDomainBaseUrl = optionalPortalCustomDomainBaseUrl();
const common = {
tenantCredentials,
portalBaseUrl: requiredPortalBaseUrl(),
tenantSlug: requiredTenantSlug(),
recipient: requiredEmailInput("E2E_PORTAL_INVITATION_EMAIL"),
expectedProject: requiredInput("E2E_PORTAL_INVITATION_EXPECTED_PROJECT"),
setupPassword,
mailFixtureUrl,
mailFixtureKey: requiredFixtureKey(),
mailFixtureTimeoutMs: portalSetupMailFixtureTimeoutMs(),
...(portalCustomDomainBaseUrl ? { portalCustomDomainBaseUrl } : {}),
...(process.env.E2E_PORTAL_SETUP_MAIL_FIXTURE_TOKEN ? { mailFixtureToken: process.env.E2E_PORTAL_SETUP_MAIL_FIXTURE_TOKEN } : {}),
};
if (entrypoint === "admin") {
return {
...common,
entrypoint,
settingsPath: requiredLocalPath("E2E_TENANT_CUSTOMER_PORTAL_SETTINGS_PATH"),
firstName: requiredInput("E2E_PORTAL_INVITATION_FIRST_NAME"),
lastName: requiredInput("E2E_PORTAL_INVITATION_LAST_NAME"),
};
}
if (entrypoint === "contact") {
return {
...common,
entrypoint,
contactPath: requiredLocalPath("E2E_PORTAL_INVITATION_CONTACT_PATH"),
settingsPath: requiredLocalPath("E2E_TENANT_CUSTOMER_PORTAL_SETTINGS_PATH"),
};
}
return {
...common,
entrypoint,
projectPath: requiredLocalPath("E2E_PORTAL_INVITATION_PROJECT_PATH"),
projectContactRowId: requiredInput("E2E_PORTAL_INVITATION_PROJECT_CONTACT_ROW_ID"),
};
}
async function triggerInvitation(page: Page, contract: InvitationContract): Promise<{ readonly deliveredAfter: Date; readonly expectedProject: string }> {
if (contract.entrypoint === "admin") return triggerAdminInvitation(page, contract);
if (contract.entrypoint === "contact") return triggerContactInvitation(page, contract);
return triggerProjectInvitation(page, contract);
}
async function triggerAdminInvitation(
page: Page,
contract: Extract<InvitationContract, { readonly entrypoint: "admin" }>
): Promise<{ readonly deliveredAfter: Date; readonly expectedProject: string }> {
const response = await page.goto(contract.settingsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `VA-P26a customer-portal settings ${contract.settingsPath} are unavailable`);
await waitForHydration(page);
const admin = page.locator('[data-ui-id="ui.customerPortal.admin"]');
await expect(admin).toBeVisible();
await admin.getByRole("tab", { name: /^(Nutzer|Users)$/iu }).click();
const inviteButton = admin.getByRole("button", { name: /^(Portalzugang einladen|Invite portal account)$/iu });
const firstNameInput = admin.getByLabel(/^(Vorname|First name)$/iu);
const lastNameInput = admin.getByLabel(/^(Nachname|Last name)$/iu);
const emailInput = admin.getByLabel(/^(E-Mail-Adresse|Email address)$/iu);
if (
!(await firstNameInput.isEnabled()) ||
!(await lastNameInput.isEnabled()) ||
!(await emailInput.isEnabled()) ||
!(await portalAdminCanManageAccess(page))
) {
skipOrFailWhenE2eFixtureMissing("VA-P26a admin fixture needs portal.manage_users and portal.manage_access");
}
await firstNameInput.fill(contract.firstName);
await lastNameInput.fill(contract.lastName);
await emailInput.fill(contract.recipient);
await expect(inviteButton).toBeEnabled();
const deliveredAfter = freshDeliveryBoundary();
await inviteButton.click();
await expect(admin.getByText(contract.recipient, { exact: false })).toBeVisible();
await expect(
admin.getByText(
/^(Der Einrichtungslink wurde per E-Mail versendet und ist sieben Tage gültig\.|The setup link was sent by email and remains valid for seven days\.)$/iu
)
).toBeVisible();
const invitedName = `${contract.firstName} ${contract.lastName}`;
const expectedProject = await grantExpectedProjectAccess(page, contract.recipient, invitedName, contract.expectedProject);
return { deliveredAfter, expectedProject };
}
async function triggerContactInvitation(
page: Page,
contract: Extract<InvitationContract, { readonly entrypoint: "contact" }>
): Promise<{ readonly deliveredAfter: Date; readonly expectedProject: string }> {
const beforeResponse = await page.goto(contract.settingsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, beforeResponse, `VA-P26a customer-portal settings ${contract.settingsPath} are unavailable`);
await waitForHydration(page);
if (!(await portalAdminCanManageAccess(page))) {
skipOrFailWhenE2eFixtureMissing("VA-P26a contact fixture needs portal.manage_access");
}
const response = await page.goto(contract.contactPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `VA-P26a contact invitation route ${contract.contactPath} is unavailable`);
await waitForHydration(page);
const contact = page.locator('[data-ui-id="ui.crm.detail"]');
await expect(contact).toBeVisible();
await expect(contact.getByText(contract.recipient, { exact: true }).first()).toBeVisible();
const inviteButton = contact.locator('[data-ui-id="ui.crm.detail.portalInvite"]');
if ((await inviteButton.count()) !== 1 || !(await inviteButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("VA-P26a contact fixture needs one eligible contact and portal.manage_users");
}
const deliveredAfter = freshDeliveryBoundary();
await inviteButton.click();
await expect(contact.locator('[data-ui-id="ui.crm.detail.portalInviteSuccess"]')).toBeVisible();
const settingsResponse = await page.goto(contract.settingsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, settingsResponse, `VA-P26a customer-portal settings ${contract.settingsPath} are unavailable after contact invitation`);
await waitForHydration(page);
const expectedProject = await grantExpectedProjectAccess(page, contract.recipient, null, contract.expectedProject);
return { deliveredAfter, expectedProject };
}
async function triggerProjectInvitation(
page: Page,
contract: Extract<InvitationContract, { readonly entrypoint: "project" }>
): Promise<{ readonly deliveredAfter: Date; readonly expectedProject: string }> {
const response = await page.goto(contract.projectPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `VA-P26a project invitation route ${contract.projectPath} is unavailable`);
await waitForHydration(page);
const project = page.locator('[data-ui-id="ui.projects.detail"]');
await expect(project).toBeVisible();
const inviteButton = project.locator(`[data-ui-id="ui.projects.detail.contacts.${cssAttributeValue(contract.projectContactRowId)}.portalInvite"]`);
if ((await inviteButton.count()) !== 1 || !(await inviteButton.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("VA-P26a project fixture needs one eligible private ProjektKontakt and portal.manage_users");
}
const deliveredAfter = freshDeliveryBoundary();
await inviteButton.click();
await expect(project.locator('[data-ui-id="ui.projects.detail.portalInviteSuccess"]')).toBeVisible();
return { deliveredAfter, expectedProject: contract.expectedProject };
}
type PortalAdminHarnessSnapshot = {
readonly canManageAccess: boolean;
readonly users: readonly { readonly id: string; readonly email: string; readonly name: string }[];
readonly accessRows: readonly { readonly portalUserId: string; readonly projectId: string; readonly projectLabel: string }[];
};
async function readPortalAdminHarnessSnapshot(page: Page): Promise<PortalAdminHarnessSnapshot | null> {
return page.evaluate(() => {
const router = (
globalThis as typeof globalThis & {
__reactRouterDataRouter?: { state?: { loaderData?: Record<string, unknown> } };
}
).__reactRouterDataRouter;
const routeData = router?.state?.loaderData?.["routes/app.$tenant/settings/customer-portal"] as
| {
vm?: {
status?: string;
data?: {
permissions?: { canManageAccess?: boolean };
users?: readonly { id?: unknown; email?: unknown; name?: unknown }[];
accessRows?: readonly { portalUserId?: unknown; projectId?: unknown; projectLabel?: unknown }[];
};
};
}
| undefined;
const data = routeData?.vm?.status === "ready" ? routeData.vm.data : undefined;
if (!data || !Array.isArray(data.users) || !Array.isArray(data.accessRows)) return null;
const users = data.users.filter(
(user): user is { id: string; email: string; name: string } =>
typeof user.id === "string" && typeof user.email === "string" && typeof user.name === "string"
);
const accessRows = data.accessRows.filter(
(row): row is { portalUserId: string; projectId: string; projectLabel: string } =>
typeof row.portalUserId === "string" && typeof row.projectId === "string" && typeof row.projectLabel === "string"
);
return { canManageAccess: data.permissions?.canManageAccess === true, users, accessRows };
});
}
async function portalAdminCanManageAccess(page: Page): Promise<boolean> {
return (await readPortalAdminHarnessSnapshot(page))?.canManageAccess === true;
}
async function grantExpectedProjectAccess(page: Page, recipient: string, invitedName: string | null, preferredProject: string): Promise<string> {
await expect
.poll(
async () => {
const snapshot = await readPortalAdminHarnessSnapshot(page);
const matchingUsers = snapshot?.users.filter((user) => user.email.toLowerCase() === recipient.toLowerCase()) ?? [];
const user = matchingUsers.length === 1 ? matchingUsers[0] : undefined;
if (!snapshot?.canManageAccess || !user || (invitedName !== null && user.name !== invitedName)) return false;
return true;
},
{ timeout: 15_000 }
)
.toBe(true);
const snapshotBeforeGrant = await readPortalAdminHarnessSnapshot(page);
const matchingUsers = snapshotBeforeGrant?.users.filter((user) => user.email.toLowerCase() === recipient.toLowerCase()) ?? [];
const user = matchingUsers.length === 1 ? matchingUsers[0] : undefined;
if (!snapshotBeforeGrant?.canManageAccess || !user || (invitedName !== null && user.name !== invitedName)) {
throw new Error("VA-P26a invitation did not yield one access-manageable portal user and project.");
}
const target = { portalUserId: user.id, userName: user.name, projectId: CUSTOMER_PORTAL_UAT_PROJECT_ID };
const grant = await page.evaluate(async (input) => {
const csrf = document.querySelector<HTMLMetaElement>('meta[name="csrf-token"]')?.content;
if (!csrf) return { status: 0, ok: false };
const form = new FormData();
for (const [key, value] of Object.entries({
csrf,
intent: "set-access",
portalUserId: input.portalUserId,
projectId: input.projectId,
active: "true",
canUpload: "true",
validUntil: "",
companyName: "",
roleLabel: "",
visibleStageIds: "",
visibleDocumentTypes: "",
canSeeOtherSubcontractors: "false",
})) {
form.set(key, value);
}
const response = await fetch(window.location.pathname, { method: "POST", body: form, credentials: "same-origin", headers: { Accept: "application/json" } });
await response.arrayBuffer();
return { status: response.status };
}, target);
expect(grant).toEqual({ status: 200 });
await page.reload({ waitUntil: "domcontentloaded" });
await waitForHydration(page);
const snapshot = await readPortalAdminHarnessSnapshot(page);
const matchingAccessRows =
snapshot?.accessRows.filter(
(row) =>
row.portalUserId === target.portalUserId &&
row.projectId === target.projectId &&
(row.projectLabel === preferredProject || row.projectLabel.endsWith(` · ${preferredProject}`))
) ?? [];
expect(matchingAccessRows).toHaveLength(1);
const projectLabel = matchingAccessRows[0]!.projectLabel;
const admin = page.locator('[data-ui-id="ui.customerPortal.admin"]');
await admin.getByRole("tab", { name: /^(Nutzer|Users)$/iu }).click();
await expect(admin.getByText(`${target.userName} · ${projectLabel}`, { exact: true })).toBeVisible();
return preferredProject;
}
async function proveSetupSessionProjectAndReplay(browser: Browser, setupUrl: string, contract: InvitationContract): Promise<void> {
const journey = derivePortalSetupJourneyContext(setupUrl, contract);
const setupContext = await browser.newContext();
try {
const setupPage = await setupContext.newPage();
await openSetupCapability(setupPage, setupUrl);
// Merely opening a bearer setup capability must never authenticate the
// browser. The session is allowed only after the explicit privacy consent
// and successful one-time consume below.
await expectPortalSessionCookie(setupContext, journey.origin, false);
await submitPortalSetup(setupPage, contract.setupPassword);
await setupPage.waitForURL((url) => isExpectedPortalJourneyLocation(url, journey, journey.portalRootPath), { timeout: 20_000 });
await waitForHydration(setupPage);
await expect(setupPage.locator('[data-ui-id="ui.customerPortal.portalShell"]')).toBeVisible();
await expectPortalSessionCookie(setupContext, journey.origin, true);
await openExpectedPortalProject(setupPage, contract, journey);
const replayContext = await browser.newContext();
try {
await expectPortalSessionCookie(replayContext, journey.origin, false);
const replayPage = await replayContext.newPage();
await openSetupCapability(replayPage, setupUrl);
await submitPortalSetup(replayPage, contract.setupPassword);
const setupRoot = replayPage.locator('[data-ui-id="ui.customerPortal.auth.setup"]');
await expect(setupRoot).toBeVisible();
await expect(
setupRoot.getByText(
/^(Dieser Link ist nicht mehr gültig\. Fordere bitte einen neuen an\.|This link is no longer valid\. Please request a new one\.)$/iu
)
).toBeVisible();
assertSetupCapabilityLocation(replayPage, setupUrl);
await expect(replayPage.locator('[data-ui-id="ui.customerPortal.portalShell"]')).toHaveCount(0);
await expectPortalSessionCookie(replayContext, journey.origin, false);
} finally {
await replayContext.close();
}
} finally {
await setupContext.close();
}
}
async function openSetupCapability(page: Page, setupUrl: string): Promise<void> {
const response = await page.goto(setupUrl, { waitUntil: "domcontentloaded" }).catch(() => {
throw new Error("VA-P26a setup capability navigation failed before a safe response was returned.");
});
const status = response?.status() ?? 0;
if (response) {
assertPortalSetupNavigationHasNoRedirect(response);
}
if (!response || [400, 403, 404].includes(status)) {
skipOrFailWhenE2eFixtureMissing(`VA-P26a setup capability returned ${status || "no response"}`);
}
expect(status).toBeGreaterThanOrEqual(200);
expect(status).toBeLessThan(400);
await waitForHydration(page);
assertSetupCapabilityLocation(page, setupUrl);
await expect(page.locator('[data-ui-id="ui.customerPortal.auth.setup"]')).toBeVisible();
}
async function submitPortalSetup(page: Page, setupPassword: string): Promise<void> {
const setupRoot = page.locator('[data-ui-id="ui.customerPortal.auth.setup"]');
await setupRoot.locator('input[name="password"]').fill(setupPassword);
await setupRoot.locator('input[name="passwordConfirmation"]').fill(setupPassword);
const privacy = setupRoot.locator('[data-ui-id="ui.customerPortal.auth.setup.privacyAcknowledgement"]');
await privacy.click();
await expect(privacy).toHaveAttribute("aria-checked", "true");
await solveCaptchaIfPresent(page);
await setupRoot.locator('form button[type="submit"]').click();
}
async function openExpectedPortalProject(page: Page, contract: InvitationContractBase, journey: PortalSetupJourneyContext): Promise<void> {
await page
.getByRole("button", { name: /^(Projekte|Projects)$/iu })
.first()
.click();
await page.waitForURL((url) => isExpectedPortalJourneyLocation(url, journey, journey.projectsPath));
const projectCard = page.locator('[data-ui-id="ui.customerPortal.projectCard"]').filter({ hasText: contract.expectedProject });
if ((await projectCard.count()) !== 1) {
skipOrFailWhenE2eFixtureMissing("VA-P26a invitation fixture did not yield exactly one expected project access");
}
await expect(projectCard).toBeVisible();
await projectCard.getByRole("button", { name: /^(Projekt öffnen|Open project)$/iu }).click();
await page.waitForURL((url) => isExpectedPortalProjectDetailLocation(url, journey));
await expect(page.locator('[data-ui-id="ui.customerPortal.portalShell"]')).toBeVisible();
await expect(page.getByText(contract.expectedProject, { exact: false }).first()).toBeVisible();
}
async function expectPortalSessionCookie(context: BrowserContext, baseUrl: string, expected: boolean): Promise<void> {
const cookies = await context.cookies(new URL(baseUrl).origin);
const hasPortalSession = cookies.some((cookie) => cookie.name === portalSessionCookieName && cookie.value.length > 0);
expect(hasPortalSession).toBe(expected);
}
function assertSetupCapabilityLocation(page: Page, setupUrl: string): void {
const expected = new URL(setupUrl);
let current: URL;
try {
current = new URL(page.url());
} catch {
throw new Error("VA-P26a setup capability left the allowlisted origin or route.");
}
if (current.origin !== expected.origin || current.pathname !== expected.pathname || current.search || current.hash) {
throw new Error("VA-P26a setup capability left the allowlisted origin or route.");
}
}
function freshDeliveryBoundary(): Date {
return new Date();
}
function requiredInput(key: string): string {
const value = process.env[key]?.trim();
if (!value) throw new Error(`${key} is required after the readiness gate.`);
return value;
}
function requiredSecretInput(key: string): string {
const value = process.env[key];
if (!value?.trim()) throw new Error(`${key} is required after the readiness gate.`);
return value;
}
function requiredEmailInput(key: string): string {
const value = requiredInput(key).toLocaleLowerCase("en-US");
const [localPart, domain, ...extraParts] = value.split("@");
if (extraParts.length > 0 || !localPart || localPart.length > 64 || !domain || value.length > 254 || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(value)) {
throw new Error(`${key} must be a valid email address.`);
}
return value;
}
function requiredTenantSlug(): string {
const value = requiredInput("E2E_PORTAL_TENANT_SLUG");
if (!/^[a-z0-9][a-z0-9-]{1,62}$/u.test(value)) {
throw new Error("E2E_PORTAL_TENANT_SLUG must be a canonical lowercase tenant slug.");
}
return value;
}
function requiredFixtureKey(): string {
const value = requiredInput("E2E_PORTAL_SETUP_MAIL_FIXTURE_KEY");
if (!/^[A-Za-z0-9._:-]{1,128}$/u.test(value)) {
throw new Error("E2E_PORTAL_SETUP_MAIL_FIXTURE_KEY must be a 1-128 character correlation key.");
}
return value;
}
function requiredLocalPath(key: string): string {
return requireCanonicalE2eLocalPath(requiredInput(key), key);
}
function requiredPortalBaseUrl(): string {
const value = requiredInput("E2E_PORTAL_BASE_URL");
let url: URL;
try {
url = new URL(value);
} catch {
throw new Error("E2E_PORTAL_BASE_URL must be an absolute HTTP(S) URL.");
}
const loopback = ["localhost", "127.0.0.1", "::1", "[::1]"].includes(url.hostname);
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || (!loopback && url.protocol !== "https:")) {
throw new Error("E2E_PORTAL_BASE_URL must be a safe portal origin and use HTTPS outside loopback.");
}
return url.origin;
}
function optionalPortalCustomDomainBaseUrl(): string | undefined {
const value = process.env.E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL?.trim();
if (!value) return undefined;
let url: URL;
try {
url = new URL(value);
} catch {
throw new Error("E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL must be an exact HTTPS root origin.");
}
if (url.protocol !== "https:" || url.username || url.password || url.pathname !== "/" || url.search || url.hash) {
throw new Error("E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL must be an exact HTTPS root origin.");
}
return url.origin;
}
function cssAttributeValue(value: string): string {
return value.replace(/["\\]/gu, "\\$&");
}
@@ -0,0 +1,330 @@
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { solveCaptchaIfPresent } from "./utils/captcha";
import { expectNoHorizontalOverflow } from "./utils/mobile";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing, skipOrFailWhenE2eOptInMissing } from "./utils/readiness";
import { expect, test, type Locator, type Page } from "./utils/test";
const portalBaseUrl = process.env.E2E_PORTAL_BASE_URL;
const tenantSlug = process.env.E2E_PORTAL_TENANT_SLUG;
const customerEmail = process.env.E2E_PORTAL_EMAIL;
const customerPassword = process.env.E2E_PORTAL_PASSWORD;
const subcontractorEmail = process.env.E2E_PORTAL_SUBCONTRACTOR_EMAIL;
const subcontractorPassword = process.env.E2E_PORTAL_SUBCONTRACTOR_PASSWORD;
const expectedSubcontractorProject = process.env.E2E_PORTAL_SUBCONTRACTOR_EXPECTED_PROJECT;
const forbiddenSubcontractorProject = process.env.E2E_PORTAL_SUBCONTRACTOR_FORBIDDEN_PROJECT;
const tenantCredentials = getTenantCredentials();
const tenantDashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const tenantPortalSettingsPath =
process.env.E2E_TENANT_CUSTOMER_PORTAL_SETTINGS_PATH ?? tenantDashboardPath?.replace(/\/dashboard\/?$/u, "/settings/customer-portal");
const mutationOptIn = "E2E_ALLOW_CUSTOMER_PORTAL_P26B_MUTATION";
const portalInputs = ["E2E_PORTAL_BASE_URL", "E2E_PORTAL_TENANT_SLUG", "E2E_PORTAL_EMAIL", "E2E_PORTAL_PASSWORD"] as const;
test.use({ trace: "off", video: "off" });
test.describe.configure({ mode: "serial" });
test.describe("VA-P26b customer portal interim journeys", () => {
test("customer uploads multiple files and submits an authenticated complaint", async ({ page }) => {
requirePortalInputs("VA-P26b customer upload and complaint inputs not configured");
requireP26bMutation("upload and complaint journey");
await loginToPortal(page, customerEmail!, customerPassword!);
const uploadRunKey = `${Date.now()}-${process.pid}`;
const photoAName = `portal-photo-a-${uploadRunKey}.png`;
const photoBName = `portal-photo-b-${uploadRunKey}.png`;
const uploadUrl = new URL(`/${tenantSlug}/upload`, portalBaseUrl).toString();
const uploadResponse = await page.goto(uploadUrl, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, uploadResponse, `VA-P26b portal upload ${uploadUrl} is unavailable`);
const interactions = page.locator('[data-ui-id="ui.customerPortal.projectInteractions"]');
await expect(interactions).toBeVisible();
const fileInput = interactions.locator('input[type="file"]');
if (!(await fileInput.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("VA-P26b fixture needs an active customer project access with uploads enabled");
}
await fileInput.setInputFiles([
{
name: photoAName,
mimeType: "image/png",
buffer: tinyPng("red"),
},
{
name: photoBName,
mimeType: "image/png",
buffer: tinyPng("blue"),
},
]);
await expect(interactions.getByText(photoAName)).toBeVisible();
await expect(interactions.getByText(photoBName)).toBeVisible();
const csrfCookiePresent = (await page.context().cookies()).some((cookie) => cookie.name === "__Host-hivegrid_portal_csrf");
expect(csrfCookiePresent).toBe(true);
await page.evaluate(() => {
const originalFetch = window.fetch.bind(window);
Object.assign(window, { __p26UploadFetchObservations: [] });
window.fetch = async (...args) => {
const input = args[0];
const target = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
const method = args[1]?.method ?? (input instanceof Request ? input.method : "GET");
const csrfValue = args[1]?.body instanceof FormData ? args[1].body.get("csrf") : null;
const csrfFieldPresent = typeof csrfValue === "string" && csrfValue.length > 0;
try {
const response = await originalFetch(...args);
(window as typeof window & { __p26UploadFetchObservations: unknown[] }).__p26UploadFetchObservations.push({
target,
method,
status: response.status,
csrfFieldPresent,
});
return response;
} catch (error) {
(window as typeof window & { __p26UploadFetchObservations: unknown[] }).__p26UploadFetchObservations.push({
target,
method,
csrfFieldPresent,
errorName: error instanceof Error ? error.name : "UnknownError",
});
throw error;
}
};
});
await interactions.getByRole("button", { name: /^(Dateien sicher hochladen|Upload files securely)$/iu }).click();
await expect(
interactions.getByText(/^(Die Dateien wurden geprüft und dem Projekt zugeordnet\.|The files were checked and linked to the project\.)$/iu)
).toBeVisible();
const uploadPagePath = new URL(uploadUrl).pathname;
const projectUploadPrefix = `${uploadPagePath.slice(0, -"/upload".length)}/projects/`;
await expect
.poll(() =>
page.evaluate(
({ projectUploadPrefix }) =>
(
window as typeof window & {
__p26UploadFetchObservations?: Array<{ target: string; method: string; csrfFieldPresent: boolean }>;
}
).__p26UploadFetchObservations?.filter((observation) => {
const targetPath = new URL(observation.target, window.location.href).pathname;
return observation.method === "POST" && observation.csrfFieldPresent && targetPath.startsWith(projectUploadPrefix);
}).length ?? 0,
{ projectUploadPrefix },
),
)
.toBe(2);
const observations = await page.evaluate(
() =>
(window as typeof window & {
__p26UploadFetchObservations?: Array<{ target: string; method: string; status?: number; csrfFieldPresent: boolean }>;
}).__p26UploadFetchObservations ?? [],
);
const uploadObservations = observations.filter((observation) => {
const targetPath = new URL(observation.target, page.url()).pathname;
return observation.method === "POST" && observation.csrfFieldPresent && targetPath.startsWith(projectUploadPrefix);
});
expect(uploadObservations).toHaveLength(2);
for (const observation of uploadObservations) {
const targetPath = new URL(observation.target, page.url()).pathname;
expect(targetPath.startsWith(projectUploadPrefix)).toBe(true);
expect(targetPath.slice(projectUploadPrefix.length)).toMatch(/^[^/]+\/upload$/u);
expect(observation.csrfFieldPresent).toBe(true);
expect(observation.status).toBe(201);
}
const interactionButtons = interactions.getByRole("button");
if ((await interactionButtons.count()) < 2) {
skipOrFailWhenE2eFixtureMissing("VA-P26b fixture needs an enabled portal_form complaint form");
}
const complaintSubmit = interactionButtons.last();
await completeComplaintFields(interactions);
if (!(await complaintSubmit.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("VA-P26b complaint fixture contains unsupported or unsatisfied required fields");
}
await complaintSubmit.click();
await expect(
interactions.getByText(
/^(Deine Reklamation wurde gespeichert und das Projektteam informiert\.|Your complaint was saved and the project team was notified\.)$/iu
)
).toBeVisible();
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
});
test("subcontractor sees only the explicitly assigned project", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
[
"E2E_PORTAL_BASE_URL",
"E2E_PORTAL_TENANT_SLUG",
"E2E_PORTAL_SUBCONTRACTOR_EMAIL",
"E2E_PORTAL_SUBCONTRACTOR_PASSWORD",
"E2E_PORTAL_SUBCONTRACTOR_EXPECTED_PROJECT",
"E2E_PORTAL_SUBCONTRACTOR_FORBIDDEN_PROJECT",
],
"VA-P26b subcontractor isolation inputs not configured"
);
await loginToPortal(page, subcontractorEmail!, subcontractorPassword!);
const projectsUrl = new URL(`/${tenantSlug}/projects`, portalBaseUrl).toString();
const projectsResponse = await page.goto(projectsUrl, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, projectsResponse, `VA-P26b subcontractor project list ${projectsUrl} is unavailable`);
const projectCards = page.locator('[data-ui-id="ui.customerPortal.projectCard"]');
if ((await projectCards.count()) === 0) {
skipOrFailWhenE2eFixtureMissing("VA-P26b subcontractor fixture needs one active project-scoped access row");
}
await expect(projectCards.getByText(expectedSubcontractorProject!, { exact: false })).toBeVisible();
await expect(page.getByText(forbiddenSubcontractorProject!, { exact: false })).toHaveCount(0);
await projectCards
.filter({ hasText: expectedSubcontractorProject! })
.getByRole("button", { name: /^(Projekt öffnen|Open project)$/iu })
.click();
await expect(page.locator('[data-ui-id="ui.customerPortal.portalShell"]')).toBeVisible();
await expect(page.getByText(expectedSubcontractorProject!, { exact: false }).first()).toBeVisible();
await expect(page.getByText(forbiddenSubcontractorProject!, { exact: false })).toHaveCount(0);
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
});
test("tenant admin persists portal configuration and processes the service inbox", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"], "VA-P26b tenant-admin inputs not configured");
requireP26bMutation("tenant configuration and service-inbox journey");
if (!tenantPortalSettingsPath) {
skipOrFailWhenE2eFixtureMissing("VA-P26b customer-portal settings path is not derivable from E2E_TENANT_DASHBOARD_PATH");
}
await loginAsTenantUser(page, tenantCredentials!);
const settingsResponse = await page.goto(tenantPortalSettingsPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, settingsResponse, `VA-P26b tenant portal settings ${tenantPortalSettingsPath}`);
await expect(page.locator('[data-ui-id="ui.customerPortal.admin"]')).toBeVisible();
await page.getByRole("button", { name: /^(Grundeinstellungen bearbeiten|Edit basic settings)$/iu }).click();
const saveConfiguration = page.getByRole("button", {
name: /^(Konfiguration speichern|Save configuration)$/iu,
});
if (!(await saveConfiguration.isEnabled())) {
skipOrFailWhenE2eFixtureMissing("VA-P26b admin fixture needs portal.admin permission and a writable tenant");
}
await saveConfiguration.click();
await expect(page.getByText(/^(Die Kundenportal-Konfiguration wurde aktualisiert\.|The customer portal configuration was updated\.)$/iu)).toBeVisible();
await page.getByRole("tab", { name: /^(Domain & Mail)$/iu }).click();
await page.getByRole("button", { name: /^(Vollständige Inbox öffnen|Open full inbox)$/iu }).click();
await expect(page.locator('[data-ui-id="ui.customerPortal.serviceInbox"]')).toBeVisible();
const startWork = page.getByRole("button", { name: /^(Bearbeitung starten|Start work)$/iu }).first();
const resolve = page.getByRole("button", { name: /^(Erledigen|Resolve)$/iu }).first();
if (!(await resolve.isVisible())) {
skipOrFailWhenE2eFixtureMissing("VA-P26b admin fixture needs one open seven-day service-inbox item");
}
if (await startWork.isEnabled()) {
await startWork.click();
await expect(page.getByText(/^(Die Kundenportal-Konfiguration wurde aktualisiert\.|The customer portal configuration was updated\.)$/iu)).toBeVisible();
}
await resolve.click();
await expect(page.getByText(/^(Die Kundenportal-Konfiguration wurde aktualisiert\.|The customer portal configuration was updated\.)$/iu)).toBeVisible();
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
});
test("customer requests an export and exercises the deletion grace-period cancellation", async ({ page }) => {
requirePortalInputs("VA-P26b customer lifecycle inputs not configured");
requireP26bMutation("GDPR export and deletion grace-period journey");
await loginToPortal(page, customerEmail!, customerPassword!);
const settingsUrl = new URL(`/${tenantSlug}/settings`, portalBaseUrl).toString();
const settingsResponse = await page.goto(settingsUrl, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, settingsResponse, `VA-P26b portal lifecycle settings ${settingsUrl} is unavailable`);
const lifecycle = page.locator('[data-ui-id="ui.customerPortal.lifecycle"]');
await expect(lifecycle).toBeVisible();
await lifecycle.getByRole("button", { name: /^(Datenauskunft anfordern|Request data export)$/iu }).click();
await expect(lifecycle.getByText(/^(Deine Datenauskunft wird erstellt\.|Your data export is being prepared\.)/iu)).toBeVisible();
const existingCancel = lifecycle.getByRole("button", {
name: /^(Kontolöschung widerrufen|Cancel account deletion)$/iu,
});
if (await existingCancel.isVisible()) {
await existingCancel.click();
await expect(lifecycle.getByText(/^(Die vorgemerkte Kontolöschung wurde widerrufen\.|The scheduled account deletion was cancelled\.)$/iu)).toBeVisible();
}
await lifecycle.getByLabel(/^(Aktuelles Passwort|Current password)$/iu).fill(customerPassword!);
await lifecycle.getByRole("button", { name: /^(Kontolöschung vormerken|Schedule account deletion)$/iu }).click();
await expect(lifecycle.getByText(/^(Die Kontolöschung ist vorgemerkt\.|Account deletion is scheduled\.)/iu)).toBeVisible();
await lifecycle.getByRole("button", { name: /^(Kontolöschung widerrufen|Cancel account deletion)$/iu }).click();
await expect(lifecycle.getByText(/^(Die vorgemerkte Kontolöschung wurde widerrufen\.|The scheduled account deletion was cancelled\.)$/iu)).toBeVisible();
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
});
});
function requirePortalInputs(reason: string): void {
skipOrFailWhenE2eInputsMissing(portalInputs, reason);
}
function requireP26bMutation(reason: string): void {
skipOrFailWhenE2eOptInMissing(mutationOptIn, `skipping mutating VA-P26b ${reason}`);
}
async function loginToPortal(page: Page, email: string, password: string): Promise<void> {
const loginUrl = new URL(`/${tenantSlug}/login`, portalBaseUrl).toString();
const loginResponse = await page.goto(loginUrl, { waitUntil: "domcontentloaded" });
const loginStatus = loginResponse?.status() ?? 0;
if (!loginResponse || [400, 403, 404].includes(loginStatus)) {
skipOrFailWhenE2eFixtureMissing(`VA-P26b portal login ${loginUrl} returned ${loginStatus || "no response"}`);
}
expect(loginStatus).toBeGreaterThanOrEqual(200);
expect(loginStatus).toBeLessThan(400);
await expect(page.locator('[data-ui-id="ui.customerPortal.publicShell"]')).toBeVisible();
await page
.getByRole("button", {
name: /^(Stattdessen mit Passwort anmelden|Sign in with a password instead)$/iu,
})
.click();
await page.locator('input[name="email"]').fill(email);
await page.locator('input[name="password"]').fill(password);
await solveCaptchaIfPresent(page);
await page
.getByRole("button", {
name: /^(Stattdessen mit Passwort anmelden|Sign in with a password instead)$/iu,
})
.click();
await page.waitForURL((url) => url.pathname.replace(/\/$/u, "") === `/${tenantSlug}`, {
timeout: 20_000,
});
await expect(page.locator('[data-ui-id="ui.customerPortal.portalShell"]')).toBeVisible();
}
async function completeComplaintFields(interactions: Locator): Promise<void> {
const editableInputs = interactions.locator('input:not([type="file"]):not([type="checkbox"]):not([type="radio"]), textarea');
for (let index = 0; index < (await editableInputs.count()); index += 1) {
const input = editableInputs.nth(index);
if (!(await input.isVisible()) || !(await input.isEnabled())) continue;
const type = await input.getAttribute("type");
await input.fill(type === "number" ? "1" : `E2E Reklamation ${index + 1}`);
}
const selects = interactions.getByRole("combobox");
for (let index = 0; index < (await selects.count()); index += 1) {
const select = selects.nth(index);
if (!(await select.isVisible()) || !(await select.isEnabled())) continue;
await select.click();
const option = select.page().getByRole("option").first();
if (await option.isVisible()) await option.click();
}
const checkboxes = interactions.getByRole("checkbox");
for (let index = 0; index < (await checkboxes.count()); index += 1) {
const checkbox = checkboxes.nth(index);
if (!(await checkbox.isVisible()) || !(await checkbox.isEnabled())) continue;
if ((await checkbox.getAttribute("aria-checked")) !== "true") await checkbox.click();
}
}
function tinyPng(color: "red" | "blue"): Buffer {
const encoded =
color === "red"
? "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAusB9Y9ZrS8AAAAASUVORK5CYII="
: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=";
return Buffer.from(encoded, "base64");
}
@@ -0,0 +1,222 @@
import { expectNoCriticalA11yViolations } from "./utils/axe";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { solveCaptchaIfPresent } from "./utils/captcha";
import { expectNoHorizontalOverflow } from "./utils/mobile";
import { skipIfUnavailable } from "./utils/navigation";
import { pauseForOperatorCheckpoint } from "./utils/operator-checkpoint";
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing, skipOrFailWhenE2eOptInMissing } from "./utils/readiness";
import { expect, test, type Page } from "./utils/test";
const tenantCredentials = getTenantCredentials();
const tenantDashboardPath = process.env.E2E_TENANT_DASHBOARD_PATH;
const tenantPortalDomainPath =
process.env.E2E_TENANT_CUSTOMER_PORTAL_DOMAIN_PATH ?? tenantDashboardPath?.replace(/\/dashboard\/?$/u, "/settings/customer-portal/domain");
const claimHostname = process.env.E2E_PORTAL_DOMAIN_CLAIM_HOSTNAME;
const customPortalBaseUrl = process.env.E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL;
const standardPortalBaseUrl = process.env.E2E_PORTAL_BASE_URL;
const portalTenantSlug = process.env.E2E_PORTAL_TENANT_SLUG;
const portalEmail = process.env.E2E_PORTAL_EMAIL;
const portalPassword = process.env.E2E_PORTAL_PASSWORD;
const portalExpectedTitle = process.env.E2E_PORTAL_EXPECTED_TITLE;
const mutationOptIn = "E2E_ALLOW_CUSTOMER_PORTAL_P26C_MUTATION";
const starterCredentials =
process.env.E2E_STARTER_TENANT_EMAIL && process.env.E2E_STARTER_TENANT_PASSWORD
? { email: process.env.E2E_STARTER_TENANT_EMAIL, password: process.env.E2E_STARTER_TENANT_PASSWORD }
: null;
const starterDashboardPath = process.env.E2E_STARTER_TENANT_DASHBOARD_PATH;
const starterPortalDomainPath =
process.env.E2E_STARTER_TENANT_CUSTOMER_PORTAL_DOMAIN_PATH ?? starterDashboardPath?.replace(/\/dashboard\/?$/u, "/settings/customer-portal/domain");
test.use({ trace: "off", video: "off" });
test.describe.configure({ mode: "serial" });
test.describe("VA-P26c customer portal domain journey", () => {
test("starter tenant starts the exact recurring customer-portal add-on checkout or proves its active replay state", async ({ page }, testInfo) => {
requireStarterAdminInputs();
requireP26cMutation("Starter customer-portal add-on checkout");
await openStarterDomainAdmin(page);
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
const buyPortal = screen.getByRole("button", { name: /^(Kundenportal buchen|Purchase customer portal)$/iu });
if (!(await buyPortal.isVisible())) {
await expect(screen.getByLabel(/^(Vollständige Subdomain|Fully qualified subdomain)$/iu)).toBeVisible();
return;
}
const appOrigin = new URL(page.url()).origin;
await buyPortal.click();
await page.waitForURL((url) => url.origin !== appOrigin, { timeout: 20_000 });
const checkoutUrl = new URL(page.url());
expect(checkoutUrl.protocol).toBe("https:");
expect(checkoutUrl.hostname).toMatch(/(?:^|\.)mollie\.com$/iu);
await expect(page.getByText(/(?:€\s*23[,.]79|23[,.]79\s*€)/u).first()).toBeVisible();
await pauseForOperatorCheckpoint(page, testInfo, "starter-addon-checkout");
});
test("starter customer-portal add-on is active after the Mollie return", async ({ page }) => {
requireStarterAdminInputs();
await openStarterDomainAdmin(page);
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
await expect(screen.getByRole("button", { name: /^(Kundenportal buchen|Purchase customer portal)$/iu })).toHaveCount(0);
await expect(screen.getByLabel(/^(Vollständige Subdomain|Fully qualified subdomain)$/iu)).toBeVisible();
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
});
test("tenant admin claims a domain and exposes its one-time ownership proof", async ({ page }, testInfo) => {
requireDomainAdminInputs(["E2E_PORTAL_DOMAIN_CLAIM_HOSTNAME"], "VA-P26c domain-claim inputs not configured");
requireP26cMutation("domain claim");
await openDomainAdmin(page);
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
const buyPortal = screen.getByRole("button", { name: /^(Kundenportal buchen|Purchase customer portal)$/iu });
if (await buyPortal.isVisible()) {
skipOrFailWhenE2eFixtureMissing("VA-P26c checkout fixture needs an active portal entitlement before a domain can be claimed");
}
const hostnameInput = screen.getByLabel(/^(Vollständige Subdomain|Fully qualified subdomain)$/iu);
if (!(await hostnameInput.isVisible())) {
skipOrFailWhenE2eFixtureMissing("VA-P26c checkout fixture needs no existing or pending custom-domain claim");
}
await hostnameInput.fill(claimHostname!);
await screen.getByRole("button", { name: /^(Domain reservieren|Reserve domain)$/iu }).click();
await expect(screen.getByText(/^(Die Domain wurde reserviert\.|The domain was reserved\.)/iu)).toBeVisible();
await expect(screen.getByText(`_hivegrid-portal.${claimHostname!}`, { exact: true })).toBeVisible();
await expect(screen.getByRole("button", { name: /^(DNS jetzt prüfen|Verify DNS now)$/iu })).toBeVisible();
await expect(screen.getByRole("button", { name: /^(Einrichtung kaufen|Purchase setup)$/iu })).toHaveCount(0);
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
await pauseForOperatorCheckpoint(page, testInfo, "domain-ownership-txt");
});
test("tenant admin verifies ownership and starts its claim-bound setup purchase", async ({ page }, testInfo) => {
requireDomainAdminInputs([], "VA-P26c domain-ownership inputs not configured");
requireP26cMutation("domain ownership verification and setup checkout");
await openDomainAdmin(page);
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
const verifyDns = screen.getByRole("button", { name: /^(DNS jetzt prüfen|Verify DNS now)$/iu });
if (!(await verifyDns.isVisible())) {
skipOrFailWhenE2eFixtureMissing("VA-P26c paid setup fixture needs a claimed domain with its TXT ownership proof ready for verification");
}
await verifyDns.click();
await expect(screen.getByText(/^(TXT und CNAME wurden bestätigt\.|TXT and CNAME were confirmed\.)/iu)).toBeVisible();
const setupCheckout = screen.getByRole("button", { name: /^(Einrichtung kaufen|Purchase setup)$/iu });
if (!(await setupCheckout.isVisible())) {
skipOrFailWhenE2eFixtureMissing("VA-P26c paid setup fixture needs a TXT-proven claim awaiting its one-time setup purchase");
}
const appOrigin = new URL(page.url()).origin;
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
await setupCheckout.click();
await page.waitForURL((url) => url.origin !== appOrigin, { timeout: 20_000 });
const checkoutUrl = new URL(page.url());
expect(checkoutUrl.protocol).toBe("https:");
expect(checkoutUrl.hostname).toMatch(/(?:^|\.)mollie\.com$/iu);
await expect(page.getByText(/(?:€\s*356[,.]99|356[,.]99\s*€)/u).first()).toBeVisible();
await pauseForOperatorCheckpoint(page, testInfo, "domain-setup-checkout");
});
test("tenant admin verifies DNS and advances a paid claim into provisioning", async ({ page }) => {
requireDomainAdminInputs([], "VA-P26c domain-provisioning inputs not configured");
requireP26cMutation("DNS verification and provisioning");
await openDomainAdmin(page);
const screen = page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]');
const verifyDns = screen.getByRole("button", { name: /^(DNS jetzt prüfen|Verify DNS now)$/iu });
if (!(await verifyDns.isVisible())) {
skipOrFailWhenE2eFixtureMissing("VA-P26c provisioning fixture needs a paid claim with TXT and CNAME records ready for verification");
}
await verifyDns.click();
await expect(screen.getByText(/^(TXT und CNAME wurden bestätigt\.|TXT and CNAME were confirmed\.)/iu)).toBeVisible();
await expect(screen.getByText(/^(Wird bereitgestellt|Aktiv|Provisioning|Active)$/iu).first()).toBeVisible();
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
});
test("active custom host serves the same tenant while the standard host remains available", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(
[
"E2E_PORTAL_CUSTOM_DOMAIN_BASE_URL",
"E2E_PORTAL_BASE_URL",
"E2E_PORTAL_TENANT_SLUG",
"E2E_PORTAL_EMAIL",
"E2E_PORTAL_PASSWORD",
"E2E_PORTAL_EXPECTED_TITLE",
],
"VA-P26c active custom-host and fallback inputs not configured"
);
await loginToPortalHost(page, new URL("/login", customPortalBaseUrl).toString(), "/");
const customShell = page.locator('[data-ui-id="ui.customerPortal.portalShell"]');
await expect(customShell).toBeVisible();
await expect(customShell.getByText(portalExpectedTitle!, { exact: true })).toBeVisible();
expect(new URL(page.url()).origin).toBe(new URL(customPortalBaseUrl!).origin);
await expectNoCriticalA11yViolations(page);
await page.context().clearCookies();
const standardPath = `/${portalTenantSlug}`;
await loginToPortalHost(page, new URL(`${standardPath}/login`, standardPortalBaseUrl).toString(), standardPath);
const standardShell = page.locator('[data-ui-id="ui.customerPortal.portalShell"]');
await expect(standardShell).toBeVisible();
await expect(standardShell.getByText(portalExpectedTitle!, { exact: true })).toBeVisible();
expect(new URL(page.url()).origin).toBe(new URL(standardPortalBaseUrl!).origin);
await expectNoCriticalA11yViolations(page);
await expectNoHorizontalOverflow(page);
});
});
function requireDomainAdminInputs(extra: readonly string[], reason: string): void {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH", ...extra], reason);
if (!tenantPortalDomainPath || !tenantCredentials) {
skipOrFailWhenE2eFixtureMissing("VA-P26c customer-portal domain path is not derivable from E2E_TENANT_DASHBOARD_PATH");
}
}
function requireStarterAdminInputs(): void {
skipOrFailWhenE2eInputsMissing(
["E2E_STARTER_TENANT_EMAIL", "E2E_STARTER_TENANT_PASSWORD", "E2E_STARTER_TENANT_DASHBOARD_PATH"],
"VA-P26c Starter commercial checkout inputs not configured"
);
if (!starterPortalDomainPath || !starterCredentials) {
skipOrFailWhenE2eFixtureMissing("VA-P26c Starter customer-portal domain path is not derivable from E2E_STARTER_TENANT_DASHBOARD_PATH");
}
}
function requireP26cMutation(reason: string): void {
skipOrFailWhenE2eOptInMissing(mutationOptIn, `skipping mutating VA-P26c ${reason}`);
}
async function openDomainAdmin(page: Page): Promise<void> {
await loginAsTenantUser(page, tenantCredentials!);
const response = await page.goto(tenantPortalDomainPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `VA-P26c customer-portal domain route ${tenantPortalDomainPath}`);
await expect(page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]')).toBeVisible();
}
async function openStarterDomainAdmin(page: Page): Promise<void> {
await loginAsTenantUser(page, starterCredentials!);
const response = await page.goto(starterPortalDomainPath!, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, `VA-P26c Starter customer-portal domain route ${starterPortalDomainPath}`);
await expect(page.locator('[data-ui-id="ui.customerPortal.domainAdmin"]')).toBeVisible();
}
async function loginToPortalHost(page: Page, loginUrl: string, expectedPath: string): Promise<void> {
const expectedOrigin = new URL(loginUrl).origin;
const response = await page.goto(loginUrl, { waitUntil: "domcontentloaded" });
const responseStatus = response?.status() ?? 0;
if (!response || [400, 403, 404].includes(responseStatus)) {
skipOrFailWhenE2eFixtureMissing(`VA-P26c public portal login ${loginUrl} returned ${responseStatus || "no response"}`);
}
expect(responseStatus).toBeGreaterThanOrEqual(200);
expect(responseStatus).toBeLessThan(400);
await expect(page.locator('[data-ui-id="ui.customerPortal.publicShell"]')).toBeVisible();
await expect(page.locator("html")).toHaveAttribute("data-hydrated", "true");
await page.getByRole("button", { name: /^(Stattdessen mit Passwort anmelden|Sign in with a password instead)$/iu }).click();
await page.locator('input[name="email"]').fill(portalEmail!);
await page.locator('input[name="password"]').fill(portalPassword!);
await solveCaptchaIfPresent(page);
await page.getByRole("button", { name: /^(Stattdessen mit Passwort anmelden|Sign in with a password instead)$/iu }).click();
await page.waitForURL((url) => url.origin === expectedOrigin && url.pathname.replace(/\/$/u, "") === expectedPath.replace(/\/$/u, ""), { timeout: 20_000 });
}
@@ -0,0 +1,77 @@
import { expect, test } from "@playwright/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
const baseUrl = new URL(
process.env.E2E_BASE_URL ?? "http://admin.localhost:3000"
);
const localTarget =
baseUrl.hostname === "localhost" ||
baseUrl.hostname === "127.0.0.1" ||
baseUrl.hostname === "::1" ||
baseUrl.hostname.endsWith(".localhost");
test.describe("VA-P28b admin sales workspace smoke", () => {
test("reaches the CRM, pipeline, task and data-management surfaces", async ({
page,
}) => {
test.skip(
!localTarget,
"The canonical password fallback is intentionally local-only"
);
await page.context().addCookies([
{ name: "_i18n", value: "de", domain: baseUrl.hostname, path: "/" },
]);
await page.goto("/sales/deals");
await expect(page).toHaveURL(/\/login\?redirect=%2Fsales%2Fdeals$/u);
await page.locator('input[name="email"]').fill("admin@email.com");
await page.locator('input[name="password"]').fill("password");
const loginResponsePromise = page.waitForResponse(
(response) =>
response.request().method() === "POST" &&
response.url().includes("/login.data")
);
await page.locator('form button[type="submit"]').click();
expect((await loginResponsePromise).status()).toBe(202);
await page.waitForTimeout(500);
const adminPage = await page.context().newPage();
await adminPage.goto("/sales/deals");
const pipeline = adminPage.locator(
'[data-ui-id="ui.admin.sales.deals.pipeline"]'
);
await expect(pipeline).toBeVisible();
const createPipeline = pipeline.getByRole("button", {
name: /^(SaaS-Pipeline anlegen|Create SaaS pipeline)$/iu,
});
if (await createPipeline.isVisible()) {
await createPipeline.click();
await adminPage.waitForLoadState("domcontentloaded");
await expect(pipeline).toBeVisible();
}
const screens = [
["/sales/contacts", "ui.admin.sales.contacts.data"],
["/sales/companies", "ui.admin.sales.companies.list"],
["/sales/tasks/today", "ui.admin.sales.tasks.today"],
["/sales/settings/pipelines", "ui.admin.sales.pipelineSettings"],
["/sales/settings/fields-tags", "ui.admin.sales.contacts.data"],
["/sales/import-export", "ui.admin.sales.contacts.data"],
] as const;
for (const [path, uiId] of screens) {
const response = await adminPage.goto(path, {
waitUntil: "domcontentloaded",
});
expect(response, `${path} returned no document response`).not.toBeNull();
expect(response!.ok(), `${path} returned ${response!.status()}`).toBe(
true
);
await expect(adminPage.locator(`[data-ui-id="${uiId}"]`)).toBeVisible();
}
await expectNoCriticalA11yViolations(adminPage, {
include: '[data-ui-id="ui.admin.sales.contacts.data"]',
});
});
});
@@ -0,0 +1,48 @@
import { expect, test } from "@playwright/test";
import { expectNoCriticalA11yViolations } from "./utils/axe";
const baseUrl = new URL(process.env.E2E_BASE_URL ?? "http://admin.localhost:3000");
const localTarget =
baseUrl.hostname === "localhost" ||
baseUrl.hostname === "127.0.0.1" ||
baseUrl.hostname === "::1" ||
baseUrl.hostname.endsWith(".localhost");
test.describe("VR-P28a admin identity workspace smoke", () => {
test("opens the tenantless admin identity, role and security flows", async ({ page }) => {
test.skip(!localTarget, "The password fallback is intentionally available only on the canonical local admin host");
await page.context().addCookies([{ name: "_i18n", value: "de", domain: baseUrl.hostname, path: "/" }]);
await page.goto("/admin-users");
await expect(page).toHaveURL(/\/login\?redirect=%2Fadmin-users$/u);
await page.locator('input[name="email"]').fill("admin@email.com");
await page.locator('input[name="password"]').fill("password");
const loginResponsePromise = page.waitForResponse(
(response) => response.request().method() === "POST" && response.url().includes("/login.data")
);
await page.locator('form button[type="submit"]').click();
expect((await loginResponsePromise).status()).toBe(202);
await page.waitForTimeout(500);
const adminPage = await page.context().newPage();
await adminPage.goto("/admin-users");
await expect(adminPage.locator('[data-ui-id="ui.admin.sales.security.adminUsersPage"]')).toBeVisible();
await expect(adminPage.getByText("admin@email.com")).toBeVisible();
await expect(adminPage.getByText("Super Admin")).toBeVisible();
await adminPage.locator("html[data-hydrated='true']").waitFor({ state: "attached" });
await adminPage.locator("table tr", { hasText: "admin@email.com" }).getByRole("button").click();
await expect(adminPage).toHaveURL(/\/admin-users\/(?!roles(?:$|[/?#]))[^/]+$/u);
await expect(adminPage.locator('[data-ui-id="ui.admin.sales.security.adminUserDetailPage"]')).toBeVisible();
await adminPage.goto("/admin-users/roles");
await expect(adminPage.locator('[data-ui-id="ui.admin.sales.security.adminRolesPage"]')).toBeVisible();
await expect(adminPage.getByText("admin_sales.crm.read", { exact: true })).toBeVisible();
await adminPage.goto("/settings/security");
await expect(adminPage.locator('[data-ui-id="ui.admin.sales.security.adminSecurityProfilePage"]')).toBeVisible();
await expect(adminPage.getByText(/Authentik/iu).first()).toBeVisible();
await expectNoCriticalA11yViolations(adminPage);
});
});