The best way to control Claude Code, Codex and more from any computer or phone
test(web): Mermaid rejection test waits for the viewer chunk to load (#35586)
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Theo Browne committed
Nov 12, 2026 at 12:19 UTC
d8f3feff0c1749ca020941427b153005755baca6
1 file changed
+7
-4
apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
+7
-4
@@ -931,10 +931,13 @@ describe("standalone Mermaid previews", () => {
931
.spyOn(HTMLImageElement.prototype, "src", "set")
932
.mockImplementation(() => {});
933
await using screen = await render(<MermaidFilePreview text={`flowchart LR\n${node}`} />);
934
- await vi.waitFor(() =>
935
- expect(screen.container.querySelector('[role="alert"]')?.textContent).toContain(
936
- "Show Mermaid source",
937
- ),
934
+ // The first case loads the Mermaid viewer chunk, which can take over a second on a slow runner.
935
+ await vi.waitFor(
936
+ () =>
937
+ expect(screen.container.querySelector('[role="alert"]')?.textContent).toContain(
938
+ "Show Mermaid source",
939
+ ),
940
+ { timeout: 10_000 },
941
);
942
expect(imageSource).not.toHaveBeenCalled();
943
expect(screen.container.querySelector("svg")).toBeNull();