import { expect } from "e2e";
import { test, WEB } from "./t3.ts";

test("Codex limits accept a valid response after four seconds", WEB, async ({ t3, app, screen }) => {
  await t3.project("Usage demo");
  await t3.open("/usage?tab=limits");
  // Allow the real provider probe and the initial limits refresh to finish.
  await new Promise((resolve) => setTimeout(resolve, 8000));
  await screen.getByRole("button", "Refresh limits").tap();
  await new Promise((resolve) => setTimeout(resolve, 6000));
  await app.screenshot("codex-four-second-limits");
  await expect(screen.getByText("58%", { exact: true }).first()).toBeVisible();
  await expect(screen.getByText("90%", { exact: true }).first()).toBeVisible();
});
