mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-13 22:23:04 +00:00
Fix flaky e2e tests by using regex selectors
The createKey test broke because the Models field changed from required to optional (PR #22826), removing the asterisk from the accessible name. The unauthenticated redirect test broke because the login URL now includes a redirect_to query param. Both selectors now use regex to be resilient to these kinds of changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
e8a7116899
commit
08e2ec3412
@@ -3,9 +3,8 @@ import { test, expect } from "@playwright/test";
|
||||
test.describe("Authentication Checks", () => {
|
||||
test("should redirect unauthenticated user from a protected page", async ({ page }) => {
|
||||
const protectedPageUrl = "http://localhost:4000/ui?page=llm-playground";
|
||||
const expectedRedirectUrl = "http://localhost:4000/ui/login/";
|
||||
await page.goto(protectedPageUrl, { waitUntil: "domcontentloaded" });
|
||||
await expect(page).toHaveURL(expectedRedirectUrl);
|
||||
await expect(page).toHaveURL(/\/ui\/login/);
|
||||
await expect(page.getByRole("heading", { name: "Login" })).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ test.describe("Create Key", () => {
|
||||
await page.getByTestId("base-input").fill("e2eUITestingCreateKeyAllTeamModels");
|
||||
await page.locator(".ant-select-selection-overflow").click();
|
||||
await page.getByText("All Team Models").click();
|
||||
await page.getByRole("combobox", { name: "* Models info-circle :" }).press("Escape");
|
||||
await page.getByRole("combobox", { name: /models/i }).press("Escape");
|
||||
await page.getByRole("button", { name: "Create Key" }).click();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(page.getByText("e2eUITestingCreateKeyAllTeamModels")).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user