Updating our guidance and support around testing interactive components. #3521
mannycarrera4
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
We often get questions around unit tests failing between versions when users test components like
Combobox,SelectandMenuin Jest or Vitest.These components rely heavily on complex interaction that can result in failing unit tests. Tests written in Jest or Vitest typically use
@testing-library/react+ eitherjsdomorhappydom.@testing-library/reactusesreact-dom/test-utilsfor testing where certain internals are changed or mocked to mimic force asynchronous internals to resolve synchronously. This doesn't work for non-React based asynchrony. Some of our components may userequestAnimationFrameor other asynchronous browser APIs which prevent these tests from working properly without exposing internal implementation details to work around a component's asynchronous API calls.Debugging becomes increasingly difficult for teams, and we end up strongly encouraging them to move these tests over to Cypress. Cypress uses real browsers to render UI components while Jest and Vitest rely on node-based solutions.
jsdomandhappydomare not in our browser support matrix and lacks visual verification or debugging tools.Proposition
Update our guidance and support matrix of testing environments where we no longer support Jest/Vitest environments for Asynchronous behavior of UI components like our
Combobox,Selectand other Popup/Collection system components. Investigating the root cause of these tests is difficult due to the lack of debugging tools and often leads to hacky solutions and boilerplate.We should include example in our documentation that shows users how to test highly interactive components.
For reference, we should add Cypress Component Test guidance in our documentation. For a more end to end tests, spanning multiple components, users should use Cypress End to End Testing.
TLDR: Explicitly call out in our docs that we do not support Jest/Vitest for component interactions. Update our supporting matrix and testing docs to reflect this.
Beta Was this translation helpful? Give feedback.
All reactions