30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { expect, test, Page } from "@playwright/test";
|
|
import { applyDeterministicPage, useE2EUser } from "./helpers.ts";
|
|
|
|
test("landlord can send reminder and tenant receives it", async ({ page }: { page: Page }) => {
|
|
await applyDeterministicPage(page);
|
|
await useE2EUser(page, "landlord");
|
|
|
|
await page.goto("/landlord/reminders");
|
|
|
|
await expect(
|
|
page.getByRole("heading", { name: /payment reminders/i }),
|
|
).toBeVisible();
|
|
|
|
const reminderRow = page.locator("tbody tr", { hasText: "Maple" }).first();
|
|
await expect(reminderRow).toBeVisible();
|
|
|
|
await reminderRow.getByRole("button", { name: /send reminder/i }).click();
|
|
await expect(page).toHaveURL(/\/landlord\/reminders\?success=true/);
|
|
await expect(page.getByText(/reminder sent to tenant/i)).toBeVisible();
|
|
|
|
await useE2EUser(page, "tenant");
|
|
await page.goto("/tenant/messages");
|
|
|
|
await expect(page.getByRole("heading", { name: /messages/i })).toBeVisible();
|
|
const reminderMessage = page.getByRole("listitem").filter({
|
|
hasText: /payment reminder/i,
|
|
}).first();
|
|
await expect(reminderMessage).toBeVisible();
|
|
});
|