Loading
Current section: Best Practices 7 exercises
Problem

Queries

Loading exercise

Transcript

00:00 In this exercise block, you'll be testing a new React component, and it looks like this. It's a discount code form. It consists of two elements. It's the input for the code and the button to apply it. If you want to write great component tests, you have to model them after the user. And this means finding the elements on the page the same way the user would

00:19 and interacting with them in the same manner. In this exercise, you'll be focusing on the former. So head to a newly added test case for this form and complete it. Your task will mostly come down to two things. First is locating these elements, this input and the button in the way that's

00:34 accessible, and then adding simple assertions that these elements are visible. Once you're done, come back to me so we can discuss this solution in more detail.