Adds a standalone Playwright (TypeScript) suite under tests/e2e/ui that drives the Admin UI in a real browser. The single spec logs in as the proxy admin, creates a virtual key scoped to one model through the create-key modal, then asserts both halves of the contract: /key/info reflects the alias and model the form set, and the generated key serves /chat/completions on its scoped model while being denied key_model_access_denied on a model outside that scope. The suite is decoupled from the Python harness in the sibling folders; it carries its own package.json and playwright.config.ts and runs with npm test.
1.8 KiB
Admin UI e2e (Playwright)
A standalone Playwright suite that drives the LiteLLM Admin UI in a real browser, separate from the Python harness in the sibling folders. It proves the flows a proxy admin actually clicks through, and cross-checks each one against the proxy API so a green test means the browser action really took effect on the server
The single spec here logs in as the proxy admin, creates a virtual key scoped to one model through the create-key modal, and then asserts both halves of the contract: /key/info reflects the alias and model the form set (the write persisted), and the generated key serves /chat/completions on its scoped model while being denied key_model_access_denied on a model outside that scope (the gateway enforces the scope)
Prerequisites
You need a running proxy that serves the UI on http://localhost:4000 (the repo's tests/e2e/docker-compose.yml brings one up with the gemini-2.5-flash and gpt-5.5 models this spec uses). The admin credentials are username admin and password = the proxy master key
Running
-
Install dependencies and the browser from this folder:
npm install npm run install:browser -
Bring up a proxy (from
tests/e2e/):docker compose up -d curl -fs http://localhost:4000/health/liveliness -
Run the suite:
npm test
Configuration
The base URL and credentials come from the environment so the same spec runs against localhost or a deployed proxy
LITELLM_PROXY_URL(defaulthttp://localhost:4000)LITELLM_MASTER_KEY(defaultsk-1234)E2E_UI_ALLOWED_MODEL(defaultgemini-2.5-flash), the model the key is scoped toE2E_UI_DENIED_MODEL(defaultgpt-5.5), a model outside the scope used to assert the denial