The best way to control Claude Code, Codex and more from any computer or phone
test(web): fix flaky attachment preview and ACP search tests (#21893)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 19, 2026 at 12:47 UTC
f740a97947cc701859040e530e7fe07b96d02ae5
2 files changed
+4
-2
apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
+2
-2
@@ -10,8 +10,8 @@ vi.mock(import("~/assets/assetUrls"), async (original) => ({
10
useAssetUrlRefresh: () => refresh,
11
}));
12
// The real source view highlights through a worker pool; the text it receives is what matters here.
13
-vi.mock(import("./ReadOnlySourcePreview"), async (original) => ({
14
- ...(await original()),
13
+// Never load the original: its highlighter graph can outlast waitFor on a cold CI browser.
14
+vi.mock(import("./ReadOnlySourcePreview"), () => ({
15
default: ({ text }: { text: string }) => <pre>{text}</pre>,
16
}));
17
apps/web/src/components/settings/AcpRegistrySearchStep.browser.test.tsx
+2
@@ -163,6 +163,8 @@ it("shows the loading, error, and empty states", async () => {
163
164
it("submits a typed query at once and refreshes when the same query is submitted again", async () => {
165
await render();
166
+ // A slow runner must not let the typing debounce submit the query before Enter does.
167
+ vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout"] });
168
await userEvent.fill(searchBox(), "Codex");
169
await userEvent.keyboard("{Enter}");
170
expect(lastQuery()).toBe("Codex");