From the course: Advanced Cypress

Unlock this course with a free trial

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

What are Cypress custom commands?

What are Cypress custom commands? - Cypress Tutorial

From the course: Advanced Cypress

What are Cypress custom commands?

In this video, we're going to talk about writing custom commands in Cypress. So Cypress, as we've seen, offers a lot of functionality out of the box. But sometimes you need to add your own custom commands or even overwrite some of Cypress's custom or default commands. Excuse me. So in this video, we're going to learn to differentiate between adding and overwriting commands, and then understand when to use custom commands versus just using those existing commands that Cypress gives us. So just because you can write a custom command doesn't mean that you necessarily should. You could potentially over abstract every command in here and do like a get by ID click sort of thing. But you don't need to necessarily break all of your commands into custom commands. So we'll take a look at when to use these custom commands. So let's go ahead and take a look. So as normal, we've got our FirstTest.spec.js file open, we've got our project running locally and we've got our npm run cy open command run…

Contents