testing-react
testing-react copied to clipboard
argsEnhancers are not applied
Is your feature request related to a problem? Please describe.
The interactions addon replaces action arguments with jest mocks that can be inspected in play functions. It would be great to be able to run play functions in jest to test them during CI. This currently does not work because the arguments don't get enhanced.
Describe the solution you'd like
argsEnhancers
from global config or other presets should be applied. Then it would be possible to use ...
https://github.com/storybookjs/testing-react#interactions-with-play-function
... in combination with ...
https://storybook.js.org/docs/react/essentials/interactions#writing-interactions
Or specifically the await waitFor(() => expect(args.onSubmit).toHaveBeenCalled());
part.
I think this would have to happen during argument combination: https://github.com/storybookjs/testing-react/blob/main/src/index.ts#L121-L124