@@ -2154,8 +2154,10 @@ it("refreshes authorization and retries a failed streamed attachment", async () |
2154 | 2154 | asset={{ environmentId: EnvironmentId.make("test"), attachmentId: "retry" }} |
2155 | 2155 | />, |
2156 | 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 }, |
2159 | 2161 | ); |
2160 | 2162 | await act(() => |
2161 | 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 () => |
2217 | 2219 | <LargeTextViewer name="whole.txt" text={text} delimiter={null} copyContents={copyContents} />, |
2218 | 2220 | ); |
2219 | 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 | + }); |
2221 | 2226 | const first = copyContents.current!(); |
2222 | 2227 | await expect(copyContents.current!()).rejects.toThrow("Another copy is in progress."); |
2223 | 2228 | expect(await first).toBe(text); |
@@ -2284,8 +2289,6 @@ it("loads a font attachment through the lazy preview", async () => { |
2284 | 2289 | const { default: fontUrl } = |
2285 | 2290 | await import("../../../node_modules/@betteroffice/fonts/assets/Carlito-Regular.ttf?url"); |
2286 | 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")]); |
2289 | 2292 | await using screen = await render( |
2290 | 2293 | <AttachmentFilePreview |
2291 | 2294 | name="Carlito.ttf" |
@@ -2294,12 +2297,16 @@ it("loads a font attachment through the lazy preview", async () => { |
2294 | 2297 | file={file} |
2295 | 2298 | />, |
2296 | 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 | + ); |
2303 | 2310 | expect(screen.container.querySelector('[role="alert"]')).toBeNull(); |
2304 | 2311 | }); |
2305 | 2312 |
|
|