From the course: End-to-End JavaScript Testing with Cypress.io
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
The "wrap" command
From the course: End-to-End JavaScript Testing with Cypress.io
The "wrap" command
- [Instructor] In a previous video, we saw how to work with the results of a command in Cypress. And in case you don't remember, after a Cypress command, for example dot get, we can add dot then and an anonymous function that has access to the element that we just selected. And remember that if we wanted to actually make assertions about this element here, we couldn't use Cypress assertions like should equal. We instead had to use Chai's expect syntax. And this works and in many cases someone might prefer to work with Cypress elements like this but let's say for the purpose of this video that you want more consistency in your tests. You want to make Cypress style assertions instead of Chai expect assertions. So the question now becomes once we have the result of one of our Cypress commands in jQuery form, here dollar sign element, how do we switch it over to something that we can call more Cypress commands on, for example dot…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.