From the course: End-to-End JavaScript Testing with Cypress.io

Unlock this course with a free trial

Join today to access over 24,100 courses taught by industry experts.

Working with command results

Working with command results

- [Instructor] All right, now that we've seen the main way of aliasing in Cypress, which is to use this .as method, that's chained on the end of any Cypress command. The next thing that we're going to take a look at is another way that we can alias elements in Cypress. But before we do that, what I'm actually going to do is I'm going to duplicate this file. I'm just going to copy everything that's inside of it and we'll create a new file, just so that you have the old stuff around for reference, and we'll call this something like results.cy.js. All right, we're going to paste this inside of there now and we're going to leave the tests the same as what they were before. Let's also just adjust this indentation-thing here, which is a little bit off. There we go. All right, now, previously I mentioned that there was a way that we could get and work with the results of our Cypress commands and that it wasn't by simply saying something like const fnInput equals cy.get, first name input…

Contents