Running a sample cypress test

Mon, 24 Jun 2019

I had already installed cypress and its sample tests earlier. I can use any editor to see the sample files. Here I am using Visual Studio Code editor to see one of the sample test files, actions.spec.js

a sample test file opened in Visual Studio Code

Open the cypress test runner

npx cypress open

When you are opening the test runner for the very first time in a project, cypress asks you if you some would like sample cypress tests created in your project. This is very useful as it has a lot of example test code.

npx cypress open window

Lets run one of those sample tests now Click on the file actions.spec.js Cypress starts running all the tests in the actions.spec.js file.

It opens a chrome window and shows all the test results. Each of the tests in the actions.spec.js files runs a particular test against a website. The left side of the window shows all the tests that are run. The right side shows the actions on the website when each test is run.

cypress-action.spec test results

Loading...