From 815818f5a135a6a14e1738e210ef71db4044f124 Mon Sep 17 00:00:00 2001 From: Badcuban <108198679+badcuban@users.noreply.github.com> Date: Fri, 20 Nov 2026 16:37:58 -0500 Subject: [PATCH 1/2] test(web): steady the room-pills and panel-swipe tests on busy CI machines The room-pills test focused a pill while the model picker's last search-box focus retries (one frame, one tick) were still pending; on a busy machine they ran after and took the arrow key. It now lets them pass first. Reproduced by holding those retries until after the pill was focused. The panel-swipe test swiped an element it had looked up before the tab reorder above finished re-rendering. It now swipes the panel as it is just then, once the point under the finger is the panel's, and names what it found if the swipe still doesn't close it. Not reproduced locally; inferred. --- .../components/ChatView.agents.browser.tsx | 5 ++++ .../components/ChatView.panels.browser.tsx | 29 +++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/ChatView.agents.browser.tsx b/apps/web/src/components/ChatView.agents.browser.tsx index d00656693..d3ec5c61c 100644 --- a/apps/web/src/components/ChatView.agents.browser.tsx +++ b/apps/web/src/components/ChatView.agents.browser.tsx @@ -584,6 +584,11 @@ describe("ChatView (full app): agent browser tabs and rooms", () => { // One tab stop for the group; the arrow keys move along it and pick. expect(pill(astraId)?.tabIndex).toBe(0); expect(pill("primary")?.tabIndex).toBe(-1); + // The picker focuses its search box once more a frame and a tick after it + // (re)renders; on a busy machine that lands late. Let those pass first, + // or they pull focus off the pill before the arrow key. + await nextFrames(2); + await new Promise((resolve) => setTimeout(resolve, 0)); pill(astraId)!.focus(); await userEvent.keyboard("{ArrowLeft}"); await vi.waitFor(() => { diff --git a/apps/web/src/components/ChatView.panels.browser.tsx b/apps/web/src/components/ChatView.panels.browser.tsx index e259162c8..2d285752f 100644 --- a/apps/web/src/components/ChatView.panels.browser.tsx +++ b/apps/web/src/components/ChatView.panels.browser.tsx @@ -688,14 +688,33 @@ describe("ChatView (full app): right panel and header actions", () => { expect(railToggle.hasAttribute("data-pressed")).toBe(true); // A finger pushing the panel toward its edge closes it, as the toggle would. - const agentsPanel = await waitForElement( - () => document.querySelector("[data-agents-panel='tree']") as HTMLElement | null, - "The agents tab never opened.", + // The swipe goes to the panel as it is now: the tab reorder above can + // re-render it late on a busy machine, and a swipe on the element it + // replaced, or on a point something else still covers, reaches no drawer. + const swipeTarget = await vi.waitFor( + () => { + const panel = document.querySelector("[data-agents-panel='tree']"); + expect(panel, "The agents tab never opened.").not.toBeNull(); + const rect = panel!.getBoundingClientRect(); + const underFinger = document.elementFromPoint( + rect.left + rect.width * 0.75, + rect.top + rect.height / 2, + ); + expect( + underFinger?.closest('[data-slot="drawer-popup"]'), + "Something other than the panel is under the finger.", + ).not.toBeNull(); + return panel!; + }, + { timeout: 8_000, interval: 16 }, ); - touchSwipe(agentsPanel, 260); + touchSwipe(swipeTarget, 260); await vi.waitFor( () => { - expect(railToggle.hasAttribute("data-pressed")).toBe(false); + expect( + railToggle.hasAttribute("data-pressed"), + `The swipe did not close the panel (swiped element still on the page: ${swipeTarget.isConnected}).`, + ).toBe(false); }, { timeout: 8_000, interval: 16 }, ); From 33a2b42e96abea65e04f378258695037c42f71d1 Mon Sep 17 00:00:00 2001 From: Badcuban <108198679+badcuban@users.noreply.github.com> Date: Fri, 20 Nov 2026 16:40:39 -0500 Subject: [PATCH 2/2] test(web): the panel swipe starts on what is really under the finger A missing hit passed the check, and the gesture went to the panel by reference. The element under the finger must now be inside the agents panel, and the swipe starts on it. --- apps/web/src/components/ChatView.panels.browser.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/ChatView.panels.browser.tsx b/apps/web/src/components/ChatView.panels.browser.tsx index 2d285752f..88e196c32 100644 --- a/apps/web/src/components/ChatView.panels.browser.tsx +++ b/apps/web/src/components/ChatView.panels.browser.tsx @@ -701,10 +701,11 @@ describe("ChatView (full app): right panel and header actions", () => { rect.top + rect.height / 2, ); expect( - underFinger?.closest('[data-slot="drawer-popup"]'), - "Something other than the panel is under the finger.", - ).not.toBeNull(); - return panel!; + underFinger !== null && panel!.contains(underFinger), + "Something other than the agents panel is under the finger.", + ).toBe(true); + // The finger lands on what is really there, not on the panel by reference. + return underFinger as HTMLElement; }, { timeout: 8_000, interval: 16 }, );