From 385bf591cf06c250a632051cfc37b1d03c455271 Mon Sep 17 00:00:00 2001 From: Paul Rastoin <45004772+prastoin@users.noreply.github.com> Date: Thu, 30 Jan 2025 16:57:53 +0100 Subject: [PATCH] [FIX] Storybook race condition (#9936) Flaky test can be found [here](https://github.com/twentyhq/twenty/actions/runs/13052735697/job/36416799488) Action should be outside the waitFor callback ## Context It seems to occurs since the Charles tooltip perf refactor https://github.com/twentyhq/twenty/commit/ae4bf8d9298ca77cc45f6f4b0c25b66b51ad834f Maybe the tests render being faster it changed order of execution ? idk still interesting --- .../__stories__/RelationToOneFieldInput.stories.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationToOneFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationToOneFieldInput.stories.tsx index fcff54e68..262d00fca 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationToOneFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationToOneFieldInput.stories.tsx @@ -139,10 +139,8 @@ export const Submit: Story = { timeout: 3000, }); - await waitFor(() => { - userEvent.click(item); - expect(submitJestFn).toHaveBeenCalledTimes(1); - }); + await userEvent.click(item); + await waitFor(() => expect(submitJestFn).toHaveBeenCalledTimes(1)); }, };