From 657ded533cf1f9705776fd959d8964832cd606bc Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Tue, 18 Aug 2026 15:41:16 -0700 Subject: [PATCH] test(ui): raise vitest test and hook timeouts for CI headroom (#37370) * test(ui): raise vitest test and hook timeouts for CI headroom The UI unit suite runs about 3x slower on the CI runner than locally, which put the slowest cases right on the 30s per-test limit. TeamInfo's pass through routes case takes ~8s locally and has been failing on staging at the timeout across consecutive runs even though it passes reliably when run directly. Raise testTimeout to 60s and set hookTimeout to 30s so the current slow cases have headroom. This is a stopgap while the suite gets split into proper tiers, not a fix for the underlying per-test cost. * test(ui): query agent form panels with findByRole like the rest of the file The panel helper was the only synchronous query in add_agent_form's integration test; every other lookup already retries via findBy. On the CI runner the second case has been failing with "Unable to find an accessible element with the role button and name /Cost Configuration/" against a modal whose body had not rendered. Make the helper retry like its siblings and await it at each call site. --- .../add_agent_form.integration.test.tsx | 24 +++++++++---------- ui/litellm-dashboard/vitest.config.ts | 3 ++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.integration.test.tsx index b411649ea72..bffc7b0fbc8 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.integration.test.tsx @@ -49,7 +49,7 @@ const langgraphInfo: AgentCreateInfo = { const renderForm = () => render(); -const panel = (name: RegExp) => screen.getByRole("button", { name }); +const panel = (name: RegExp) => screen.findByRole("button", { name }); const openAgentTypeMenu = async (user: ReturnType) => { await user.click(screen.getAllByRole("combobox")[0]); @@ -102,7 +102,7 @@ describe("AddAgentForm submit payload", () => { await user.clear(screen.getByLabelText("Version")); await user.type(screen.getByLabelText("Version"), "2.0.0"); - await user.click(panel(/Skills/)); + await user.click(await panel(/Skills/)); await user.click(screen.getByRole("button", { name: /Add Skill/ })); await user.type(await screen.findByLabelText("Skill ID"), "hello"); await user.type(screen.getByLabelText("Skill Name"), "Hello"); @@ -111,22 +111,22 @@ describe("AddAgentForm submit payload", () => { await user.type(screen.getByLabelText("Examples"), "say hi"); await user.click(screen.getByLabelText("Agent Name")); - await user.click(panel(/Capabilities/)); + await user.click(await panel(/Capabilities/)); await user.click(await screen.findByRole("switch", { name: "Streaming" })); await user.click(screen.getByRole("switch", { name: "Push Notifications" })); - await user.click(panel(/Optional Settings/)); + await user.click(await panel(/Optional Settings/)); await user.type(await screen.findByLabelText("Icon URL"), "https://example.com/icon.png"); - await user.click(panel(/Cost Configuration/)); + await user.click(await panel(/Cost Configuration/)); await user.type(await screen.findByLabelText("Cost Per Query ($)"), "0.25"); await user.type(screen.getByLabelText("Input Cost Per Token ($)"), "0.000002"); - await user.click(panel(/LiteLLM Parameters/)); + await user.click(await panel(/LiteLLM Parameters/)); await user.type(await screen.findByLabelText("Model (Optional)"), "gpt-4o"); await user.click(screen.getByRole("switch", { name: "Make Public" })); - await user.click(panel(/Authentication Headers/)); + await user.click(await panel(/Authentication Headers/)); await user.click(await screen.findByRole("button", { name: /Add Static Header/ })); await user.type(await screen.findByPlaceholderText("Header name (e.g. Authorization)"), "X-Tenant"); await user.type(screen.getByPlaceholderText("Value (e.g. Bearer token123)"), "acme"); @@ -176,9 +176,9 @@ describe("AddAgentForm submit payload", () => { await user.type(screen.getByLabelText("Display Name"), "Collapsed"); await user.type(screen.getByPlaceholderText("Describe what this agent does..."), "d"); - await user.click(panel(/Cost Configuration/)); + await user.click(await panel(/Cost Configuration/)); await user.type(await screen.findByLabelText("Cost Per Query ($)"), "0.75"); - await user.click(panel(/Cost Configuration/)); + await user.click(await panel(/Cost Configuration/)); await goToLastStepAndCreate(user); @@ -189,10 +189,10 @@ describe("AddAgentForm submit payload", () => { const user = userEvent.setup({ pointerEventsCheck: PointerEventsCheckLevel.Never }); renderForm(); - await user.click(panel(/Cost Configuration/)); + await user.click(await panel(/Cost Configuration/)); await user.type(await screen.findByLabelText("Cost Per Query ($)"), "0.75"); - await user.click(panel(/Cost Configuration/)); - await user.click(panel(/Cost Configuration/)); + await user.click(await panel(/Cost Configuration/)); + await user.click(await panel(/Cost Configuration/)); expect(await screen.findByLabelText("Cost Per Query ($)")).toHaveValue(0.75); }); diff --git a/ui/litellm-dashboard/vitest.config.ts b/ui/litellm-dashboard/vitest.config.ts index 469f7fa3520..7d8825909d8 100644 --- a/ui/litellm-dashboard/vitest.config.ts +++ b/ui/litellm-dashboard/vitest.config.ts @@ -19,7 +19,8 @@ const config: ViteUserConfig = { setupFiles: ["tests/setupTests.ts"], globals: true, css: true, // lets you import CSS/modules without extra mocks - testTimeout: 30000, + testTimeout: 60000, + hookTimeout: 30000, silent: process.env.CI ? "passed-only" : false, teardownTimeout: 60000, coverage: {