Skip to content

Commit 4119d31

Browse files
test(web): hold the first thread's focus frame before asserting on touch tablets
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 695bacd commit 4119d31

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎apps/web/src/components/ChatView.browser.test.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,17 @@ it("opening a thread or returning to the window on a touch tablet does not focus
116116
const router = getRouter(
117117
createMemoryHistory({ initialEntries: [`/${ENVIRONMENT_ID}/${first.id}`] }),
118118
);
119+
// Fake frames hold each thread entry's focus frame until the test advances it.
120+
using _timers = fakeTimers();
119121
await using _app = await openAtTabletSize(router);
120122
const composer = page.getByTestId("composer-editor");
121123

122124
// Focusing the editor raises the on-screen keyboard, which shrinks the page on iPadOS.
123125
await expect.element(page.getByText(`Answer 0 for ${first.id}.`)).toBeVisible();
124126
await expect.element(composer).toBeVisible();
125-
await expect.element(composer).not.toHaveFocus();
127+
vi.advanceTimersToNextFrame();
128+
expect(document.activeElement).not.toBe(composer.element());
126129

127-
// Fake frames hold the thread switch's focus frame until returnToWindow runs it.
128-
using _timers = fakeTimers();
129130
// The shell subscription outlives each render, so the sidebar lists only the first test's threads.
130131
router.history.push(`/${ENVIRONMENT_ID}/${second.id}`);
131132
await expect.element(page.getByText(`Answer 0 for ${second.id}.`)).toBeVisible();

0 commit comments

Comments
 (0)