72 lines
3.9 KiB
TypeScript
72 lines
3.9 KiB
TypeScript
import { expect, test } from "./utils/test";
|
|
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
|
|
import { skipIfUnavailable } from "./utils/navigation";
|
|
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* 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");
|
|
|
|
test.describe("email inbox smoke", () => {
|
|
test("renders the inbox list (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(emailsPath, { waitUntil: "domcontentloaded" });
|
|
await skipIfUnavailable(page, response, "Emails path is not reachable in this environment");
|
|
|
|
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!);
|
|
|
|
const response = await page.goto(emailSettingsPath, { waitUntil: "domcontentloaded" });
|
|
await skipIfUnavailable(page, response, "Email settings path is not reachable in this environment");
|
|
|
|
await expect(page.locator('[data-ui-id="ui.email.settings"]')).toBeVisible();
|
|
});
|
|
});
|