diff --git a/cypress.config.ts b/cypress.config.ts index 4a756319..7ec7d4b4 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,6 +1,5 @@ import { defineConfig } from 'cypress' import cypressGrepPlugin from '@cypress/grep/src/plugin' - import parseEnvPlugin from './cypress/plugins' export default defineConfig({ @@ -8,6 +7,16 @@ export default defineConfig({ // We've imported your old cypress plugins here. // You may want to clean this up later by importing these. setupNodeEvents(on, config) { + on('before:browser:launch', (browser, launchOptions) => { + if (browser.name === 'chrome' && browser.isHeadless) { + const headlessIndex = launchOptions.args.indexOf('--headless') + if (headlessIndex > -1) { + launchOptions.args[headlessIndex] = '--headless=new' + } + } + return launchOptions + }) + return cypressGrepPlugin(parseEnvPlugin(on, config)) as Cypress.PluginConfigOptions }, baseUrl: 'http://localhost:5001/',