45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { applyDeterministicPage, useE2EUser } from "./helpers.ts";
|
|
|
|
test("landlord messages view paginates conversations", async ({ 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 }) => {
|
|
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();
|
|
});
|