Write your first test in Cypress

In this tutorial, we will cover how to write your first test in Cypress. We will go over the basic Cypress syntax and run our tests using the Cypress Test Runner.

Creating your Cypress Test

to go to any URL, you can use the cy.visit() co…


This content originally appeared on DEV Community and was authored by Automation Bro

In this tutorial, we will cover how to write your first test in Cypress. We will go over the basic Cypress syntax and run our tests using the Cypress Test Runner.

Creating your Cypress Test

Cypress Test

  • to go to any URL, you can use the cy.visit() command
  • Cypress also provides various types of page assertions such as cy.url() and cy.title() to assert the URL as well as the title of the page

Running your Cypress Test in the Cypress Test Runner

To open the Cypress Test Runner, you can execute the following command below:

npx cypress open

Once the Cypress Test Runner opens up, you can execute your test which will show results similar to this below:

  • You can see all the Cypress commands listed below such as visit, URL & title
  • All your successful assertions will show in Green and failed assertions in Red

Cypress Test Runner

Check out the video below to see how to create your first test in Cypress:

? Subscribe to my mailing list to get access to more content like this

? Follow automationbro on Twitter for the latest updates

...

I love coffees! And, if this post helped you out and you would like to support my work, you can do that by clicking on the button below and buying me a cup of coffee -

Buy me a coffee

You can also support me by liking and sharing this content.

Thanks for reading!


This content originally appeared on DEV Community and was authored by Automation Bro


Print Share Comment Cite Upload Translate Updates
APA

Automation Bro | Sciencx (2021-04-14T12:31:36+00:00) Write your first test in Cypress. Retrieved from https://www.scien.cx/2021/04/14/write-your-first-test-in-cypress/

MLA
" » Write your first test in Cypress." Automation Bro | Sciencx - Wednesday April 14, 2021, https://www.scien.cx/2021/04/14/write-your-first-test-in-cypress/
HARVARD
Automation Bro | Sciencx Wednesday April 14, 2021 » Write your first test in Cypress., viewed ,<https://www.scien.cx/2021/04/14/write-your-first-test-in-cypress/>
VANCOUVER
Automation Bro | Sciencx - » Write your first test in Cypress. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/14/write-your-first-test-in-cypress/
CHICAGO
" » Write your first test in Cypress." Automation Bro | Sciencx - Accessed . https://www.scien.cx/2021/04/14/write-your-first-test-in-cypress/
IEEE
" » Write your first test in Cypress." Automation Bro | Sciencx [Online]. Available: https://www.scien.cx/2021/04/14/write-your-first-test-in-cypress/. [Accessed: ]
rf:citation
» Write your first test in Cypress | Automation Bro | Sciencx | https://www.scien.cx/2021/04/14/write-your-first-test-in-cypress/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.