From 3c96943db3b1bf73726f2a04e55f7c79f74dd6db Mon Sep 17 00:00:00 2001 From: David Luzar <5153846+dwelle@users.noreply.github.com> Date: Tue, 7 Nov 2023 18:06:15 +0100 Subject: [PATCH] test: fix mermaid test flake (#7249) --- src/tests/MermaidToExcalidraw.test.tsx | 4 ++-- src/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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]
" `;