From 97794d62ed0184c28712c260abbfc4e326908906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dudak?= Date: Thu, 13 Jun 2024 13:24:34 +0200 Subject: [PATCH] Slow down the tests --- .../mui-base/src/Dialog/Root/DialogRoot.test.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/mui-base/src/Dialog/Root/DialogRoot.test.tsx b/packages/mui-base/src/Dialog/Root/DialogRoot.test.tsx index fd8c5cd595..a7cbb694a5 100644 --- a/packages/mui-base/src/Dialog/Root/DialogRoot.test.tsx +++ b/packages/mui-base/src/Dialog/Root/DialogRoot.test.tsx @@ -5,6 +5,14 @@ import { act, fireEvent } from '@mui/internal-test-utils'; import * as Dialog from '@base_ui/react/Dialog'; import { createRenderer } from '../../../test'; +async function wait(timeout: number) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, timeout); + }); +} + describe('', () => { const { render } = createRenderer(); @@ -147,7 +155,9 @@ describe('', () => { trigger.click(); }); - await act(() => async () => {}); + // wait for the focus to be settled (takes some time on CI) + await wait(50); + const dialogInput = getByTestId('dialog-input'); expect(dialogInput).to.toHaveFocus(); });