28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
/**
|
|
* Smoke test: the app loads, serves the login page, and the main form
|
|
* controls are present and reachable. We deliberately avoid hitting the
|
|
* real backend — this is a lightweight sanity check that catches broken
|
|
* routing / bundle / asset problems before they reach production.
|
|
*/
|
|
test("login page renders the sign-in form", async ({ page }) => {
|
|
await page.goto("/login");
|
|
await expect(
|
|
page.getByRole("heading", { name: /sign in|login|welcome/i }),
|
|
).toBeVisible({ timeout: 10_000 });
|
|
|
|
const email = page.getByLabel(/email/i);
|
|
const password = page.getByLabel(/password/i);
|
|
await expect(email).toBeVisible();
|
|
await expect(password).toBeVisible();
|
|
|
|
await expect(page.getByRole("button", { name: /sign in|log in/i })).toBeVisible();
|
|
});
|
|
|
|
test("root redirects to login for anonymous users", async ({ page }) => {
|
|
const response = await page.goto("/");
|
|
expect(response?.ok()).toBeTruthy();
|
|
await page.waitForURL(/\/login/i, { timeout: 10_000 });
|
|
});
|