Skip to content

Commit

Permalink
Merge branch 'develop' into lerna-optimize-tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
astone123 committed Sep 19, 2023
2 parents 29fea42 + 381b505 commit 8b5e904
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 9 deletions.
4 changes: 2 additions & 2 deletions browser-versions.json
Original file line number Diff line number Diff line change
@@ -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"
}
4 changes: 2 additions & 2 deletions packages/driver/cypress/e2e/commands/actions/click.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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)
})

Expand Down
12 changes: 7 additions & 5 deletions packages/driver/src/cy/mouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {}
}

Expand All @@ -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 {}
}

Expand Down
9 changes: 9 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,9 @@
describe('e2e headless old spec', function () {
it('has expected launch args', function () {
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')
})
})
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
15 changes: 15 additions & 0 deletions system-tests/test/headless_old_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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: {
// 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,
},
})
})

5 comments on commit 8b5e904

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8b5e904 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.0/linux-arm64/lerna-optimize-tasks-8b5e904b5b7f44885b2f79b5c97d01a27bfff905/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8b5e904 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.0/linux-x64/lerna-optimize-tasks-8b5e904b5b7f44885b2f79b5c97d01a27bfff905/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8b5e904 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.0/darwin-x64/lerna-optimize-tasks-8b5e904b5b7f44885b2f79b5c97d01a27bfff905/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8b5e904 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.0/darwin-arm64/lerna-optimize-tasks-8b5e904b5b7f44885b2f79b5c97d01a27bfff905/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8b5e904 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.0/win32-x64/lerna-optimize-tasks-8b5e904b5b7f44885b2f79b5c97d01a27bfff905/cypress.tgz

Please sign in to comment.