From the course: Advanced Cypress

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

How to handle Cypress async commands

How to handle Cypress async commands - Cypress Tutorial

From the course: Advanced Cypress

How to handle Cypress async commands

So let's talk about asynchronous Cypress. So you may have heard the term asynchronous before in programming. And basically to give you an analogy, it'd be like doing your laundry. So for me when I do my laundry, I put it in and I know that that machine is going to make a noise when it's done. So you can think about that as, like, a promise. The machine promises to make a noise, to say, "Hey, your laundry is done." And so the benefit of that is that I can put in my laundry and I can go do other stuff, knowing that the machine is going to tell me that it's done eventually. And so promises in JavaScript and in programming works similarly, in asynchronous programming works similarly, where you might try to fetch some data from an API and say, okay, I want this list of movies or whatever. And so that will return a promise saying like, "Hey, yes. You're going to get this data at some point. Like go ahead, do your thing, go ahead and continue running your program, and when I'm done fetching…

Contents