storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.8k stars 9.33k forks source link

Better document testing-library's queries, e.g. `getByRole` #22598

Open kylegach opened 1 year ago

kylegach commented 1 year ago

Related discussions: https://github.com/storybookjs/storybook/discussions/22429#discussioncomment-5819924 and https://github.com/storybookjs/storybook/discussions/22429#discussioncomment-6083738

I don't think we should document the full API, but we should point to https://testing-library.com/docs/queries/about in a clear and obvious manner, perhaps with one key example demonstrating a reasonably-full usage of their API.

domyen commented 1 year ago

Since we expose the testing library API as a first class feature, I think we should provide examples of Interaction Testing in action with "common UI engineering use cases".

For example:

I get that we don't want to just parrot the TL API, but I suspect not exposing more of it is preventing folks from adopting Interaction Testing by adding an extra click to another website.

kylegach commented 1 year ago

As of https://github.com/storybookjs/testing-library/releases/tag/v0.2.0, this should now include the user-event@14 API as well (e.g. pointer).