https://cypress.io logo
Yes exactly now you're getting it. You can overrid...
# e2e-testing
s
Yes exactly now you're getting it. You can override these default arguments already set in Cypress Chrome browser and you can also add your own. Add this code to your
cypress.config.ts
or
.js
(whichever your use), similar to the docs https://docs.cypress.io/api/plugins/browser-launch-api and launch
Cypress open
:
Copy code
setupNodeEvents: async (on, config) => {
      on(
        'before:browser:launch',
        (
          browser,
          launchOptions
        ) => {
          // `args` is an array of all the arguments that will be passed to browsers when it launches
          if (browser.family === 'chromium' && browser.name !== 'electron') {
            launchOptions.args.push('--auto-open-devtools-for-tabs', '--disable-application-cache');
            consola.info('Chromium flags set count:', launchOptions.args.length);
            consola.info('Chromium flags set list:', launchOptions.args);
          }
          return launchOptions;
        }
      );
See that I'm logging (in my terminal) the number of arguments with
.length
and then all the arguments set list. There are 50 in total, 48 were by default and I added 2 more (so the Cypress team set 48 arguments to configure it how they want it by default, you can undo this). Also, you can do this trick https://docs.cypress.io/api/plugins/browser-launch-api#See-all-Chrome-browser-switches to see the list within the Chrome browser itself. Also, you'll see that Dev Tools is now open by default (as I like it)! Now once you see the list, you can think about which arguments relate to what you need enabled / disabled, you obviously need to Google around on this part. Play around with it until you get Cypress Chrome browser exactly as you need it. Then happy days 👏