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

51 lines
2.5 KiB
TypeScript

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