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 007a14f commit 2ca3977
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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 2ca3977

Please sign in to comment.