The best way to control Claude Code, Codex and more from any computer or phone
test(web): attachment preview tests wait long enough for cold workers and fonts (#26342)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 28, 2026 at 00:38 UTC
cadbdafc063e562626843aaea64553f791c890b4
1 file changed
+18
-11
apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
+18
-11
@@ -2154,8 +2154,10 @@ it("refreshes authorization and retries a failed streamed attachment", async ()
2154
asset={{ environmentId: EnvironmentId.make("test"), attachmentId: "retry" }}
2155
/>,
2156
);
2157
- await vi.waitFor(() =>
2158
- expect(screen.container.textContent).toContain("This file contains binary data."),
2157
+ // A cold large-text worker can take longer than waitFor's default to boot on CI.
2158
+ await vi.waitFor(
2159
+ () => expect(screen.container.textContent).toContain("This file contains binary data."),
2160
+ { timeout: 10_000 },
2161
);
2162
await act(() =>
2163
screen.container.querySelector<HTMLButtonElement>('[role="alert"] button')!.click(),
@@ -2217,7 +2219,10 @@ it("copies every indexed line rather than the mounted preview rows", async () =>
2219
<LargeTextViewer name="whole.txt" text={text} delimiter={null} copyContents={copyContents} />,
2220
);
2221
await vi.waitFor(() => expect(screen.container.textContent).toContain("line-0"));
2220
- await vi.waitFor(async () => expect(await copyContents.current!()).toBe(text));
2222
+ // Copy rejects until the worker finishes indexing, which a cold worker can delay past waitFor's default on CI.
2223
+ await vi.waitFor(async () => expect(await copyContents.current!()).toBe(text), {
2224
+ timeout: 10_000,
2225
+ });
2226
const first = copyContents.current!();
2227
await expect(copyContents.current!()).rejects.toThrow("Another copy is in progress.");
2228
expect(await first).toBe(text);
@@ -2284,8 +2289,6 @@ it("loads a font attachment through the lazy preview", async () => {
2289
const { default: fontUrl } =
2290
await import("../../../node_modules/@betteroffice/fonts/assets/Carlito-Regular.ttf?url");
2291
const file = await (await fetch(fontUrl)).blob();
2287
- // Both lazy chunks can take longer than waitFor allows to load cold on CI.
2288
- await Promise.all([import("./FontFilePreview"), import("./FontViewer")]);
2292
await using screen = await render(
2293
<AttachmentFilePreview
2294
name="Carlito.ttf"
@@ -2294,12 +2297,16 @@ it("loads a font attachment through the lazy preview", async () => {
2297
file={file}
2298
/>,
2299
);
2297
- await vi.waitFor(() => {
2298
- const frame = screen.container.querySelector("iframe");
2299
- expect(frame?.title).toBe("Carlito.ttf");
2300
- expect(frame?.srcdoc).toContain("@font-face");
2301
- expect(frame?.srcdoc).toContain("The quick brown fox");
2302
- });
2300
+ // Two cold lazy chunks plus decoding a 600 KB font can take longer than waitFor's default on CI.
2301
+ await vi.waitFor(
2302
+ () => {
2303
+ const frame = screen.container.querySelector("iframe");
2304
+ expect(frame?.title).toBe("Carlito.ttf");
2305
+ expect(frame?.srcdoc).toContain("@font-face");
2306
+ expect(frame?.srcdoc).toContain("The quick brown fox");
2307
+ },
2308
+ { timeout: 10_000 },
2309
+ );
2310
expect(screen.container.querySelector('[role="alert"]')).toBeNull();
2311
});
2312