Cypress Command Line Interface

Mohamed Yaseen
Nerd For Tech
Published in
3 min readMay 10, 2021

Before I begin, I have changed the script as follows:

Let’s open a terminal and type the following command

npx cypress run

There It goes. Cypress is running headlessly and it’s running the tests. And gives the result file-wise with the recordings. It is executed in the default browser Electron.

If you want to execute in Chrome browser, then enter the following command without headless:

npx cypress run --browser chrome --headless

If you want to execute a single test file, then types the following command:

npx cypress run --spec cypress/integration/orangehrm-login.spec.js

One of the most important and applicable conventions is the npm test convention. This is a huge part of the ecosystem and is very good for team growth. If you commit this kit to your source control and push it to your source control, a different developer will pick up your source by using npm install. All the packages are local so `npm install` can update all the necessary information to execute the test. However, and this is the convention, they suppose that all package checks would be executed if they run the npm test. We must make this possible. Let’s open the package.json and insert the following command to the script-> test

cypress run --browser chrome --headless

Now execute the following command to run the tests using npm

npm run test

--

--

Mohamed Yaseen
Nerd For Tech

Experienced QA Automation Lead with expertise in test automation, frameworks, and tools. Ensures quality software with attention to detail and analytical skills