Skip to content

Commit a906df9

Browse files
committed
test: fix flaky combobox test
Refs: LINK-2581
1 parent 69074b2 commit a906df9

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/domain/event/formSections/classificationSection/__tests__/ClassificationSection.test.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Formik } from 'formik';
44
import getValue from '../../../../../utils/getValue';
55
import { mockAuthenticatedLoginState } from '../../../../../utils/mockLoginHooks';
66
import {
7+
cleanup,
78
configure,
89
render,
910
screen,
@@ -46,6 +47,7 @@ import ClassificationSection from '../ClassificationSection';
4647
configure({ defaultHidden: true });
4748

4849
afterEach(() => {
50+
cleanup();
4951
vi.resetAllMocks();
5052
});
5153

@@ -263,12 +265,16 @@ test('should change keyword', async () => {
263265
await user.click(keywordOption);
264266
await user.keyboard('{Escape}');
265267

266-
await screen.findByRole('button', {
267-
name: new RegExp(
268-
`1 valittu vaihtoehto.*${getValue(keyword?.name?.fi, '')}`,
269-
'i'
270-
),
271-
});
268+
await screen.findByRole(
269+
'button',
270+
{
271+
name: new RegExp(
272+
`1 valittu vaihtoehto.*${getValue(keyword?.name?.fi, '')}`,
273+
'i'
274+
),
275+
},
276+
{ timeout: 5000 }
277+
);
272278
});
273279

274280
test('should show correct validation error if none main category is selected', async () => {

0 commit comments

Comments
 (0)