Ensured menu is displayed before asserting in DateRangeSelector test

This commit is contained in:
Alejandro Celaya 2022-08-07 12:59:04 +02:00
parent a3ab2c6e1b
commit c490835f9b

View file

@ -1,4 +1,4 @@
import { screen } from '@testing-library/react'; import { screen, waitFor } from '@testing-library/react';
import { Mock } from 'ts-mockery'; import { Mock } from 'ts-mockery';
import { DateRangeSelector, DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector'; import { DateRangeSelector, DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector';
import { DateInterval } from '../../../src/utils/dates/types'; import { DateInterval } from '../../../src/utils/dates/types';
@ -16,6 +16,7 @@ describe('<DateRangeSelector />', () => {
); );
await result.user.click(screen.getByRole('button')); await result.user.click(screen.getByRole('button'));
await waitFor(() => screen.getByRole('menu'));
return result; return result;
}; };