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

/**
 * Issue #104 — /history is paginated with an items-per-page dropdown.
 */
test("#104 history has an items-per-page dropdown that drives a perPage query param", async ({ page }) => {
  await login(page, USERS.MANAGER);
  await page.goto("/history");

  const perPage = page.locator("#perPage");
  await expect(perPage).toBeVisible();
  // Options include the configured page sizes.
  await expect(perPage.locator('option[value="50"]')).toBeAttached();

  await perPage.selectOption("50");
  await expect(page).toHaveURL(/perPage=50/);
});
