Files
litellm/ui/litellm-dashboard/e2e_tests/tests/keys/createKey.spec.ts
T
yuneng-jiangandClaude Opus 4.6 08e2ec3412 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>
2026-03-07 16:43:33 -08:00

23 lines
1.1 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { ADMIN_STORAGE_PATH } from "../../constants";
import { Page } from "../../fixtures/pages";
import { navigateToPage } from "../../helpers/navigation";
test.describe("Create Key", () => {
test.use({ storageState: ADMIN_STORAGE_PATH });
test("Able to create a key with all team models", async ({ page }) => {
await navigateToPage(page, Page.ApiKeys);
await expect(page.getByRole("button", { name: "Next" })).toBeVisible();
await page.getByRole("button", { name: "+ Create New Key" }).click();
await page.getByTestId("base-input").click();
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/i }).press("Escape");
await page.getByRole("button", { name: "Create Key" }).click();
await page.keyboard.press("Escape");
await expect(page.getByText("e2eUITestingCreateKeyAllTeamModels")).toBeVisible();
});
});