typescriptgoogle-chromeelectroncypressheadless

How to change the default headless browser to chrome in Cypress


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?


Solution

  • 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