Rebrands the product from MobilityOps to Fleet Ops across the UI, backend defaults and knowledge base, and makes nl-BE/en-GB/fr-BE full first-class languages: i18next with eager-bundled per-namespace resources, a persisted accessible language switcher (topbar and mobile drawer), locale-aware date/number formatting, and a coverage test that fails the build on any missing or empty translation key. Backend dynamic content (demo scenarios, blocked-reason text, integration status) moves from fixed English/Dutch prose to stable message codes + params so the frontend can localize it; the demo knowledge base gains a fully translated NL/EN/FR procedure corpus (11 documents each) with per-language retrieval and localized evidence-state messages. The Demo Guide becomes breakpoint-adaptive: a docked rail on extra-wide desktop, a floating panel that auto-collapses to a persistent, closable progress chip on standard desktop/tablet, and a collapsed/half/full bottom sheet on mobile -- with scroll+focus+ highlight on "go to this step", Escape handling, and reduced-motion support. The Data Quality Workbench gets accessible choice-card decisions with a clear primary/ secondary/tertiary action hierarchy; the Automation ledger groups repeated successes and uses meaningful short refs; the Audit trail groups events by correlation id with human action labels and readable before/after diffs. Attention Queue, Today's movements, Vehicles, Bookings and Data Quality rows are fully clickable (stretched-link pattern) with independent secondary links, keyboard support and mobile touch targets. Fixes a topbar overflow on mobile caused by the new language switcher (moved into the mobile drawer at <=960px) and two dangling aria-labelledby references introduced this session. Updates all affected Playwright specs for the new nl-BE default and the new Audit/DemoGuide DOM structure, and adds new i18n-coverage, demo-guide-adaptive and clickable-rows specs. 131 backend tests, Ruff and mypy, and 71 Playwright tests pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
88 lines
4.2 KiB
TypeScript
88 lines
4.2 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
test.describe.configure({ mode: "serial" });
|
|
|
|
test("demo guide is usable as a mobile bottom sheet", async ({ page }) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await page.goto("/login");
|
|
await page.getByRole("button", { name: "Start begeleide demo" }).click();
|
|
await expect(page).toHaveURL(/\/dashboard/);
|
|
|
|
const panel = page.getByRole("dialog", { name: "Gegidste demo" });
|
|
await expect(panel).toBeVisible();
|
|
const box = await panel.boundingBox();
|
|
expect(box).not.toBeNull();
|
|
// A bottom sheet: anchored to the bottom of the viewport, not a full-height side panel.
|
|
expect(box!.height).toBeLessThan(800);
|
|
expect(box!.x).toBeLessThanOrEqual(1);
|
|
|
|
await page.getByRole("button", { name: "Volgende" }).click();
|
|
await expect(page.getByRole("heading", { name: "2. Open een boeking" })).toBeVisible();
|
|
|
|
const scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
|
|
const clientWidth = await page.evaluate(() => document.documentElement.clientWidth);
|
|
expect(scrollWidth).toBeLessThanOrEqual(clientWidth + 1);
|
|
});
|
|
|
|
test("demo guide does not cover the return form's action buttons on desktop", async ({ page }) => {
|
|
await page.goto("/login");
|
|
await page.getByRole("button", { name: "Start begeleide demo" }).click();
|
|
await expect(page).toHaveURL(/\/dashboard/);
|
|
await page.goto("/bookings/BK-DEMO-RETURN");
|
|
|
|
const reviewButton = page.getByRole("button", { name: "Retour nakijken" });
|
|
await expect(reviewButton).toBeVisible();
|
|
await reviewButton.click({ timeout: 5000 });
|
|
await expect(page.getByText(/Verwachte wagenparkstatus/)).toBeVisible();
|
|
});
|
|
|
|
test("demo badge and guide trigger are keyboard reachable and Escape closes them", async ({ page }) => {
|
|
await page.goto("/login");
|
|
await page.getByRole("button", { name: "Verken als Operations Manager" }).click();
|
|
await expect(page).toHaveURL(/\/dashboard$/);
|
|
|
|
const guideTrigger = page.getByRole("button", { name: /Demo-gids/ });
|
|
await guideTrigger.focus();
|
|
await page.keyboard.press("Enter");
|
|
await expect(page.getByRole("dialog", { name: "Gegidste demo" })).toBeVisible();
|
|
await page.keyboard.press("Escape");
|
|
// The guide panel itself doesn't bind Escape (it's a persistent panel, not a transient
|
|
// popover), so close it explicitly the way a keyboard user would: activate its own
|
|
// close control.
|
|
await page.getByRole("button", { name: "Sluiten" }).click();
|
|
await expect(page.getByRole("dialog", { name: "Gegidste demo" })).toBeHidden();
|
|
|
|
const badgeTrigger = page.getByRole("button", { name: /Synthetische demo/ });
|
|
await badgeTrigger.focus();
|
|
await page.keyboard.press("Enter");
|
|
await expect(page.getByRole("dialog", { name: "Over deze demo-omgeving" })).toBeVisible();
|
|
await page.keyboard.press("Escape");
|
|
await expect(page.getByRole("dialog", { name: "Over deze demo-omgeving" })).toBeHidden();
|
|
});
|
|
|
|
test("key demo pages load without console errors", async ({ page }) => {
|
|
const errors: string[] = [];
|
|
page.on("console", (msg) => {
|
|
if (msg.type() !== "error") return;
|
|
// The app deliberately probes GET /demo/session on every load to confirm whether a
|
|
// session cookie is still valid (see AuthContext.tsx); a logged-out visitor's very
|
|
// first load always logs one benign 401 for this, which the app already handles via
|
|
// .catch() -- it is not an application error.
|
|
if (msg.text().includes("401") && msg.text().includes("Unauthorized")) return;
|
|
errors.push(msg.text());
|
|
});
|
|
page.on("pageerror", (err) => errors.push(err.message));
|
|
|
|
await page.goto("/login");
|
|
await page.getByRole("button", { name: "Verken als Operations Manager" }).click();
|
|
await expect(page).toHaveURL(/\/dashboard$/);
|
|
await page.goto("/scenarios");
|
|
await expect(page.getByRole("heading", { name: "Probeer een demonstratiescenario" })).toBeVisible();
|
|
await page.goto("/about");
|
|
await expect(page.getByRole("heading", { name: "Wat Fleet Ops wel en niet is" })).toBeVisible();
|
|
await page.getByRole("button", { name: /Demo-gids/ }).click();
|
|
await expect(page.getByRole("dialog", { name: "Gegidste demo" })).toBeVisible();
|
|
|
|
expect(errors, `Unexpected console errors: ${errors.join("\n")}`).toEqual([]);
|
|
});
|