Not sure if this is an actual bug, but I can't understand why the combination of awaitFor + getAllByRole passes the test but using findAllByRole doesn't. Aren't findBy* queries just a wrapper for awaitFor + getBy*? Also the second test doesn't really need the mock timers, but I've included those to make the tests more comparable (it doesn't change the test result).
@testing-library/dom
version: 9.2.0Also using React 18.
Relevant code or config:
What you did:
What happened:
The first test succeeds while the seconds test fails.
Reproduction:
Codesandbox
Problem description:
Not sure if this is an actual bug, but I can't understand why the combination of
awaitFor
+getAllByRole
passes the test but usingfindAllByRole
doesn't. Aren'tfindBy*
queries just a wrapper forawaitFor
+getBy*
? Also the second test doesn't really need the mock timers, but I've included those to make the tests more comparable (it doesn't change the test result).Suggested solution: