课程: End-to-End JavaScript Testing with Cypress.io
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Element aliasing
- [Instructor] All right, so at this point we've refactored our Cypress tests to use selectors that are much more robust than simply using an HTML tag or a CSS class. But especially when you look at things like this, you might find yourself longing for the somewhat more concise appearance of our old tag selectors. Right now our tests are pretty verbose and there are plenty of places where we're doing the exact same command over and over again, like with getting the characters left text doing something like this here, there's really no reason why we should have to type this over and over again. So the good news here is that Cypress provides us with a way of reducing the amount of code needed to perform these simple repetitive selections. And this concept is called aliasing in Cypress. So the way that aliasing works is like this. What we're going to do is we simply need to select something in our application. Usually this is going to be an element, but it doesn't necessarily have to be…
内容
-
-
-
-
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 秒
-
-
-
-