test: de-flake ViewHeader connect/disconnect animation assertion (#1699)

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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5
This commit is contained in:
cliffhall 2026-07-24 12:27:24 -04:00
commit 444701c59b

View file

@ -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", () => {