import { expect, test } from "./utils/test"; import { getTenantCredentials, loginAsTenantUser } from "./utils/auth"; import { skipIfUnavailable } from "./utils/navigation"; import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness"; /** * Integrations-Smoke (R-P5 / DoD D.19): Login -> Integrations-Katalog oeffnen -> * App-Karte (sample-data-sync) -> Connection-Verwaltung -> Connect-Wizard * (A5-Dialog mit Stepper) oeffnet Schritt 1. * * Nicht-mutierend: der Wizard wird nur geoeffnet und wieder geschlossen, kein * Submit. Skippt ohne E2E-Credentials / unerreichbare Routen (z.B. Modul aus). */ 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); test.describe("integrations smoke (R-P5)", () => { test.beforeEach(() => { skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_DASHBOARD_PATH"], "Integrations smoke inputs not configured"); }); 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"); await loginAsTenantUser(page, credentials!); const response = await page.goto(integrationsPath!, { waitUntil: "domcontentloaded" }); await skipIfUnavailable(page, response, `Integrations path ${integrationsPath}`); await expect(page.locator('[data-ui-id="ui.integrations.catalog"]').first()).toBeVisible(); // 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)"); } await card.click(); await expect(page.locator('[data-ui-id="ui.integrations.app"]').first()).toBeVisible(); // Connect CTA opens the A5 wizard dialog (permission-gated; no submit). const connect = page.locator('[data-ui-id="ui.integrations.app.connect"]').first(); if (await connect.isVisible()) { await connect.click(); const wizard = page.locator('[data-ui-id="ui.integrations.app.wizard"]'); await expect(wizard).toBeVisible(); await expect(wizard.locator('[data-wizard-step="prerequisites"]')).toBeVisible(); await page.keyboard.press("Escape"); } // Sync history of the first connection, if one exists (view_logs-gated). const historyLink = page.locator('[data-ui-id="ui.integrations.app.connectionCard"] a').first(); if (await historyLink.isVisible()) { await historyLink.click(); await expect(page.locator('[data-ui-id="ui.integrations.syncs"]').first()).toBeVisible(); } }); });