Courses / Frontend Testing
9. Testing async UI updates with waitFor and findBy*
Techniques to test async UI changes using waitFor and async queries.
JavaScript
Testing async UI updates with waitFor and findBy*
Tools for waiting and querying DOM changes in async UI tests so assertions run after updates occur.
"I wrote my component, but my test fails because the DOM updates a split-second later."
waitFor retries a callback until it stops throwing or a timeout occurs; findBy* queries are async and wait for a matching element to appear. Use them to assert UI changes that happen after async events.
"I wrote my component, but my test fails because the DOM updates a split-second later."
waitFor retries a callback until it stops throwing or a timeout occurs; findBy* queries are async and wait for a matching element to appear. Use them to assert UI changes that happen after async events.