From 2247ffd79b226a7fe00dd3252020becf2c22b110 Mon Sep 17 00:00:00 2001 From: Matt Schile Date: Tue, 19 Sep 2023 09:37:01 -0600 Subject: [PATCH 1/2] 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, + }, + }) +}) From 381b505b6fee949eae078ed80f3153a6d6c96312 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:36:42 -0600 Subject: [PATCH 2/2] chore: Update Chrome (stable) to 117.0.5938.88 and Chrome (beta) to 118.0.5993.11 (#26966) --- browser-versions.json | 4 ++-- .../driver/cypress/e2e/commands/actions/click.cy.js | 4 ++-- packages/driver/src/cy/mouse.ts | 12 +++++++----- .../projects/e2e/cypress/e2e/headless_old.cy.js | 6 +++++- system-tests/test/headless_old_spec.js | 4 +++- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/browser-versions.json b/browser-versions.json index eb4bb16309d3..a123031782e8 100644 --- a/browser-versions.json +++ b/browser-versions.json @@ -1,5 +1,5 @@ { - "chrome:beta": "115.0.5790.13", - "chrome:stable": "114.0.5735.106", + "chrome:beta": "118.0.5993.11", + "chrome:stable": "117.0.5938.88", "chrome:minimum": "64.0.3282.0" } diff --git a/packages/driver/cypress/e2e/commands/actions/click.cy.js b/packages/driver/cypress/e2e/commands/actions/click.cy.js index 6bf6d3c23338..97fe26a7b6a0 100644 --- a/packages/driver/cypress/e2e/commands/actions/click.cy.js +++ b/packages/driver/cypress/e2e/commands/actions/click.cy.js @@ -46,6 +46,7 @@ const getMidPoint = (el) => { const isFirefox = Cypress.isBrowser('firefox') const isWebKit = Cypress.isBrowser('webkit') +const isChromium116OrLater = Cypress.isBrowser({ family: 'chromium' }) && Cypress.browserMajorVersion() >= 116 describe('src/cy/commands/actions/click', () => { beforeEach(() => { @@ -4448,13 +4449,12 @@ describe('mouse state', () => { btn.on('pointerover', onAction) cy.get('#btn').click() - // cy.wrap(onAction).should('calledOnce') cy.getAll('btn', 'pointerover pointerenter').each(shouldBeCalledOnce) // On disabled inputs, pointer events are still fired in chrome, not in firefox or webkit cy.getAll('btn', 'pointerdown pointerup').each(isFirefox || isWebKit ? shouldNotBeCalled : shouldBeCalledOnce) - cy.getAll('btn', 'mouseover mouseenter').each(isFirefox || isWebKit ? shouldBeCalled : shouldNotBeCalled) + cy.getAll('btn', 'mouseover mouseenter').each(isFirefox || isWebKit || isChromium116OrLater ? shouldBeCalled : shouldNotBeCalled) cy.getAll('btn', 'mousedown mouseup click').each(shouldNotBeCalled) }) diff --git a/packages/driver/src/cy/mouse.ts b/packages/driver/src/cy/mouse.ts index 2958b03881a8..2a34656ac7ff 100644 --- a/packages/driver/src/cy/mouse.ts +++ b/packages/driver/src/cy/mouse.ts @@ -58,6 +58,8 @@ type DefaultMouseOptions = ModifiersEventOptions & CoordsEventOptions & { export const create = (state: StateFunc, keyboard: Keyboard, focused: IFocused, Cypress: ICypress) => { const isFirefox = Cypress.browser.family === 'firefox' const isWebKit = Cypress.isBrowser('webkit') + // Chromium 116+ allows the simulated events to be sent to disabled elements so we need to explicitly exclude them + const isChromium116OrLater = Cypress.isBrowser({ family: 'chromium' }) && Cypress.browserMajorVersion() >= 116 const sendPointerEvent = (el, evtOptions, evtName, bubbles = false, cancelable = false) => { const constructor = el.ownerDocument.defaultView.PointerEvent @@ -103,14 +105,14 @@ export const create = (state: StateFunc, keyboard: Keyboard, focused: IFocused, } const sendMouseup = (el, evtOptions) => { - if ((isFirefox || isWebKit) && el.disabled) { + if ((isFirefox || isWebKit || isChromium116OrLater) && el.disabled) { return {} } return sendMouseEvent(el, evtOptions, 'mouseup', true, true) } const sendMousedown = (el, evtOptions): {} | SentEvent => { - if ((isFirefox || isWebKit) && el.disabled) { + if ((isFirefox || isWebKit || isChromium116OrLater) && el.disabled) { return {} } @@ -133,21 +135,21 @@ export const create = (state: StateFunc, keyboard: Keyboard, focused: IFocused, } const sendClick = (el, evtOptions, opts: { force?: boolean } = {}) => { // send the click event if firefox and force (needed for force check checkbox) - if (!opts.force && (isFirefox || isWebKit) && el.disabled) { + if (!opts.force && (isFirefox || isWebKit || isChromium116OrLater) && el.disabled) { return {} } return sendMouseEvent(el, evtOptions, 'click', true, true) } const sendDblclick = (el, evtOptions) => { - if ((isFirefox || isWebKit) && el.disabled) { + if ((isFirefox || isWebKit || isChromium116OrLater) && el.disabled) { return {} } return sendMouseEvent(el, evtOptions, 'dblclick', true, true) } const sendContextmenu = (el, evtOptions) => { - if ((isFirefox || isWebKit) && el.disabled) { + if ((isFirefox || isWebKit || isChromium116OrLater) && el.disabled) { return {} } diff --git a/system-tests/projects/e2e/cypress/e2e/headless_old.cy.js b/system-tests/projects/e2e/cypress/e2e/headless_old.cy.js index f9458e537ee8..2c862c4acf93 100644 --- a/system-tests/projects/e2e/cypress/e2e/headless_old.cy.js +++ b/system-tests/projects/e2e/cypress/e2e/headless_old.cy.js @@ -1,5 +1,9 @@ describe('e2e headless old spec', function () { it('has expected launch args', function () { - cy.task('get:browser:args').should('contain', '--headless=old') + if (Cypress.isBrowser({ family: 'chromium' }) && Cypress.browserMajorVersion() >= 119) { + cy.fail('headless old is supported in Chromium >= 119, please update this system test.') + } + // TODO: re-enable this once https://bugs.chromium.org/p/chromium/issues/detail?id=1483163 is resolved + // cy.task('get:browser:args').should('contain', '--headless=old') }) }) diff --git a/system-tests/test/headless_old_spec.js b/system-tests/test/headless_old_spec.js index feeffc08cae2..0b1d151371d6 100644 --- a/system-tests/test/headless_old_spec.js +++ b/system-tests/test/headless_old_spec.js @@ -7,7 +7,9 @@ describe('e2e', () => { spec: 'headless_old.cy.js', browser: 'chrome', processEnv: { - CHROMIUM_USE_HEADLESS_OLD: 1, + // TODO: re-enable this once https://bugs.chromium.org/p/chromium/issues/detail?id=1483163 + // has been resolved and we have updated to a version of Chromium that includes the fix + // CHROMIUM_USE_HEADLESS_OLD: 1, }, }) })