Remove user action from waitFor in stories (#11588)

As per title:
- waitFor is a loop that waits for a condition to be filled, it should
be use to expect or in rare case to wait for element to be present in
the page (in most cases, you can use findByXXX)
- user actions should not be in this loop, otherwise they will be
triggered multiple times
This commit is contained in:
Charles Bochet
2025-04-15 17:34:28 +02:00
committed by GitHub
parent c40baf036c
commit dee779179b
10 changed files with 77 additions and 56 deletions

View File

@ -46,11 +46,11 @@ export const DateTimeSettingsTimeFormat: Story = {
const timeFormatSelect = await canvas.findByText('24h (08:33)');
userEvent.click(timeFormatSelect);
await userEvent.click(timeFormatSelect);
const timeFormatOptions = await canvas.findByText('12h (8:33 AM)');
userEvent.click(timeFormatOptions);
await userEvent.click(timeFormatOptions);
await canvas.findByText('12h (8:33 AM)');
},
@ -66,13 +66,13 @@ export const DateTimeSettingsTimezone: Story = {
'(GMT-04:00) Eastern Daylight Time - New York',
);
userEvent.click(timezoneSelect);
await userEvent.click(timezoneSelect);
const systemSettingsOptions = await canvas.findByText(
'(GMT-11:00) Niue Time',
);
userEvent.click(systemSettingsOptions);
await userEvent.click(systemSettingsOptions);
await canvas.findByText('(GMT-11:00) Niue Time');
},
@ -86,11 +86,11 @@ export const DateTimeSettingsDateFormat: Story = {
const timeFormatSelect = await canvas.findByText('13 Jun, 2022');
userEvent.click(timeFormatSelect);
await userEvent.click(timeFormatSelect);
const timeFormatOptions = await canvas.findByText('Jun 13, 2022');
userEvent.click(timeFormatOptions);
await userEvent.click(timeFormatOptions);
await canvas.findByText('Jun 13, 2022');
},