import { expect, test } from "@playwright/test"; test.describe("dashboard grids", () => { test("home page shows brand and three invoice grids", async ({ page }) => { await page.goto("/"); await expect(page.getByTestId("app-wordmark")).toContainText("STAMPLI"); await expect(page.getByTestId("mocks-status")).toContainText("Mocks enabled"); await expect( page.getByTestId("grid-pending").locator(".MuiDataGrid-row").first(), ).toBeVisible(); await page.getByTestId("tab-ready").click(); await expect(page.getByTestId("grid-ready").locator(".MuiDataGrid-row").first()).toBeVisible(); await page.getByTestId("tab-all").click(); await expect(page.getByTestId("grid-all").locator(".MuiDataGrid-row").first()).toBeVisible(); }); test("payment processing select to pay is reachable from module rail", async ({ page }) => { await page.goto("/"); await page.getByTestId("nav-payment-processing").click(); await expect(page.getByTestId("payment-processing")).toBeVisible(); await expect(page.getByTestId("tab-select-to-pay")).toBeVisible(); await expect( page.getByTestId("grid-select-to-pay").locator(".MuiDataGrid-row").first(), ).toBeVisible(); }); test("ready to pay supports selection, create pay run stub, and pay-date edit", async ({ page, }) => { await page.goto("/"); await page.getByTestId("tab-ready").click(); const createPayRun = page.getByTestId("create-pay-run"); await expect(createPayRun).toBeDisabled(); const readyGrid = page.getByTestId("grid-ready"); await readyGrid.locator(".MuiDataGrid-row").first().getByRole("checkbox").click(); await expect(createPayRun).toBeEnabled(); await createPayRun.click(); await expect(page.getByTestId("create-pay-run-snackbar")).toContainText( "Pay run stub: 1 invoice(s) selected", ); await readyGrid.locator('input[aria-label="Select all rows"]').click(); await expect(createPayRun).toBeEnabled(); await createPayRun.click(); await expect(page.getByTestId("create-pay-run-snackbar")).toContainText( /Pay run stub: [2-9]\d* invoice\(s\) selected/, ); const payDateCell = readyGrid.locator('[data-field="payDate"]').nth(1); await payDateCell.dblclick(); const editor = readyGrid .locator('input[name="payDate"], .MuiDataGrid-editInputCell input') .first(); await editor.fill("2026-09-01"); await editor.press("Enter"); await expect(payDateCell).toContainText("09/01/2026"); await page.getByTestId("tab-pending").click(); await page.getByTestId("tab-ready").click(); await expect( page.getByTestId("grid-ready").locator('[data-field="payDate"]').nth(1), ).toContainText("09/01/2026"); }); });