From the course: End-to-End JavaScript Testing with Cypress.io
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Solution 1: Writing your own tests
From the course: End-to-End JavaScript Testing with Cypress.io
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…
Contents
-
-
-
-
Installing and running Cypress2m 14s
-
Writing and running Cypress tests8m
-
(Locked)
Testing text inputs7m 53s
-
(Locked)
Selecting elements8m 20s
-
(Locked)
Element aliasing6m 39s
-
(Locked)
Working with command results5m 43s
-
(Locked)
Using beforeEach4m 57s
-
(Locked)
Setting a base URL3m 29s
-
(Locked)
Challenge 1: Writing your own tests1m 46s
-
(Locked)
Solution 1: Writing your own tests6m 38s
-
-
-
-