Cypress II in 20 minutes

John Peters - Apr 25 '20 - - Dev Community

In the first post, details were given on how to install and get Cypress running in your new Angular project.

The first question of importance, is "how do we get addressibility to the elements within the Cypress Test?"

Alt Text

Answer: Cy.get('')

cy.get('body').then(function(body){...} 
Enter fullscreen mode Exit fullscreen mode

But notice that to get the children; we must call a function, and not a property. This is because Cypress uses JQuery under the hood. Which means we have to learn a bit about Cypress internals and how it does things.

var firstelement = body.children()[0]
Enter fullscreen mode Exit fullscreen mode

For now, it's probably a good idea to read up on Cypress' How do I get the native DOM reference? .

Notice in the documentation that the results from a Cypress Get have predefined functions for us to use such as then,shoud,to,not,type These are the commands Cypress uses to effect the tests we are about to write.

More to come...
JWP2020

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player