From 3c0b1db63368c5660b3714641243d1124c4b7f8e Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Mon, 27 Jul 2026 18:11:18 -0700 Subject: [PATCH] test(e2e): realign Admin UI specs with the MCP dialog and keyless landing (#34870) Both specs assert against UI that has since moved, so they fail on selectors rather than on behavior. The MCP discovery modal became a shadcn/Base UI dialog when mcp-servers migrated off antd, so `.ant-modal` no longer matches it; locate it by its dialog role instead. The create form below it is still an antd Modal and keeps its existing locator. The no-team internal user has no keys, and a keyless non-admin is now sent to /ui/connect on the post-login landing, which has no sidebar. Wait for that redirect to settle, then navigate to the keys page explicitly; the redirect is gated on the ?login=success marker that the fresh navigation drops, so the dashboard sticks and the rest of the test is unchanged. --- .../e2e/ui/tests/internal-user/internalUserNoTeam.spec.ts | 8 ++++++-- tests/e2e/ui/tests/mcp/mcpServers.spec.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/e2e/ui/tests/internal-user/internalUserNoTeam.spec.ts b/tests/e2e/ui/tests/internal-user/internalUserNoTeam.spec.ts index 92e46d6b27c..3affa4d898d 100644 --- a/tests/e2e/ui/tests/internal-user/internalUserNoTeam.spec.ts +++ b/tests/e2e/ui/tests/internal-user/internalUserNoTeam.spec.ts @@ -1,5 +1,6 @@ import { test, expect } from "@playwright/test"; -import { dismissFeedbackPopup } from "../../helpers/navigation"; +import { navigateToPage } from "../../helpers/navigation"; +import { Page } from "../../fixtures/pages"; /** * Logs in fresh inside the test rather than reusing a stored session because @@ -16,9 +17,12 @@ test.describe("Internal User with no team memberships", () => { await page.getByPlaceholder("Enter your username").fill("noteam@test.local"); await page.getByPlaceholder("Enter your password").fill("test"); await page.getByRole("button", { name: "Login", exact: true }).click(); + // A non-admin with no keys lands on /ui/connect, so the keys dashboard has + // to be asked for explicitly once that redirect settles. + await page.waitForURL(/\/ui\/connect/, { timeout: 30_000 }); + await navigateToPage(page, Page.ApiKeys); // Scope to the sidebar; the top-bar breadcrumb also shows "Virtual Keys". await expect(page.getByRole("complementary").getByText("Virtual Keys")).toBeVisible({ timeout: 15_000 }); - await dismissFeedbackPopup(page); // Open the Create Key modal. await page.getByRole("button", { name: /Create New Key/i }).click(); diff --git a/tests/e2e/ui/tests/mcp/mcpServers.spec.ts b/tests/e2e/ui/tests/mcp/mcpServers.spec.ts index 7c4a7cb0568..37aabf9c057 100644 --- a/tests/e2e/ui/tests/mcp/mcpServers.spec.ts +++ b/tests/e2e/ui/tests/mcp/mcpServers.spec.ts @@ -16,7 +16,7 @@ test.describe("MCP Servers", () => { // Open the discovery modal, then drop into the custom-server form await page.getByRole("button", { name: /Add New MCP Server/i }).click(); - const discovery = page.locator(".ant-modal:visible").filter({ hasText: "Add MCP Server" }); + const discovery = page.getByRole("dialog").filter({ hasText: "Add MCP Server" }); await expect(discovery).toBeVisible({ timeout: 5_000 }); await discovery.getByRole("button", { name: /Custom Server/i }).click();