filmov
tv
React Async Testing using React Testing Library for Beginners: React.js Testing Tutorial #4

Показать описание
We are going to use findBy, waitFor
waitForElementToBeRemoved query methods from react testing library in order to test async code.
I'l also show the most common mistakes and struggles people have while testing async code and give you my solutions to those common problems.
React testing library provides several utilities for dealing with asynchronous code. These can be useful to wait for an element to appear or disappear in response to an event, user action, timeout, or Promise.
findBy Queries: findBy methods are a combination of getBy queries and waitFor. findBy queries work when you expect an element to appear but the change to the DOM might not happen immediately.
waitForElementToBeRemoved: To wait for the removal of element(s) from the DOM you can use waitForElementToBeRemoved. The waitForElementToBeRemoved function is a small wrapper around the waitFor utility.
-----
Timeline:
00:00 Introduction
00:18 What is Async code?
01:35 findBy and waitFor explanation
03:10 Comparing findBy with getBy and queryBy
04:15 Code Starts: Add async code
07:20 Where people start to struggle + solutions!!!
12:45 Wait for elements to disapppear from the screen
16:24 Where people struggle a LOT + solutions!!!
22:00 How you can get my help :)
-----
----
Join the channel to support my content:
----
----
Follow me on:
waitForElementToBeRemoved query methods from react testing library in order to test async code.
I'l also show the most common mistakes and struggles people have while testing async code and give you my solutions to those common problems.
React testing library provides several utilities for dealing with asynchronous code. These can be useful to wait for an element to appear or disappear in response to an event, user action, timeout, or Promise.
findBy Queries: findBy methods are a combination of getBy queries and waitFor. findBy queries work when you expect an element to appear but the change to the DOM might not happen immediately.
waitForElementToBeRemoved: To wait for the removal of element(s) from the DOM you can use waitForElementToBeRemoved. The waitForElementToBeRemoved function is a small wrapper around the waitFor utility.
-----
Timeline:
00:00 Introduction
00:18 What is Async code?
01:35 findBy and waitFor explanation
03:10 Comparing findBy with getBy and queryBy
04:15 Code Starts: Add async code
07:20 Where people start to struggle + solutions!!!
12:45 Wait for elements to disapppear from the screen
16:24 Where people struggle a LOT + solutions!!!
22:00 How you can get my help :)
-----
----
Join the channel to support my content:
----
----
Follow me on:
Комментарии