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

@ -5,8 +5,8 @@ import { expect, userEvent, within } from '@storybook/test';
import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';
import { sleep } from '~/utils/sleep';
import { IconPicker, IconPickerProps } from '../IconPicker';
import { ComponentDecorator } from 'twenty-ui/testing';
import { IconPicker, IconPickerProps } from '../IconPicker';
type RenderProps = IconPickerProps;
const Render = (args: RenderProps) => {
@ -123,7 +123,7 @@ export const WithSearchAndClose: Story = {
name: 'Click to select icon (selected: IconBuildingSkyscraper)',
});
userEvent.click(iconPickerButton);
await userEvent.click(iconPickerButton);
await sleep(500);