I'm using cypress typescript test framework When I call "npx cypress run" it runs all my tests in headless mode with Electron as the default browser. But I want to run it in chrome or any other browser. How do I achieve this?
4 Answers
1.If you want to run tests on for eg. chrome. you can use:
npx cypress run --browser chrome
2.If you want to run your tests in headless chrome you can use:
npx cypress run --headless --browser chrome
You can get the list of browsers that cypress supports from here
3 Comments
Most Wanted
Is there a way to specify default browser via configuration file?
G07cha
@MostWanted not yet as per this issue - github.com/cypress-io/cypress/issues/6646
Sergei Krasilnikov
See
defaultBrowser in docs.cypress.io/app/references/configuration#Browser since 13.16.0When it comes to angular, you could also add it to your project.json run configuration:
// project.json or angular.json
"targets": {
...
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/storybook-e2e/cypress.config.ts",
"browser": "chrome", // <<------ this line
"devServerTarget": "my-app:storybook",
"testingType": "e2e"
}
}
},
...
1 Comment
Joe McKie
This question isn't related to NX.