-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide user = userEvent.setup()
to Play function
#17988
Comments
👋 hey there! Should this be reopened? From what I can tell, the changes that completed this were rolled back before #28368 was merged. |
That is correct. We have to make This is an example, how you can do this in userland: Which also has the advantage that you can set your own userEvent options. |
Thank you! As a stopgap, I just plopped this into the play function where I needed it: play: async ({ canvasElement, step, parameters }) => {
const canvas = within(canvasElement);
/**
* TODO: refactor to destructure userEvent from context; then we will not
* need to handle `setup()` ourselves.
* See https://github.com/storybookjs/storybook/issues/17988
*/
const user = userEvent.setup();
// ... the rest of the test PS - that |
Is your feature request related to a problem? Please describe
user-event@14
allows to create a session peruserEvent.setup()
.The methods on the object share an input device state. I.e.:
Applying
.setup()
and using these methods is recommended.Describe the solution you'd like
Add
user
torenderContext.storyContext
during therendering
phase.This should probably be injected by
@storybook/testing-library
.Being able to get
user
perplay: ({user}) => { /*... */ }
would encourage people to use the recommended approach because it would also be the easiest.Are you able to assist to bring the feature to reality?
Yes, I can add the necessary code if someone can guide me through your codebase and package structure.
Additional context
I've experimented with Storybook
6.5-alpha
and the developer experience improved a lot as many things work out of the box.It would be great if this change could be added in
6.5
along with the upgrade in storybookjs/testing-library#18 .The text was updated successfully, but these errors were encountered: