Skip to content

Commit 2b770c7

Browse files
committed
test: fix flaky participantAmountSelector and reservationTimer tests
Refs: LINK-2574
1 parent 0a97b05 commit 2b770c7

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/domain/signupGroup/participantAmountSelector/__tests__/ParticipantAmountSelector.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ test('should show modal if reserved seats are in waiting list', async () => {
8989
await user.type(participantAmountInput, '2');
9090
await user.click(updateParticipantAmountButton);
9191

92-
const modal = await screen.findByRole('dialog', {
93-
name: 'Olet ilmoittautumassa tapahtuman jonoon',
94-
});
92+
const modal = await screen.findByRole(
93+
'dialog',
94+
{ name: 'Olet ilmoittautumassa tapahtuman jonoon' },
95+
{ timeout: 5000 }
96+
);
9597

9698
await user.click(within(modal).getByRole('button', { name: 'Sulje' }));
9799

src/domain/signupGroup/reservationTimer/__tests__/ReservationTimer.test.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,21 @@ test('should show modal if reserved seats are in waiting list', async () => {
108108
});
109109
renderComponent();
110110

111-
const modal = await screen.findByRole('dialog', {
112-
name: 'Olet ilmoittautumassa tapahtuman jonoon',
113-
});
111+
const modalName = 'Olet ilmoittautumassa tapahtuman jonoon';
112+
113+
const modal = await screen.findByRole(
114+
'dialog',
115+
{ name: modalName },
116+
{ timeout: 5000 }
117+
);
114118

115119
await user.click(within(modal).getByRole('button', { name: 'Sulje' }));
116120

117-
await waitFor(() => expect(modal).not.toBeInTheDocument());
121+
await waitFor(() =>
122+
expect(
123+
screen.queryByRole('dialog', { name: modalName })
124+
).not.toBeInTheDocument()
125+
);
118126
});
119127

120128
test('should display reservation expiring modal if there is less than 60 seconds left', async () => {

0 commit comments

Comments
 (0)