From 3f4297e6506ed978406aafaf9c0d392c58f0a0b6 Mon Sep 17 00:00:00 2001 From: Badcuban <108198679+badcuban@users.noreply.github.com> Date: Sun, 2 Aug 2026 20:16:18 -0400 Subject: [PATCH] Make palette test clicks truly atomic --- apps/web/src/components/ChatView.browser.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/ChatView.browser.tsx b/apps/web/src/components/ChatView.browser.tsx index c868dd49..d9966c00 100644 --- a/apps/web/src/components/ChatView.browser.tsx +++ b/apps/web/src/components/ChatView.browser.tsx @@ -1932,21 +1932,22 @@ async function waitForCommandPaletteInput(placeholder: string): Promise { - const action = await waitForElement(() => { + await waitForElement(() => { const palette = document.querySelector('[data-testid="command-palette"]'); if (!palette) return null; - return ( + const action = Array.from(palette.querySelectorAll('[data-slot="command-item"]')).find((item) => Array.from(item.querySelectorAll("span")).some( (content) => content.textContent?.trim() === label, ), - ) ?? null - ); + ) ?? null; + if (!action) return null; + action.click(); + return action; }, `Command palette action "${label}" did not render.`); // Dispatch in the same browser task that located the row. Async palette // refreshes may replace result nodes between Playwright's actionability // checks even though the action itself remains continuously available. - action.click(); await waitForLayout(); }