Cypress Run Only One Spec

Profile picture for user arilio666

In Cypress, you can run a single spec file, multiple spec files, or all the spec files at the same time. Generally, while developing tests, we want to run a single spec file or some test cases from that file.

Table of Content

  1. Run single spec file using Test Runner
  2. Run single spec file using command line
  3. Video Tutorial

1. Run single spec using Test Runner

Once you launch your test runner, you will see all your spec files in the E2E specs section. You can click on the file you want to run. It will run all the test scenarios in that spec file unless you have used .only with any test.

Cypress Run Only One Spec

2. Run single spec file using command line

Another way you can specify the file name with path and command line option --spec or -s.

npx cypress run --spec cypress/e2e/forms.cy.js

or

npx cypress run -s cypress/e2e/forms.cy.js