GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(web): attachment preview tests wait long enough for cold workers… · pingdotgg/t3code@cadbdaf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components/files
    • AttachmentFilePreview.browser.test.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
+18-11Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,8 +2154,10 @@ it("refreshes authorization and retries a failed streamed attachment", async ()
21542154
asset={{ environmentId: EnvironmentId.make("test"), attachmentId: "retry" }}
21552155
/>,
21562156
);
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 },
21592161
);
21602162
await act(() =>
21612163
screen.container.querySelector<HTMLButtonElement>('[role="alert"] button')!.click(),
@@ -2217,7 +2219,10 @@ it("copies every indexed line rather than the mounted preview rows", async () =>
22172219
<LargeTextViewer name="whole.txt" text={text} delimiter={null} copyContents={copyContents} />,
22182220
);
22192221
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+
});
22212226
const first = copyContents.current!();
22222227
await expect(copyContents.current!()).rejects.toThrow("Another copy is in progress.");
22232228
expect(await first).toBe(text);
@@ -2284,8 +2289,6 @@ it("loads a font attachment through the lazy preview", async () => {
22842289
const { default: fontUrl } =
22852290
await import("../../../node_modules/@betteroffice/fonts/assets/Carlito-Regular.ttf?url");
22862291
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")]);
22892292
await using screen = await render(
22902293
<AttachmentFilePreview
22912294
name="Carlito.ttf"
@@ -2294,12 +2297,16 @@ it("loads a font attachment through the lazy preview", async () => {
22942297
file={file}
22952298
/>,
22962299
);
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+
);
23032310
expect(screen.container.querySelector('[role="alert"]')).toBeNull();
23042311
});
23052312

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.