38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { expect, type Page, test } from "@playwright/test";
|
|
import { applyDeterministicPage, useE2EUser } from "./helpers.ts";
|
|
|
|
test("tenant payment history surfaces late fees", async ({ page }: { page: Page }) => {
|
|
await applyDeterministicPage(page);
|
|
await useE2EUser(page, "tenant");
|
|
|
|
await page.goto("/tenant/payments");
|
|
|
|
await expect(
|
|
page.getByRole("heading", { name: /payment history/i }),
|
|
).toBeVisible();
|
|
|
|
const pendingRow = page.locator("tbody tr", { hasText: "pending" }).first();
|
|
await expect(pendingRow).toContainText("$50");
|
|
await expect(page.getByText(/late fees due/i)).toBeVisible();
|
|
});
|
|
|
|
test("landlord rent collection highlights overdue payments", async ({ page }: { page: Page }) => {
|
|
await applyDeterministicPage(page);
|
|
await useE2EUser(page, "landlord");
|
|
|
|
await page.goto("/landlord/payments");
|
|
|
|
await expect(
|
|
page.getByRole("heading", { name: /rent collection/i }),
|
|
).toBeVisible();
|
|
const expectedCard = page.locator("div", { hasText: "Expected This Month" })
|
|
.first();
|
|
const overdueCard = page.locator("div", { hasText: "Overdue Payments" })
|
|
.first();
|
|
const lateFeeCard = page.locator("div", { hasText: "Late Fees Due" }).first();
|
|
|
|
await expect(expectedCard).toContainText("$1,800");
|
|
await expect(overdueCard).toContainText("1");
|
|
await expect(lateFeeCard).toContainText("$50");
|
|
});
|