Skip to content

Commit

Permalink
test: add new system test for --headless=old
Browse files Browse the repository at this point in the history
  • Loading branch information
mschile committed Sep 18, 2023
1 parent dc282cd commit f3a522b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions system-tests/projects/e2e/cypress/e2e/headless_old.cy.js
Original file line number Diff line number Diff line change
@@ -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')
})
})
11 changes: 11 additions & 0 deletions system-tests/projects/e2e/cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(' '))
}
Expand Down
13 changes: 13 additions & 0 deletions system-tests/test/headless_old_spec.js
Original file line number Diff line number Diff line change
@@ -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,
},
})
})

0 comments on commit f3a522b

Please sign in to comment.