Skip to content

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]

test(ui): e2e cover team model edit + admin identity in navbar (#28652)

ryan-crabbe-berri7cae5dc08a04
diff --git a/ui/litellm-dashboard/e2e_tests/tests/login/login.spec.ts b/ui/litellm-dashboard/e2e_tests/tests/login/login.spec.ts
index 5d4b2508444..994d211cc18 100644
--- a/ui/litellm-dashboard/e2e_tests/tests/login/login.spec.ts
+++ b/ui/litellm-dashboard/e2e_tests/tests/login/login.spec.ts
@@ -10,4 +10,21 @@ test("user can log in", async ({ page }) => {
await expect(loginButton).toBeEnabled();
await loginButton.click();
await expect(page.getByText("Virtual Keys")).toBeVisible();
+
+ // Match the navbar account button by its stable aria-label (UserDropdown.tsx
+ // emits "Account menu — <role> — signed in as <email|id>"). Earlier this used
+ // `hasText: /^User$/`, which never matched the rendered button (text is
+ // displayName = "Account" for the master-key admin), so the trigger evaluate
+ // would time out in CI.
+ const userTrigger = page.locator('button[aria-label^="Account menu"]').first();
+ await userTrigger.click();
+
+ // Filter by the popupRender wrapper class to disambiguate from other
+ // ant-dropdown popups.
+ const popup = page.locator(".ant-dropdown:visible").filter({
+ has: page.locator(".bg-white.rounded-lg.shadow-lg"),
+ }).first();
+ await expect(popup).toBeVisible({ timeout: 5_000 });
+ await expect(popup.getByText("Admin", { exact: true })).toBeVisible({ timeout: 5_000 });
+ await expect(popup.getByText("default_user_id", { exact: true })).toBeVisible({ timeout: 5_000 });
});
diff --git a/ui/litellm-dashboard/e2e_tests/tests/proxy-admin/teams.spec.ts b/ui/litellm-dashboard/e2e_tests/tests/proxy-admin/teams.spec.ts
index a1864b22a43..6f6e8373390 100644
--- a/ui/litellm-dashboard/e2e_tests/tests/proxy-admin/teams.spec.ts
+++ b/ui/litellm-dashboard/e2e_tests/tests/proxy-admin/teams.spec.ts
@@ -131,4 +131,49 @@ test.describe("Proxy Admin - Teams", () => {
await expect(page.getByText(/updated|success/i).first()).toBeVisible({ timeout: 10_000 });
});
+
+ test("Edit team model selection", async ({ page, request }) => {
+ // Restore the seeded models via API in case a prior run (or a CI retry)
+ // left this team mutated — the assertion below requires fake-anthropic-claude
+ // to be present.
+ const masterKey = process.env.LITELLM_MASTER_KEY || "sk-1234";
+ const seededModels = ["fake-openai-gpt-4", "fake-anthropic-claude"];
+ const restore = async () => {
+ const res = await request.post("http://localhost:4000/team/update", {
+ headers: { Authorization: `Bearer ${masterKey}` },
+ data: { team_id: E2E_TEAM_CRUD_ID, models: seededModels },
+ });
+ expect(res.ok(), `restore failed: ${res.status()} ${await res.text()}`).toBeTruthy();
+ };
+ await restore();
+
+ try {
+ await navigateToPage(page, Page.Teams);
+ await dismissFeedbackPopup(page);
+
+ await clickTeamId(page, E2E_TEAM_CRUD_ID);
+
+ await page.getByRole("tab", { name: "Settings" }).click();
+ await page.getByRole("button", { name: "Edit Settings" }).click();
+
+ // Remove the anthropic tag — other tests against this team use "All Team
+ // Models" so they pick up whatever remains.
+ const modelsSelect = page.locator("[data-testid='models-select']");
+ await expect(modelsSelect).toBeVisible({ timeout: 10_000 });
+
+ const anthropicTag = modelsSelect
+ .locator(".ant-select-selection-item")
+ .filter({ hasText: "fake-anthropic-claude" });
+ await expect(anthropicTag).toBeVisible({ timeout: 5_000 });
+ await anthropicTag.locator(".ant-select-selection-item-remove").click();
+
+ await page.getByRole("button", { name: "Save Changes" }).click();
+
+ await expect(page.getByText(/Team settings updated|updated successfully/i).first())
+ .toBeVisible({ timeout: 10_000 });
+ } finally {
+ // Leave the team in its seeded state for any subsequent test or rerun.
+ await restore();
+ }
+ });
});