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
|
tyxla
left a comment
There was a problem hiding this comment.
Really cool to see a better way to handle the ariakit store setup update than our prior hacks!
diegohaz
left a comment
There was a problem hiding this comment.
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/testutils instead of@testing-library'suserEventutilsWhy?
While working on these tests I've encountered a number of timing issues while using
userEventutils, 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
userEventare now performed via@ariakit/test'spressandclickutils.This made a some of our existing
waitFor()calls unnecessary, due to how these new utilities perform and time these interactions.Testing Instructions
All
Tabsunit tests should pass consistentlycc @diegohaz, in case this is of interest