cypress download: "cypress run" appears to be the same as "cypress open"

Viewed 358

I'm using the zip file download of Cypress as the server it's running on can't access npm.

I've added the following to the scripts section pf package.json

    "cy:cypress": "D:/Cypress/cypress.exe",
    "cy:open": "D:/Cypress/cypress.exe open",
    "cy:run": "D:/Cypress/cypress.exe run",

All of them generate the page show in the image below, which I believe is the dashboard.

My understanding is that the third of these runs the tests headlessly.

It's almost like 'open' and 'run' are ignored in the 2nd and 3rd script so in reality thay are all calls to cypress.exe.

  • Is this expected behaviour?
  • Can the download version of Cypress 'run' tests?
  • if so how?

Thanks

What the first 3 scripts generate

1 Answers

You are trying to execute cypress executable here, which won't work, you have to use cypress command which is installed globally or execute it from your node_modules, so here are the two ways -

  1. npx cypress open
  2. node_modules\.bin\cypress open
  3. cypress open - this will work if you have cypress installed globally and cypress command is part of your operating system's environment variables

You can replace the command open with run preferably if you want to run it in headless mode by using --headless option which means it will not open the runner and it will just run the tests in the terminal.

Slightly unrelated, but you can also use --spec to specifically run a particular test and --browser chrome to run it on a specified browser e.g. chrome in this command

Related