Skip to content

Commit

Permalink
Slow down the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak committed Jun 13, 2024
1 parent d5dbeb2 commit 97794d6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/mui-base/src/Dialog/Root/DialogRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((resolve) => {
setTimeout(() => {
resolve();
}, timeout);
});
}

describe('<Dialog.Root />', () => {
const { render } = createRenderer();

Expand Down Expand Up @@ -147,7 +155,9 @@ describe('<Dialog.Root />', () => {
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();
});
Expand Down

0 comments on commit 97794d6

Please sign in to comment.