Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/tests/e2e/p9-operations-smoke.spec.ts
T

49 lines
2.8 KiB
TypeScript

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);
});
});