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

45 lines
1.9 KiB
TypeScript

import { expect, Page, test } from "@playwright/test";
import { applyDeterministicPage, useE2EUser } from "./helpers.ts";
test("landlord messages view paginates conversations", async ({ page }: { page: Page }) => {
await applyDeterministicPage(page);
await useE2EUser(page, "landlord");
await page.goto("/landlord/messages?page_size=10&sort=newest");
// Wait for the page to fully load
await page.waitForLoadState("networkidle");
await expect(
page.getByRole("heading", { name: /messages/i, level: 1 }),
).toBeVisible();
// Use first() to handle strict mode violation
await expect(page.getByText(/leaking kitchen faucet/i).first()).toBeVisible();
await expect(page.getByText(/inspection scheduled/i)).toHaveCount(0);
await expect(page.getByText(/page 1 of 2/i)).toBeVisible();
await page.getByRole("link", { name: /next/i }).click();
await expect(page).toHaveURL(/page=2/);
// Use first() to handle strict mode violation
await expect(page.getByText(/inspection scheduled/i).first()).toBeVisible();
await expect(page.getByText(/leaking kitchen faucet/i)).toHaveCount(0);
await expect(page.getByText(/page 2 of 2/i)).toBeVisible();
});
test("landlord messages view filters unread inbound messages", async ({ page }: { page: Page }) => {
await applyDeterministicPage(page);
await useE2EUser(page, "landlord");
await page.goto("/landlord/messages?status=unread&direction=received");
// Wait for the page to fully load
await page.waitForLoadState("networkidle");
await expect(
page.getByRole("heading", { name: /messages/i, level: 1 }),
).toBeVisible();
// Use first() to handle strict mode violation
await expect(page.getByText(/leaking kitchen faucet/i).first()).toBeVisible();
await expect(page.getByText(/inspection scheduled/i)).toHaveCount(0);
await expect(page.getByText(/showing 1-1 of 1 messages/i)).toBeVisible();
});