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.
This commit is contained in:
yuneng-jiang 2026-07-27 18:11:18 -07:00 • committed by GitHub
parent 5c95017bc1
commit 3c0b1db633
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -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();

View file

@ -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();