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
From the course: End-to-End JavaScript Testing with Cypress.io
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
-
-
-
-
Installing and running Cypress2m 14s
-
Writing and running Cypress tests8m
-
(Locked)
Testing text inputs7m 53s
-
(Locked)
Selecting elements8m 20s
-
(Locked)
Element aliasing6m 39s
-
(Locked)
Working with command results5m 43s
-
(Locked)
Using beforeEach4m 57s
-
(Locked)
Setting a base URL3m 29s
-
(Locked)
Challenge 1: Writing your own tests1m 46s
-
(Locked)
Solution 1: Writing your own tests6m 38s
-
-
-
-