import { test, expect } from "@playwright/test";
import { USERS, login } from "./helpers";

/**
 * Issue #31 — PO history allows selecting MULTIPLE statuses (OR-ed). The status
 * filter is a checkbox dropdown; applying two statuses yields two `status` query
 * params.
 */
test("#31 history status filter supports multiple OR-ed statuses", async ({ page }) => {
  await login(page, USERS.MANAGER);
  await page.goto("/history");

  // Open the status dropdown (button label is "All statuses" / "N statuses").
  await page.getByRole("button", { name: /statuses/i }).click();
  await page.getByRole("checkbox", { name: "Closed" }).check();
  await page.getByRole("checkbox", { name: "Approved" }).check();
  await page.getByRole("button", { name: "Apply" }).click();

  await expect(page).toHaveURL(/status=CLOSED/);
  await expect(page).toHaveURL(/status=MGR_APPROVED/);
});
