litellm/tests/e2e/ui/playwright.config.ts
ryan-crabbe-berri 871629e8f3 test(e2e): run the UI Playwright suite against the shared e2e gateway
The suite now targets LITELLM_PROXY_URL (default http://localhost:4000),
the same live gateway the python e2e suites use, instead of provisioning
its own postgres, mock LLM server and SQL-seeded proxy. globalSetup seeds
every e2e-* user, team, org, key and model deployment through the
management API with the master key, so any gateway with a master key and
store_model_in_db works; seed.sql and the mock LLM server are gone. The
two deployments (e2e-ui-openai, e2e-ui-anthropic) route to real providers
per the harness's no-mocks rule, and the key creation spec now asserts a
real completion instead of the mock's canned body.

Seeding is idempotent against a persistent gateway: teardown deletes
per-entity (batch deletes are all-or-nothing and one missing id used to
strand every other row), the modelHub spec resets the public model groups
list it fills, and the MCP spec purges its dead-URL servers whose failing
health checks kept networkidle navigation from settling on reruns. Both
Playwright configs pin workers: 1 since several specs mutate global
gateway state; the suite documents that it needs the gateway to itself
while it runs.

Two specs are also caught up with UI refactors that had moved their
buttons into dropdown menus (key deletion under "More key actions",
credential editing under the row's actions menu).

run_e2e.sh keeps a provisioning mode for CI and machines with no gateway,
and skips provisioning entirely when LITELLM_PROXY_URL is set. The
CircleCI jobs drop their seed and mock-server steps; the mock server's
removal also lets tests/e2e/ui leave the basedpyright exclude list.
2026-07-21 18:17:01 -07:00

54 lines
1.8 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: ".",
testMatch: ["**/*.spec.ts", "**/*.setup.ts"],
testIgnore: ["**/*.test.*"],
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* One worker everywhere: several specs mutate global gateway state
(router_settings, public model groups), so parallel workers race each
other against the single shared gateway. */
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.LITELLM_PROXY_URL ?? "http://localhost:4000",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
/* Action timeout for clicks, fills, waitForSelector, etc. */
actionTimeout: 15 * 1000,
navigationTimeout: 30 * 1000,
/* Slow down actions when SLOWMO=<ms> is set, useful for headed local debugging */
launchOptions: {
slowMo: process.env.SLOWMO ? parseInt(process.env.SLOWMO, 10) || 0 : 0,
},
},
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
/* Timeout settings */
timeout: 3 * 60 * 1000,
expect: {
timeout: 10 * 1000,
},
globalSetup: require.resolve("./globalSetup"),
});