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).
22 lines
905 B
TypeScript
22 lines
905 B
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
test.describe("Frontend", () => {
|
|
test("guests see the landing page", async ({ page }) => {
|
|
await page.goto("/");
|
|
|
|
await expect(page).toHaveTitle(/Polaris Task Force/);
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Polaris Task Force");
|
|
await expect(page.getByRole("link", { name: "Log in to access the portal" })).toBeVisible();
|
|
});
|
|
|
|
test("a user can log in and reach the dashboard", 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 expect(page.getByRole("heading", { level: 1 })).toContainText("Welcome back, J. Fraley");
|
|
});
|
|
});
|