Files
govoplan-core/webui/conformance/tests/campaign-review-details.spec.ts
T

56 lines
3.9 KiB
TypeScript

import { expect, test } from "@playwright/test";
for (const language of ["en", "de"]) {
test(`${language}: validation cause/outcome groups and repeated files are fully paginated`, async ({ page }) => {
const errors: string[] = [];
page.on("pageerror", error => errors.push(error.message));
await page.goto(`/?campaign-review-details&language=${language}`);
const validation = page.getByRole("region", { name: "Validation details fixture" });
const repeated = page.getByRole("region", { name: "Repeated files fixture" });
const next = language === "en" ? "Next page" : "Nächste Seite";
const previous = language === "en" ? "Previous page" : "Vorherige Seite";
const details = language === "en" ? "Technical details" : "Technische Details";
await expect(validation.locator("[data-validation-issue-group]")).toHaveCount(10);
const first = validation.locator("[data-validation-issue-group]").first();
await expect(first.getByText("Missing attachment for recipient 1.", { exact: true })).toBeVisible();
await expect(first.getByText("Policy excludes recipient 1 without attachments.", { exact: true })).toBeVisible();
await first.getByText(details, { exact: true }).click();
await expect(first.getByText(/\/entries\/recipient-1\/attachments\/0/)).toBeVisible();
await expect(first.getByText(/missing_attachment_coverage/)).toBeVisible();
await validation.getByRole("button", { name: next, exact: true }).click();
await expect(validation.locator("[data-validation-issue-group]")).toHaveCount(2);
await expect(validation.getByText("Missing attachment for recipient 12.", { exact: true })).toBeVisible();
await expect(validation.getByRole("button", { name: next, exact: true })).toBeDisabled();
await validation.getByRole("button", { name: previous, exact: true }).click();
await expect(validation.getByText("Missing attachment for recipient 1.", { exact: true })).toBeVisible();
await validation.getByRole("combobox").selectOption("25");
await expect(validation.locator("[data-validation-issue-group]")).toHaveCount(12);
await expect(repeated.getByText(/repeated-file-12\.pdf/)).not.toBeVisible();
await repeated.getByRole("button", { name: next, exact: true }).click();
await expect(repeated.getByText(/repeated-file-12\.pdf/)).toBeVisible();
await repeated.getByRole("button", { name: previous, exact: true }).click();
await expect(repeated.getByText(/repeated-file-1\.pdf/)).toBeVisible();
await expect(repeated.getByText(/repeated-file-12\.pdf/)).not.toBeVisible();
expect(errors).toEqual([]);
});
}
test("detail lists clamp their last page when refreshed results shrink", async ({ page }) => {
await page.goto("/?campaign-review-details&language=en");
const validation = page.getByRole("region", { name: "Validation details fixture" });
const repeated = page.getByRole("region", { name: "Repeated files fixture" });
await validation.getByRole("button", { name: "Next page", exact: true }).click();
await repeated.getByRole("button", { name: "Next page", exact: true }).click();
await expect(validation.getByText("Missing attachment for recipient 12.", { exact: true })).toBeVisible();
await expect(repeated.getByText(/repeated-file-12\.pdf/)).toBeVisible();
await page.getByRole("button", { name: "Reduce fixture details", exact: true }).click();
await expect(validation.locator("[data-validation-issue-group]")).toHaveCount(2);
await expect(validation.getByText("Missing attachment for recipient 1.", { exact: true })).toBeVisible();
await expect(repeated.getByText(/repeated-file-1\.pdf/)).toBeVisible();
await expect(repeated.getByText(/repeated-file-12\.pdf/)).not.toBeVisible();
for (const region of [validation, repeated]) {
await expect(region.getByRole("button", { name: "Previous page", exact: true })).toBeDisabled();
await expect(region.getByRole("button", { name: "Next page", exact: true })).toBeDisabled();
}
});