From 444701c59b84732163d70d3b55b13fa7f8ce70b5 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Fri, 24 Jul 2026 12:27:24 -0400 Subject: [PATCH] test: de-flake ViewHeader connect/disconnect animation assertion (#1699) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The server name and Disconnect button are removed by two independent Mantine Transition exits. The test waitFor'd the server-name removal, then did a synchronous queryByRole check for the button — on a slow runner the button's exit lags the name's, so it was still in the DOM at the check. Wrap the button "removed" assertion in its own waitFor. Part 2 of #1699 (TUI OAuth step-up) was already fixed in PR #1742 via POLL_TRIES=100. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 --- .../components/groups/ViewHeader/ViewHeader.test.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/clients/web/src/components/groups/ViewHeader/ViewHeader.test.tsx b/clients/web/src/components/groups/ViewHeader/ViewHeader.test.tsx index 04d18b56..717557b1 100644 --- a/clients/web/src/components/groups/ViewHeader/ViewHeader.test.tsx +++ b/clients/web/src/components/groups/ViewHeader/ViewHeader.test.tsx @@ -355,12 +355,18 @@ describe("ViewHeader", () => { ?.getAttribute("data-anim"), ).toBe("out"); + // The server name and the Disconnect button are removed by two + // independent Transition exits; on a slow runner the button's exit can + // lag the name's, so each "removed" assertion gets its own waitFor rather + // than assuming the two transitions complete in lockstep (#1699). await waitFor(() => expect(screen.queryByText("my-mcp-server")).not.toBeInTheDocument(), ); - expect( - screen.queryByRole("button", { name: "Disconnect from server" }), - ).not.toBeInTheDocument(); + await waitFor(() => + expect( + screen.queryByRole("button", { name: "Disconnect from server" }), + ).not.toBeInTheDocument(), + ); }); it("renders the dark-scheme icon/logo branch under a dark color scheme", () => {