Skip to content

Commit

Permalink
fix: headless args
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Nov 1, 2023
1 parent 66cce5c commit 9f95faf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,20 @@ if (Cypress.env('ENDPOINT_WITH_PROXY')) {
Cypress.Cookies.preserveOnce('security_authentication');
});
}

cy.on('before:browser:launch', (browser = {}, launchOptions) => {
if (
(browser.name === 'chrome' || browser.name === 'chromium') &&
browser.isHeadless
) {
launchOptions.args = launchOptions.args.map((arg) => {
if (arg === '--headless') {
return '--headless=new';
}

return arg;
});
}

return launchOptions;
});

0 comments on commit 9f95faf

Please sign in to comment.