migrate e2e tests to ui directory

This commit is contained in:
yuneng-jiang 2025-12-29 12:00:03 -08:00
parent a1849a152c
commit 41fa2c0812
5 changed files with 39 additions and 14 deletions

View file

@ -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
- guardrails_testing

View file

@ -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",
});
});

View file

@ -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,

View file

@ -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.*/);
});

View file

@ -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": []
}