mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-17 09:34:48 +00:00
Merge 07780b24a6 into ebf829c2fa
This commit is contained in:
commit
51303fc21e
2 changed files with 46 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { Page } from "../fixtures/pages";
|
||||
import { Page as PlaywrightPage, expect } from "@playwright/test";
|
||||
import { UI_BASE_URL } from "../constants";
|
||||
import { ARIA_AGENT_LABEL } from "../../../../ui/litellm-dashboard/src/components/liteadmin/aria-brand";
|
||||
|
||||
export const sidebarLink = (page: PlaywrightPage, name: string | RegExp) =>
|
||||
page.getByRole("complementary").getByRole("link", { name, exact: true });
|
||||
|
|
@ -66,14 +67,25 @@ export async function hideLiteAdmin(page: PlaywrightPage): Promise<void> {
|
|||
await page.getByRole("button", { name: /Account menu/i }).click();
|
||||
const panel = page.getByTestId("sidebar-account-menu-panel");
|
||||
await expect(panel).toBeVisible({ timeout: 5_000 });
|
||||
const toggle = panel.getByRole("switch", { name: "Toggle hide LiteAdmin" });
|
||||
const toggle = panel.getByRole("switch", {
|
||||
name: `Toggle hide ${ARIA_AGENT_LABEL}`,
|
||||
exact: true,
|
||||
});
|
||||
if ((await toggle.getAttribute("aria-checked")) !== "true") {
|
||||
await toggle.click();
|
||||
}
|
||||
await expect(toggle).toHaveAttribute("aria-checked", "true");
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(panel).toBeHidden();
|
||||
await expect(page.getByRole("button", { name: "LiteAdmin", exact: true })).toBeHidden();
|
||||
await expect(
|
||||
page.getByRole("button", { name: ARIA_AGENT_LABEL, exact: true }),
|
||||
).toBeHidden();
|
||||
await expect(
|
||||
page.getByRole("button", {
|
||||
name: `Launch ${ARIA_AGENT_LABEL}`,
|
||||
exact: true,
|
||||
}),
|
||||
).toBeHidden();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import {
|
|||
clickSidebarLink,
|
||||
dismissFeedbackPopup,
|
||||
expectUiRoute,
|
||||
hideLiteAdmin,
|
||||
navigateToPage,
|
||||
sidebarLink,
|
||||
} from "../../helpers/navigation";
|
||||
import { MIGRATED_E2E_PAGES } from "../../fixtures/migratedPages";
|
||||
import type { Page as PlaywrightPage } from "@playwright/test";
|
||||
import { ARIA_AGENT_LABEL } from "../../../../../ui/litellm-dashboard/src/components/liteadmin/aria-brand";
|
||||
|
||||
const sidebarButtons = {
|
||||
[Role.ProxyAdmin]: [
|
||||
|
|
@ -42,6 +44,36 @@ for (const { role, storage } of roles) {
|
|||
test.describe(`${role} sidebar`, () => {
|
||||
test.use({ storageState: storage });
|
||||
|
||||
test("should hide the assistant launcher and keep it hidden on repeated setup", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/ui/");
|
||||
await dismissFeedbackPopup(page);
|
||||
await page.getByRole("button", { name: /Account menu/i }).click();
|
||||
const panel = page.getByTestId("sidebar-account-menu-panel");
|
||||
const toggle = panel.getByRole("switch", {
|
||||
name: `Toggle hide ${ARIA_AGENT_LABEL}`,
|
||||
exact: true,
|
||||
});
|
||||
await expect(toggle).toHaveAttribute("aria-checked", "true");
|
||||
await toggle.click();
|
||||
await expect(toggle).toHaveAttribute("aria-checked", "false");
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(panel).toBeHidden();
|
||||
|
||||
const launcher = page.getByRole("button", {
|
||||
name: `Launch ${ARIA_AGENT_LABEL}`,
|
||||
exact: true,
|
||||
});
|
||||
await expect(launcher).toBeVisible();
|
||||
|
||||
await hideLiteAdmin(page);
|
||||
await expect(launcher).toBeHidden();
|
||||
|
||||
await hideLiteAdmin(page);
|
||||
await expect(launcher).toBeHidden();
|
||||
});
|
||||
|
||||
test("should navigate to correct URL when clicking sidebar menu items from homepage", async ({ page }) => {
|
||||
await page.goto("/ui");
|
||||
await page.evaluate(() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue