From 2247ffd79b226a7fe00dd3252020becf2c22b110 Mon Sep 17 00:00:00 2001 From: Matt Schile Date: Tue, 19 Sep 2023 09:37:01 -0600 Subject: [PATCH] test: add new system test for --headless=old (#27834) --- .../projects/e2e/cypress/e2e/headless_old.cy.js | 5 +++++ system-tests/projects/e2e/cypress/plugins/index.js | 11 +++++++++++ system-tests/test/headless_old_spec.js | 13 +++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 system-tests/projects/e2e/cypress/e2e/headless_old.cy.js create mode 100644 system-tests/test/headless_old_spec.js diff --git a/system-tests/projects/e2e/cypress/e2e/headless_old.cy.js b/system-tests/projects/e2e/cypress/e2e/headless_old.cy.js new file mode 100644 index 000000000000..f9458e537ee8 --- /dev/null +++ b/system-tests/projects/e2e/cypress/e2e/headless_old.cy.js @@ -0,0 +1,5 @@ +describe('e2e headless old spec', function () { + it('has expected launch args', function () { + cy.task('get:browser:args').should('contain', '--headless=old') + }) +}) diff --git a/system-tests/projects/e2e/cypress/plugins/index.js b/system-tests/projects/e2e/cypress/plugins/index.js index 827a05a6c382..0436a606c833 100644 --- a/system-tests/projects/e2e/cypress/plugins/index.js +++ b/system-tests/projects/e2e/cypress/plugins/index.js @@ -59,6 +59,17 @@ module.exports = (on, config) => { } if (browser.family === 'chromium' && browser.name !== 'electron') { + if (process.env.CHROMIUM_USE_HEADLESS_OLD) { + options.args = options.args.map((arg) => { + // ensure we are using --headless=old by overriding both headless new and default + if (arg === '--headless' || arg === '--headless=new') { + return '--headless=old' + } + + return arg + }) + } + if (process.env.CHROMIUM_EXTRA_LAUNCH_ARGS) { options.args = options.args.concat(process.env.CHROMIUM_EXTRA_LAUNCH_ARGS.split(' ')) } diff --git a/system-tests/test/headless_old_spec.js b/system-tests/test/headless_old_spec.js new file mode 100644 index 000000000000..feeffc08cae2 --- /dev/null +++ b/system-tests/test/headless_old_spec.js @@ -0,0 +1,13 @@ +const systemTests = require('../lib/system-tests').default + +describe('e2e', () => { + systemTests.setup() + + systemTests.it('succeeds using --headless=old', { + spec: 'headless_old.cy.js', + browser: 'chrome', + processEnv: { + CHROMIUM_USE_HEADLESS_OLD: 1, + }, + }) +})