Cypress Run Only One Spec

Cypress Run Only One Spec

Sometimes we might need to run a single spec file instead of running the whole tests contained in the test folder. Times like this when a single command line comes in handy. We can run a single spec file using the --spec, or if we want to run a single test step, then it.only can be used.

cypress run --spec path/to/test.spec.js
  • This runs a single spec file inside the specific path.
  • Path and the file name.js needs to be mentioned after --spec.
it.only("Test", () => {
  // 
});

it("another test step", ()=> {
//
});
  • This runs only he specified only test step.

Conclusion:
So this is how we can run the specific spec file using the --spec. 

Tags
Standard (Image)