By default, running cypress open
opens the Cypress window and then I have to manually hit the "Run All Tests" button to run them all.
How can run all tests in the browser just by running the cypress open
, with no additional step?
Thank you.
Edit: I need the tests to rerun when I change the test files, just like cypress open
does, so just running them once (like in headless mode) doesn't help.
When using cypress open
you can get tests to rerun in the browser after each edit by using the global configuration option watchForFileChanges
as detailed here
You can pass this as a command line argument:
cypress open --config watchForFileChanges=true
Or you can specify it in your cypress.json file:
{
"watchForFileChanges": true
}
You will still need to click run all specs when you first run cypress open
, but after that any edit to the test files will cause the tests to be rerun.
If you run Cypress tests headlessly cypress run
it runs all tests without the need to click the "Run all tests" button.
I've found using npx cypress run
is the best way to do this.
The documentation on running cypress headlessly specifies additional options you can use: https://docs.cypress.io/guides/guides/command-line.html#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With