Skip to content

Commit 1ea368f

Browse files
test(web): acquire fake timers after mounting in the touch tablet focus test
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 4119d31 commit 1ea368f

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,19 @@ 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();
121119
await using _app = await openAtTabletSize(router);
122120
const composer = page.getByTestId("composer-editor");
123-
124-
// Focusing the editor raises the on-screen keyboard, which shrinks the page on iPadOS.
125121
await expect.element(page.getByText(`Answer 0 for ${first.id}.`)).toBeVisible();
126-
await expect.element(composer).toBeVisible();
127-
vi.advanceTimersToNextFrame();
128-
expect(document.activeElement).not.toBe(composer.element());
129122

123+
// Fake frames hold the next thread entry's focus frame until the test advances it.
124+
using _timers = fakeTimers();
130125
// The shell subscription outlives each render, so the sidebar lists only the first test's threads.
131126
router.history.push(`/${ENVIRONMENT_ID}/${second.id}`);
132127
await expect.element(page.getByText(`Answer 0 for ${second.id}.`)).toBeVisible();
128+
vi.advanceTimersToNextFrame();
129+
// Focusing the editor raises the on-screen keyboard, which shrinks the page on iPadOS.
130+
expect(document.activeElement).not.toBe(composer.element());
131+
133132
returnToWindow();
134133
expect(document.activeElement).not.toBe(composer.element());
135134
});

0 commit comments

Comments
 (0)