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

免费学习该课程!

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

Common assertions

Common assertions

- [Instructor] All right, so now that we've taken a look at a few different interactions that we can use with Cypress, let's take a look at a few different types of assertions, right? So, so far, we've been primarily concerned with things like checking whether text is equal to some value or checking whether a text input has some value. But the fact is that there's a lot of other assertions that we'll want to make in Cypress in order to make sure that a website is behaving in the way that we want it to. So the first thing that I'm going to do here is I'm actually just going to create a new file for the code that I'm going to write here. We'll call this assertions.cy.js. We're just going to say describe, and we'll say something like different types of assertions. And then for the test cases here, the first one we're going to do is checking to see whether there are a certain number of a type of element on a page, right? So checking the number of items is a pretty common thing that we…

内容