课程: End-to-End JavaScript Testing with Cypress.io

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Triggering other actions

Triggering other actions

- [Instructor] All right. So we've seen how to test clicking and double clicking. And just as a reminder, we only tested double click here, but if you wanted to test clicking behavior, you could just change that to click. So let's see how to do some other things, right, such as checking and unchecking check boxes, selecting things from a dropdown and more. So the first thing that we'll take a look at here is the check boxes. And in theory, what you could do is just find these checkbox elements and call a click on them. But Cypress provides a slightly more explicit way of doing this. This really just makes sure that your tests are clear on what it is you really want to do when interacting with these elements. So here's what this is going to look like. We're going to go back and we're going to add a test case here. We'll say it. And let's just take a look at what this .check() and .uncheck() things do. Basically this just changes the number of checked boxes that are selected so we'll…

内容