Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devtools open on launch config to Cypress plugins #7822

Closed
wants to merge 10 commits into from
23 changes: 23 additions & 0 deletions cypress.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ module.exports = defineConfig({
defaultCommandTimeout: 25000,
blockHosts: ['*google-analytics.com', '*googletagmanager.com'],
e2e: {
// setupNodeEvents can be defined in either
// the e2e or component configuration.
setupNodeEvents(on, config) {
on('before:browser:launch', (browser = {}, launchOptions) => {
// Log browser info. This could be useful when comparing local to CI.
// console.log('Launching browser', browser);

// Auto open devtools.
if (browser.family === 'chromium') {
if (browser.name === 'electron')
launchOptions.preferences.devTools = true;
else launchOptions.args.push('--auto-open-devtools-for-tabs');
} else if (browser.family === 'firefox') {
launchOptions.args.push('-devtools');
}

// Whatever you return here becomes the launchOptions.
return launchOptions;
});

// IMPORTANT return the updated config object.
return config;
},
baseUrl: 'http://localhost:8000',
specPattern: 'test/cypress/integration/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'test/cypress/support/e2e.js',
Expand Down
22 changes: 0 additions & 22 deletions cypress/plugins/index.js

This file was deleted.

24 changes: 0 additions & 24 deletions test/cypress/plugins/index.js

This file was deleted.