28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { expectPageRedirectsToLogin } from "../helpers/auth-assertions.ts";
|
|
|
|
test.describe("Error Handling", () => {
|
|
test("unauthorized page renders role mismatch details", async ({ page }) => {
|
|
await page.goto("/unauthorized?required=landlord¤t=tenant");
|
|
|
|
await expect(page.getByRole("heading", { name: "Access Restricted" }))
|
|
.toBeVisible();
|
|
await expect(page.getByText("Required role: landlord")).toBeVisible();
|
|
await expect(page.getByText("Your role: tenant")).toBeVisible();
|
|
});
|
|
|
|
test("unknown tenant invite renders fallback state", async ({ page }) => {
|
|
await page.goto("/tenant/invite/unknown-invite-id");
|
|
|
|
await expect(page.getByText("Invite Preview")).toBeVisible();
|
|
await expect(page.getByText(/could not load this invite/i)).toBeVisible();
|
|
});
|
|
|
|
test("protected route keeps query string in return_path", async ({ request }) => {
|
|
await expectPageRedirectsToLogin(
|
|
request,
|
|
"/tenant/messages/new?draft=true&thread=abc",
|
|
);
|
|
});
|
|
});
|