mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
Add a self-contained Playwright E2E test suite that runs against a local PostgreSQL database instead of Neon. Tests cover role-based access for all 5 user roles (proxy admin, admin viewer, internal user, internal viewer, team admin) and authentication flows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16 lines
829 B
TypeScript
16 lines
829 B
TypeScript
import { Page as PlaywrightPage, expect } from "@playwright/test";
|
|
import { users, Role } from "../constants";
|
|
|
|
export async function loginAs(page: PlaywrightPage, role: Role) {
|
|
const user = users[role];
|
|
await page.goto("/ui/login");
|
|
await page.getByPlaceholder("Enter your username").fill(user.email);
|
|
await page.getByPlaceholder("Enter your password").fill(user.password);
|
|
await page.getByRole("button", { name: "Login", exact: true }).click();
|
|
// Wait for navigation away from login page into the dashboard
|
|
await page.waitForURL((url) => url.pathname.startsWith("/ui") && !url.pathname.includes("/login"), {
|
|
timeout: 30_000,
|
|
});
|
|
// Wait for sidebar to render as a signal that the dashboard is ready
|
|
await expect(page.getByRole("menuitem", { name: "Virtual Keys" })).toBeVisible({ timeout: 30_000 });
|
|
}
|