课程: End-to-End JavaScript Testing with Cypress.io
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Selecting elements
- [Instructor] So now that we have some tests written and passing, it's time to talk about a very important topic in Cypress. And to be specific, we need to take a good hard look at what the best way is to select different elements in our tests, right? So far, for simplicity, we've just been using the HTML tag of whatever element we want to select, and I want to make it very clear that in the vast majority of cases, this is just the wrong way to do it, right? You see the problem here is that using the HTML tag like this is extremely dependent on the current state of our app. So to show you what I mean, let's navigate to example three. And what you'll see here is that we have two text inputs instead of one. Now, if we go back to our application and test this thing, what I'm actually going to do is duplicate this file. I'm just going to copy it and paste it here, and we'll change this to something like selecting.cy.js. Well, let's see what happens if all we change is going to the…
内容
-
-
-
-
Installing and running Cypress2 分钟 14 秒
-
Writing and running Cypress tests8 分钟
-
(已锁定)
Testing text inputs7 分钟 53 秒
-
(已锁定)
Selecting elements8 分钟 20 秒
-
(已锁定)
Element aliasing6 分钟 39 秒
-
(已锁定)
Working with command results5 分钟 43 秒
-
(已锁定)
Using beforeEach4 分钟 57 秒
-
(已锁定)
Setting a base URL3 分钟 29 秒
-
(已锁定)
Challenge 1: Writing your own tests1 分钟 46 秒
-
(已锁定)
Solution 1: Writing your own tests6 分钟 38 秒
-
-
-
-