diff --git a/tests/e2e/ui/tests/integrationCritical/mcpUserEnvVars.spec.ts b/tests/e2e/ui/tests/integrationCritical/mcpUserEnvVars.spec.ts index 11cc1c948a3..b37ff903121 100644 --- a/tests/e2e/ui/tests/integrationCritical/mcpUserEnvVars.spec.ts +++ b/tests/e2e/ui/tests/integrationCritical/mcpUserEnvVars.spec.ts @@ -380,15 +380,19 @@ test("clearing credentials for a server deleted underneath the modal reports the await openMcpServers(page); const card = cardFor(page, server); const dialog = credentialsDialog(page); + const clear = dialog.getByRole("button", { name: "Clear", exact: true }); await card.getByRole("button", { name: "Update", exact: true }).click(); - await expect(dialog).toBeVisible(); + await expect( + clear, + "the modal must load the saved credentials before the server is deleted", + ).toBeVisible(); await server.remove(); const cleared = page.waitForResponse( (response) => response.request().method() === "DELETE" && response.url().includes(server.statusUrl), ); - await dialog.getByRole("button", { name: "Clear", exact: true }).click(); + await clear.click(); await page .getByRole("alertdialog", { name: "Clear saved credentials" }) .getByRole("button", {