Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/web/src/components/ChatView.agents.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
30 changes: 25 additions & 5 deletions apps/web/src/components/ChatView.panels.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,34 @@ 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<HTMLElement>("[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 !== 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 },
);
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 },
);
Expand Down
Loading