课程: End-to-End JavaScript Testing with Cypress.io
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution 1: Writing your own tests
(upbeat music) - [Shaun] All right, well, hopefully you gave this challenge a try. Let's take a look at the solution. So the first thing to do, of course, was to create a new test file. I just said new file, and I called this one something like challenge-1.cy.js. And then what I did is I just copied some of the code over from one of the previous ones, such as the max character input to at least give myself a start. So I just pasted that in there and made a few modifications. The first thing, of course, was to actually visit the correct URL or path, in this case, since we already set a base URL, and that was challenge-1,, and let's also change the text up here. So for describe, we'll just say something like 'Challenge page functionality'. And the first thing here that we wanted to test was we wanted to make sure that when there was nothing in the text input, there was nothing that showed up in the message underneath. So here's how this worked. I started off by just saying it, and for…
内容
-
-
-
-
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 秒
-
-
-
-