seahaven-ap/e2e/dashboard-grids.spec.ts
Adam Moussa 20d6f56f7e
feat(frontend): add Stampli visual-parity chrome (AP-22) (#10)
Rebuild the mock SPA shell to match the live Stampli product map (header, module rail, invoice/payment tabs, stubs) and add a Sea Haven brand flag for AP-23 cutover.
2026-08-10 19:06:14 -04:00

72 lines
2.7 KiB
TypeScript

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("Sep 1, 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("Sep 1, 2026");
});
});