diff --git a/src/tests/MermaidToExcalidraw.test.tsx b/src/tests/MermaidToExcalidraw.test.tsx
index e6330d3c..fc3cb8f3 100644
--- a/src/tests/MermaidToExcalidraw.test.tsx
+++ b/src/tests/MermaidToExcalidraw.test.tsx
@@ -1,4 +1,4 @@
-import { act, fireEvent, render } from "./test-utils";
+import { act, fireEvent, render, waitFor } from "./test-utils";
import { Excalidraw } from "../packages/excalidraw/index";
import React from "react";
import { expect, vi } from "vitest";
@@ -111,7 +111,7 @@ describe("Test ", () => {
it("should open mermaid popup when active tool is mermaid", async () => {
const dialog = document.querySelector(".dialog-mermaid")!;
-
+ await waitFor(() => dialog.querySelector("canvas"));
expect(dialog.outerHTML).toMatchSnapshot();
});
diff --git a/src/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap b/src/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap
index a716d267..3cdf25af 100644
--- a/src/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap
+++ b/src/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap
@@ -6,5 +6,5 @@ exports[`Test > should open mermaid popup when active too
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
- C -->|Three| F[Car]
"
+ C -->|Three| F[Car]"
`;