diff --git a/.github/workflows/cypress-workflow-vanilla-snapshot-based.yml b/.github/workflows/cypress-workflow-vanilla-snapshot-based.yml index 5c1d62d71..be2785c8f 100644 --- a/.github/workflows/cypress-workflow-vanilla-snapshot-based.yml +++ b/.github/workflows/cypress-workflow-vanilla-snapshot-based.yml @@ -71,7 +71,7 @@ jobs: uses: cypress-io/github-action@v2 with: working-directory: monetery-test - command: yarn cypress:run-without-security --headless=new --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js' + command: yarn cypress:run-without-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js' wait-on: 'http://localhost:5601' # Screenshots are only captured on failure, will change this once we do visual regression tests - uses: actions/upload-artifact@v1 diff --git a/cypress/support/index.js b/cypress/support/index.js index 6b13ed838..d3401f86c 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -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; +});