问题
So I have a project dir under that I have my Cypress dir under that I have two dir's with different tests I run. Right now in my project dir I have a cypress.json that has the setting "integrationFolder": "cypress/test_tests",when I issue the command npx cypress run it gets the dir from the integrationFolder setting in the .json file but if I want to run the tests from a different dir I have to edit the cypress.json file and set the integrationFolder to the other dir, is there a way I can specify which dir I want Cypress to pick the tests from?
回答1:
Yes, as explained here
cypress run --spec 'tests/folderOne/**/*'
or
cypress run --spec 'tests/folderTwo/**/*'
回答2:
Added config into your cypress.json
"integrationFolder": "./",
then both your folders can be supported by Cypress runner.
To run them you can add the commands in package.json:
"cypress-test1": "cypress run --spec \"cypress/folder1/*.spec.js\""
"cypress-test2": "cypress run --spec \"cypress/folder2/*.spec.js\""
so you can run either folder by a short command, like:
yarn cypress-test1
来源:https://stackoverflow.com/questions/50993299/easy-way-of-running-different-groups-of-cypress-tests