Open kpericin opened 9 months ago
I added another case, using TanStack form: https://github.com/kpericin/storybook-play-function-repro/blob/main/src/stories/TanstackFormInteraction.stories.js
It has the same issue when using test-storybook
- text gets entered in the input field but empty string gets submitted.
Describe the bug
When using
@storybook/test-runner
to run interaction test for simple form managed byreact-hook-form
, tests will randomly fail a few times in a hundred runs. At first I thought it is caused by https://github.com/storybookjs/storybook/issues/18258, however, after upgrading everything the issue persisted.After a lot of trial and error, I managed to get to a consistent reproduction which can be achieved by configuring test runner to run in headed mode with devtools enabled. In that configuration, simple test will always fail. Text gets entered in the input field but empty string gets submitted.
I'm not entirely sure the issue is in storybook. I'm assuming it is because I cannot reproduce it if I test the same storybook page using playwright directly. Or, if I run vite dev server and point playwright tests to it.
To Reproduce
Repository of the reproduction can be found here.
To reproduce, first install dependencies then start storybook dev server. Open
http://localhost:6009/?path=/story/nativerhfinteraction--text-input
, it will most likely work when run in storybook directly. Now runtest-storybook
. It will open Chromium browser with devtools enabled and you'll see toast notification in the bottom left corner which will have empty text.Next, try running
test
script. It will also open Chromium with devtools enabled, but this time the test will pass because notification will have the correct text.System
Additional context
No response