The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(ui): strengthen dashboard journey assertions
Yuneng Jiang8d1ca1665205
diff --git a/tests/e2e/ui/tests/prompts/addPrompt.spec.ts b/tests/e2e/ui/tests/prompts/addPrompt.spec.tsindex cd87e4d3b56..f9868f7b04b 100644--- a/tests/e2e/ui/tests/prompts/addPrompt.spec.ts+++ b/tests/e2e/ui/tests/prompts/addPrompt.spec.ts@@ -13,6 +13,7 @@ test.describe("Prompt upload form", () => {page,}) => {const promptId = `e2e-prompt-${uniqueSuffix()}`;+ const promptContent = "Hello {{name}}";await navigateToPage(page, DashboardPage.Prompts);await page.getByRole("button", { name: "Upload .prompt File" }).click();@@ -25,7 +26,7 @@ test.describe("Prompt upload form", () => {name: "e2e.prompt",mimeType: "text/plain",buffer: Buffer.from(- 'model: fake-openai-gpt-4\ntemplate: "Hello {{name}}"\n',+ `model: fake-openai-gpt-4\ntemplate: "${promptContent}"\n`,),});await expect(page.getByText("Selected: e2e.prompt")).toBeVisible();@@ -39,17 +40,22 @@ test.describe("Prompt upload form", () => {headers: { Authorization: `Bearer ${masterKey()}` },},);- return response.ok();+ if (!response.ok()) return undefined;+ const promptInfo = (await response.json()) as {+ raw_prompt_template?: { content?: string };+ };+ return promptInfo.raw_prompt_template?.content;})- .toBe(true);+ .toContain(promptContent);await expect(page.getByText(promptId, { exact: true })).toBeVisible();} finally {- await page.request.delete(+ const deleteResponse = await page.request.delete(`/prompts/${encodeURIComponent(promptId)}?environment=development`,{headers: { Authorization: `Bearer ${masterKey()}` },},);+ expect(deleteResponse.ok()).toBe(true);}});});diff --git a/tests/e2e/ui/tests/tagManagement/tagManagement.spec.ts b/tests/e2e/ui/tests/tagManagement/tagManagement.spec.tsindex 785211463dd..e1d5138ea90 100644--- a/tests/e2e/ui/tests/tagManagement/tagManagement.spec.ts+++ b/tests/e2e/ui/tests/tagManagement/tagManagement.spec.ts@@ -64,13 +64,14 @@ test.describe("Tag management", () => {}).toBe(updatedDescription);} finally {- await page.request.post("/tag/delete", {+ const deleteResponse = await page.request.post("/tag/delete", {headers: {Authorization: `Bearer ${masterKey()}`,"Content-Type": "application/json",},data: { name: tagName },});+ expect(deleteResponse.ok()).toBe(true);}});});diff --git a/ui/litellm-dashboard/src/components/shared/PaginatedSearchSelect.integration.test.tsx b/ui/litellm-dashboard/src/components/shared/PaginatedSearchSelect.integration.test.tsxindex 6d30f1513ef..905610a77e6 100644--- a/ui/litellm-dashboard/src/components/shared/PaginatedSearchSelect.integration.test.tsx+++ b/ui/litellm-dashboard/src/components/shared/PaginatedSearchSelect.integration.test.tsx@@ -421,27 +421,18 @@ describe("PaginatedSearchSelect", () => {}),enabled: query.length > 0,});- return (- <>- <button type="button" onClick={() => setQuery("A")}>- Search A- </button>- <button type="button" onClick={() => setQuery("B")}>- Search B- </button>- <PaginatedSearchSelect options={result.data ?? []} onValueChange={vi.fn()} onSearchChange={setQuery} />- </>- );+ return <PaginatedSearchSelect options={result.data ?? []} onValueChange={vi.fn()} onSearchChange={setQuery} />;}const user = userEvent.setup();render(<QueryBackedSelect />);- await user.click(screen.getByRole("button", { name: "Search A" }));- await user.click(screen.getByRole("button", { name: "Search B" }));- await waitFor(() => {- expect(pending.has("A")).toBe(true);- expect(pending.has("B")).toBe(true);- });+ const input = screen.getByRole("combobox");+ await user.click(input);+ await user.type(input, "A");+ await waitFor(() => expect(pending.has("A")).toBe(true));+ await user.clear(input);+ await user.type(input, "B");+ await waitFor(() => expect(pending.has("B")).toBe(true));pending.get("B")?.([{ label: "B result", value: "b" }]);await user.click(screen.getByRole("combobox"));diff --git a/ui/litellm-dashboard/src/components/shared/SearchSelect.integration.test.tsx b/ui/litellm-dashboard/src/components/shared/SearchSelect.integration.test.tsxindex ed83acef14a..9f320049b09 100644--- a/ui/litellm-dashboard/src/components/shared/SearchSelect.integration.test.tsx+++ b/ui/litellm-dashboard/src/components/shared/SearchSelect.integration.test.tsx@@ -112,7 +112,7 @@ describe("SearchSelect", () => {expect(onValueChange).not.toHaveBeenCalled();});- it("supports keyboard select, clear, escape, blur, and reopen", async () => {+ it("supports keyboard select, clear, and reselect", async () => {const onValueChange = vi.fn();const user = userEvent.setup();function Controlled() {@@ -139,9 +139,8 @@ describe("SearchSelect", () => {clear.focus();await user.keyboard("{Enter}");expect(onValueChange).toHaveBeenLastCalledWith(null);- await user.keyboard("{Escape}");- await user.tab();- await user.tab({ shift: true });- expect(input).toHaveFocus();+ input.focus();+ await user.keyboard("{Enter}{ArrowDown}{Enter}");+ expect(onValueChange).toHaveBeenLastCalledWith("team-1");});});