litellm/tests/e2e/ui
mubashir1osmani 370ec75b8a
Apply suggestions from code review
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-07-09 01:03:04 -04:00
..
.gitignore test(e2e): add Playwright UI suite for admin virtual-key creation 2026-07-08 22:09:16 -04:00
create-virtual-key.spec.ts Apply suggestions from code review 2026-07-09 01:03:04 -04:00
package-lock.json test(e2e): add Playwright UI suite for admin virtual-key creation 2026-07-08 22:09:16 -04:00
package.json test(e2e): add Playwright UI suite for admin virtual-key creation 2026-07-08 22:09:16 -04:00
playwright.config.ts test(e2e): add Playwright UI suite for admin virtual-key creation 2026-07-08 22:09:16 -04:00
README.md test(e2e): add Playwright UI suite for admin virtual-key creation 2026-07-08 22:09:16 -04:00
tsconfig.json test(e2e): add Playwright UI suite for admin virtual-key creation 2026-07-08 22:09:16 -04:00

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

  1. Install dependencies and the browser from this folder:

    npm install
    npm run install:browser
    
  2. Bring up a proxy (from tests/e2e/):

    docker compose up -d
    curl -fs http://localhost:4000/health/liveliness
    
  3. 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 (default http://localhost:4000)
  • LITELLM_MASTER_KEY (default sk-1234)
  • E2E_UI_ALLOWED_MODEL (default gemini-2.5-flash), the model the key is scoped to
  • E2E_UI_DENIED_MODEL (default gpt-5.5), a model outside the scope used to assert the denial