Search⌘ K

Introduction to Testing Library

Explore the principles and benefits of the Testing Library in this lesson. Understand how it helps create tests that mirror real user interactions, with a focus on accessibility. Learn to integrate Testing Library with Cypress for more reliable end-to-end testing, ensuring your web applications work as intended for all users.

Testing library

The philosophy behind Testing Library is:

The more your tests resemble the way your software is used, the more confidence they can give you.

This maps closely with the test pyramid we discussed earlier. Now, we can combine end-to-end tests with a testing library that closely resembles the way our software is used.

Testing library features

A very important aspect of the Testing Library is to provide the functionality to test whether our HTML is accessible. Besides the DOM tree, there is also an accessibility tree used by screen readers. To truly develop web applications that are accessible to anyone, it is important to take accessibility ...