1
0
Fork 0
polaris-task-force/tests/e2e/supply-boxes.e2e.spec.ts
Z8MB1E d16e721ccc test(e2e): seed e2e user, serialize workers, and deflake specs
The suite could not pass on the test database: global setup now seeds the shared dev/Test123 login with a superuser Roles doc and the dashboard rank, and points its own Payload connection at the test database. Playwright runs one worker with generous test and expect timeouts because first navigation to a route triggers a cold webpack compile, and gains E2E_BROWSER_PATH to swap the browser binary when the installed Vivaldi crashes under automation. The landing page gains the missing h1 the guest specs assert, login flows wait for the redirect to land, strict-mode locator collisions get exact or level-scoped matches, the session banner test re-signs the login claims with a short expiry using the runtime secret, and the reservation dialog click forces the dispatch and verifies the dialog opened (the trigger goes aria-hidden behind the modal mid-click, which stranded the retry loop).
2026-09-30 18:43:29 -04:00

30 lines
1.4 KiB
TypeScript

import { expect, test } from "@playwright/test";
/**
* Supply box management surface.
*
* NOTE: these tests exercise the real dev server and are run in the final
* verification wave (F3) under the dev-server protocol, not on every change.
* The list is server-gated: guests get the landing page; only logged-in users
* see the supply box list (logistics-qualified users additionally get the
* crate command controls on the detail page).
*/
test.describe("Supply box management surface", () => {
test("guests never see the supply box list", async ({ page }) => {
await page.goto("/logistics/supply-boxes");
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Polaris Task Force");
});
test("an authed user sees the supply box list page", async ({ page }) => {
await page.goto("/login");
await page.getByLabel("Username").fill("dev");
await page.getByLabel("Password").fill("Test123");
await page.getByRole("button", { name: "Log in" }).click();
await page.waitForURL((url) => !url.pathname.startsWith("/login"), { timeout: 30_000 });
await page.goto("/logistics/supply-boxes");
await expect(page.getByRole("heading", { name: "Supply Boxes" })).toBeVisible();
// Either a registered box row or the empty state renders.
await expect(page.getByText("No supply boxes have been registered yet.")).toBeVisible();
});
});