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]

migrate e2e tests to ui directory

yuneng-jiang41fa2c0812d8
diff --git a/.circleci/config.yml b/.circleci/config.yml
index e30dc02b2ab..b1bee9675f3 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -3515,7 +3515,7 @@ jobs:
- run:
name: Run Playwright Tests
command: |
- npx playwright test e2e_ui_tests/ --reporter=html --output=test-results
+ cd ui/litellm-dashboard && npm run e2e
no_output_timeout: 120m
- store_artifacts:
path: test-results
@@ -3973,4 +3973,4 @@ workflows:
- proxy_pass_through_endpoint_tests
- check_code_and_doc_quality
- publish_proxy_extras
- - guardrails_testing
\ No newline at end of file
+ - guardrails_testing
diff --git a/ui/litellm-dashboard/e2e_tests/auth/login.setup.ts b/ui/litellm-dashboard/e2e_tests/auth/login.setup.ts
new file mode 100644
index 00000000000..712191f6843
--- /dev/null
+++ b/ui/litellm-dashboard/e2e_tests/auth/login.setup.ts
@@ -0,0 +1,20 @@
+import { test, expect } from "@playwright/test";
+
+test("login and save auth state", async ({ page }) => {
+ await page.goto("http://localhost:4000/ui");
+
+ await page.getByPlaceholder("Enter your username").fill("admin");
+ await page.getByPlaceholder("Enter your password").fill("gm");
+
+ const loginButton = page.getByRole("button", { name: "Login" });
+ await expect(loginButton).toBeEnabled();
+ await loginButton.click();
+
+ // Assert successful login (important)
+ await expect(page.getByText("AI Gateway")).toBeVisible();
+
+ // 🔐 Save auth state
+ await page.context().storageState({
+ path: "storageState.json",
+ });
+});
diff --git a/ui/litellm-dashboard/e2e_tests/playwright.config.ts b/ui/litellm-dashboard/e2e_tests/playwright.config.ts
index cce416075f4..5ab68b3534f 100644
--- a/ui/litellm-dashboard/e2e_tests/playwright.config.ts
+++ b/ui/litellm-dashboard/e2e_tests/playwright.config.ts
@@ -4,8 +4,8 @@ import { defineConfig, devices } from "@playwright/test";
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
- testDir: "./tests",
- testMatch: "**/*.spec.ts",
+ testDir: ".",
+ testMatch: ["**/*.spec.ts", "**/*.setup.ts"],
testIgnore: ["**/*.test.*"],
/* Run tests in files in parallel */
fullyParallel: true,
diff --git a/ui/litellm-dashboard/e2e_tests/tests/basic.spec.ts b/ui/litellm-dashboard/e2e_tests/tests/basic.spec.ts
deleted file mode 100644
index 9e990f60866..00000000000
--- a/ui/litellm-dashboard/e2e_tests/tests/basic.spec.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { test, expect } from "@playwright/test";
-
-test("basic test to verify playwright setup", async ({ page }) => {
- // Navigate to the base URL
- await page.goto("/");
-
- // Wait for the page to load and check if we can find some basic content
- // This is a very basic test just to verify the setup works
- await expect(page).toHaveTitle(/.*LiteLLM.*/);
-});
diff --git a/ui/litellm-dashboard/storageState.json b/ui/litellm-dashboard/storageState.json
new file mode 100644
index 00000000000..f2f012b34f8
--- /dev/null
+++ b/ui/litellm-dashboard/storageState.json
@@ -0,0 +1,15 @@
+{
+ "cookies": [
+ {
+ "name": "token",
+ "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZGVmYXVsdF91c2VyX2lkIiwia2V5Ijoic2stUkJVZGFncVZuY0VWMDNVdnNDZkstdyIsInVzZXJfZW1haWwiOm51bGwsInVzZXJfcm9sZSI6InByb3h5X2FkbWluIiwibG9naW5fbWV0aG9kIjoidXNlcm5hbWVfcGFzc3dvcmQiLCJwcmVtaXVtX3VzZXIiOnRydWUsImF1dGhfaGVhZGVyX25hbWUiOiJBdXRob3JpemF0aW9uIiwiZGlzYWJsZWRfbm9uX2FkbWluX3BlcnNvbmFsX2tleV9jcmVhdGlvbiI6ZmFsc2UsInNlcnZlcl9yb290X3BhdGgiOiIvIn0.aW_1-qDI9HuZvDq53ufTX_HrE6EJ7XSCPBb-N136KjQ",
+ "domain": "localhost",
+ "path": "/",
+ "expires": -1,
+ "httpOnly": false,
+ "secure": false,
+ "sameSite": "Lax"
+ }
+ ],
+ "origins": []
+}
\ No newline at end of file