integratedhub/tests/e2e/reminders.spec.ts
open-swe-dev-andrinoid[bot] c773372c30 Apply patch [skip ci]
2026-01-21 14:44:06 +00:00

30 lines
1.1 KiB
TypeScript

import { expect, Page, test } 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();
});