- Check the System Requirements first from the Cypress Docs.
- You can run cypress using two different methods either through the cypress test runner (Headed Mode) or through Command Line (Headless Mode)
-
To run Cypress using the test runner you can follow the instructions in the docs or use any of the following commands.
-
npx cypress open
-
yarn run cypress open
-
This will open the test runner and then you can choose between the testing type
-
If you choose e2e testing you will be prompted again to choose the preferred browser.
-
After choosing the browser cypress will open the test runner and automatically detect spec files available in
cypress/e2e
-
You can run the tests by simply clicking on the spec file for the test.
- To run cypress using headless mode you can follow the instructions in the docs or use any of the following commands.
npx cypress run
yarn cypress run
- The previous commands will run all the tests but if you want to run a single test you can use any of the following commands
npm run cy:run -- --record --spec "cypress/e2e/my-spec.cy.js"
npx cypress run --record --spec "cypress/e2e/my-spec.cy.js"
- You can also check all the options that can be added to the
cypress run
command from here. - After executing any of these commands cypress will run and log everything in the console.