integratedhub/tests/e2e/example.test.ts
2026-02-14 02:20:19 +00:00

40 lines
1.2 KiB
TypeScript

import { expect, test } from "@playwright/test";
test.describe("Guest Home", () => {
test("renders the current guest landing UI", async ({ page }) => {
await page.goto("/");
await expect(
page.getByRole("heading", {
name: /trusted tools for property operations and personal budgeting/i,
}),
).toBeVisible();
await expect(
page.getByRole("button", { name: "Sign In or Create Account" }),
).toBeVisible();
await expect(page.getByRole("button", { name: "Start as Landlord" }))
.toBeVisible();
await expect(page.getByRole("button", { name: "Start as Tenant" }))
.toBeVisible();
});
test("role quick-start stores landlord intent before auth", async ({ page }) => {
await page.route("**/auth/login**", async (route) => {
await route.fulfill({
status: 200,
contentType: "text/html",
body: "<html><body>Mock Login</body></html>",
});
});
await page.goto("/");
await page.getByRole("button", { name: "Start as Landlord" }).click();
await expect(page).toHaveURL(/\/auth\/login/);
const loginPurpose = await page.evaluate(() =>
globalThis.localStorage.getItem("login-purpose")
);
expect(loginPurpose).toBe("landlord");
});
});