-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Tabs: Implement ariakit/test
in unit tests
#56835
Conversation
Flaky tests detected in 6b7e8ac. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7117835562
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests here are passing consistently! ✅
I don't see flakiness with the tests in trunk at the moment, but I did see it in your other PR #56658. I'm interested to see how that goes once this change is implemented there!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really cool to see a better way to handle the ariakit store setup update than our prior hacks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Although Ariakit Test doesn't decrease flakiness to the same extent as synchronous tests, it should perform better than User Event.
I'd argue it's not just better for Ariakit, but also for most front-end libraries that can be tested with JSDOM. We've run tests for Framer Motion, React Router, and even Radix UI. |
What?
Uses
@ariakit/test
utils instead of@testing-library
'suserEvent
utilsWhy?
While working on these tests I've encountered a number of timing issues while using
userEvent
utils, at times finding that assertions would be checked before the component had time to fully update and/or rerender. Most recently, while adding new unit tests in #56658, it appeared data was leaking between tests in ways I couldn't nail down.How?
All keyboard and mouse interactions that were previously simulated using
userEvent
are now performed via@ariakit/test
'spress
andclick
utils.This made a some of our existing
waitFor()
calls unnecessary, due to how these new utilities perform and time these interactions.Testing Instructions
All
Tabs
unit tests should pass consistentlycc @diegohaz, in case this is of interest