import { expect, test } from "@playwright/test"; test.describe("Invoice Processing filters (AP-43)", () => { test("Action and Vendor filters reduce grid rows and badge counts", async ({ page }) => { await page.goto("/"); const grid = page.getByTestId("grid-pending"); await expect(grid.locator(".MuiDataGrid-row").first()).toBeVisible(); const before = await grid.locator(".MuiDataGrid-row").count(); expect(before).toBeGreaterThan(0); await expect(page.getByTestId("action-filter").getByPlaceholder("Search")).toBeVisible(); await page.getByTestId("action-filter").click(); await page.getByRole("option", { name: "Approve invoice" }).click(); await expect(page.getByTestId("filter-toggle").locator(".MuiBadge-badge")).toHaveText("1"); await page.getByTestId("vendor-filter").fill("Harbor"); await expect(page.getByTestId("filter-toggle").locator(".MuiBadge-badge")).toHaveText("2"); await expect(grid.locator(".MuiDataGrid-row")).toHaveCount(1); await expect(page.getByTestId("tab-pending").locator("span").last()).toHaveText("1"); await expect(page.getByTestId("attention-banner")).toContainText( "1 invoices require approval. Show invoices ready to approve.", ); }); });