My 'example-spec.js' tests under the integration folder contain 15 tests, each time the Cypress.io will run all the 15 tests written in the 'example-spec.js'. I would like to choose and specify 'which' test needs to run, maybe 1 or 2 test at a time. The reason maybe I don't want to wait to see the output of all test while adding a 'new' test. Is there any way to control the test run in Cypress.io?
cypress run --no-exit To prevent Cypress from exiting after running tests in a spec file, use --no-exit . You can pass --headed --no-exit in order to view the command log or have access to developer tools after a spec has run.
Cypress provides two ways to test cases. Either using the Cypress UI Test Runner or from the CLI using the "cypress run" command. A specific test case can be executed on the CLI using the "--spec" option. We can change the browser for a specific test run on CLI using the "--browser" option.
Using the cypress configuration we can execute cypress tests in a sequence we desire. Simply write test file names under the testFiles property in your cypress. json file, like below. On running npm test, you can see on the test runner UI that all the tests are listed from 1 to 13 in sequence.
I don't know if there's a way to do it from the user interface, but you can use mocha methods to run only chosen tests by:
it
with xit
tests you want to omitit.skip
on tests you want to omitit.only
on single test you want to runTo skip entire context/describe suite use context.skip()
or describe.skip()
which are identical.
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