Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/tests/e2e/booking.spec.ts
T
2026-07-08 16:15:37 +02:00

29 lines
1.4 KiB
TypeScript

import { expect, test } from "./utils/test";
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
import { skipIfUnavailable } from "./utils/navigation";
import { skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
/**
* Booking smoke (AK-P16b / DoD D.19): Login -> /bookings oeffnen -> Liste sichtbar.
*
* Die Route ist modul-gegated (tenantHasModule "booking") + permission-gegated
* (bookings.read_own). Bei aktivem Modul + Berechtigung rendert sie die Buchungen-
* Liste mit `data-ui-id="ui.booking.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 bookingsPath = process.env.E2E_TENANT_BOOKINGS_PATH ?? dashboardPath.replace(/\/dashboard\/?$/u, "/bookings");
test.describe("booking smoke", () => {
test("renders the bookings list", async ({ page }) => {
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Booking smoke inputs not configured");
await loginAsTenantUser(page, credentials!);
const response = await page.goto(bookingsPath, { waitUntil: "domcontentloaded" });
await skipIfUnavailable(page, response, "Bookings path is not reachable in this environment");
await expect(page.locator('[data-ui-id="ui.booking.list"]')).toBeVisible();
});
});