From 62f492b16c44fd8a1f68512c81fa0ba0b7591d8c Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Mon, 19 Jul 2021 16:36:23 -0400 Subject: [PATCH] chore(tests): ff headless click_spec, ff visibility_spec (#17397) --- .../commands/actions/click_spec.js | 72 ++++++++++++------- .../integration/dom/visibility_spec.ts | 4 +- 2 files changed, 47 insertions(+), 29 deletions(-) diff --git a/packages/driver/cypress/integration/commands/actions/click_spec.js b/packages/driver/cypress/integration/commands/actions/click_spec.js index a566f9544bdb..e2bbd0cc8c5c 100644 --- a/packages/driver/cypress/integration/commands/actions/click_spec.js +++ b/packages/driver/cypress/integration/commands/actions/click_spec.js @@ -4007,15 +4007,15 @@ describe('mouse state', () => { // TODO: add back assertion on Y values const coordsFirefox = { clientX: 494, - // clientY: 10, + clientY: 10, // layerX: 492, // layerY: 215, pageX: 494, pageY: 226, screenX: 494, - // screenY: 10, + screenY: 10, x: 494, - // y: 10, + y: 10, } let coords @@ -4030,8 +4030,7 @@ describe('mouse state', () => { } const mouseout = cy.stub().callsFake((e) => { - expect(_.toPlainObject(e)).to.containSubset({ - ...coords, + const exp = { altKey: false, bubbles: true, button: 0, @@ -4059,13 +4058,16 @@ describe('mouse state', () => { type: 'mouseout', view: cy.state('window'), // which: 0, - }) + } + + expect(_.pick(e, _.keys(exp))).to.containSubset(exp) + _.each(coords, (v, key) => expect(e[key], key).closeTo(v, 1)) e.target.removeEventListener('mouseout', mouseout) }).as('mouseout') + const mouseleave = cy.stub().callsFake((e) => { - expect(_.toPlainObject(e)).to.containSubset({ - ...coords, + const exp = { altKey: false, bubbles: false, button: 0, @@ -4094,13 +4096,16 @@ describe('mouse state', () => { type: 'mouseleave', view: cy.state('window'), // which: 0, - }) + } + + expect(_.pick(e, _.keys(exp))).to.containSubset(exp) + _.each(coords, (v, key) => expect(e[key], key).closeTo(v, 1)) e.target.removeEventListener('mouseleave', mouseleave) }).as('mouseleave') + const pointerout = cy.stub().callsFake((e) => { - expect(_.toPlainObject(e)).to.containSubset({ - ...coords, + const exp = { altKey: false, bubbles: true, button: -1, @@ -4129,13 +4134,15 @@ describe('mouse state', () => { type: 'pointerout', view: cy.state('window'), // which: 0, - }) + } + + expect(_.pick(e, _.keys(exp))).to.containSubset(exp) + _.each(coords, (v, key) => expect(e[key], key).closeTo(v, 1)) e.target.removeEventListener('pointerout', pointerout) }).as('pointerout') const pointerleave = cy.stub().callsFake((e) => { - expect(_.toPlainObject(e)).to.containSubset({ - ...coords, + const exp = { altKey: false, bubbles: false, button: -1, @@ -4164,13 +4171,15 @@ describe('mouse state', () => { type: 'pointerleave', view: cy.state('window'), // which: 0, - }) + } + + expect(_.pick(e, _.keys(exp))).to.containSubset(exp) + _.each(coords, (v, key) => expect(e[key], key).closeTo(v, 1)) e.target.removeEventListener('pointerleave', pointerleave) }).as('pointerleave') const mouseover = cy.stub().callsFake((e) => { - expect(_.toPlainObject(e)).to.containSubset({ - ...coords, + const exp = { altKey: false, bubbles: true, button: 0, @@ -4199,13 +4208,15 @@ describe('mouse state', () => { type: 'mouseover', view: cy.state('window'), // which: 0, - }) + } + + expect(_.pick(e, _.keys(exp))).to.containSubset(exp) + _.each(coords, (v, key) => expect(e[key], key).closeTo(v, 1)) e.target.removeEventListener('mouseover', mouseover) }).as('mouseover') const mouseenter = cy.stub().callsFake((e) => { - expect(_.toPlainObject(e)).to.containSubset({ - ...coords, + const exp = { altKey: false, bubbles: false, button: 0, @@ -4234,13 +4245,15 @@ describe('mouse state', () => { type: 'mouseenter', view: cy.state('window'), // which: 0, - }) + } + + expect(_.pick(e, _.keys(exp))).to.containSubset(exp) + _.each(coords, (v, key) => expect(e[key], key).closeTo(v, 1)) e.target.removeEventListener('mouseenter', mouseenter) }).as('mouseenter') const pointerover = cy.stub().callsFake((e) => { - expect(_.toPlainObject(e)).to.containSubset({ - ...coords, + const exp = { altKey: false, bubbles: true, button: -1, @@ -4269,13 +4282,15 @@ describe('mouse state', () => { type: 'pointerover', view: cy.state('window'), // which: 0, - }) + } + + expect(_.pick(e, _.keys(exp))).to.containSubset(exp) + _.each(coords, (v, key) => expect(e[key], key).closeTo(v, 1)) e.target.removeEventListener('pointerover', pointerover) }).as('pointerover') const pointerenter = cy.stub().callsFake((e) => { - expect(_.toPlainObject(e)).to.containSubset({ - ...coords, + const exp = { altKey: false, bubbles: false, button: -1, @@ -4304,7 +4319,10 @@ describe('mouse state', () => { type: 'pointerenter', view: cy.state('window'), // which: 0, - }) + } + + expect(_.pick(e, _.keys(exp))).to.containSubset(exp) + _.each(coords, (v, key) => expect(e[key], key).closeTo(v, 1)) e.target.removeEventListener('pointerenter', pointerenter) }).as('pointerenter') diff --git a/packages/driver/cypress/integration/dom/visibility_spec.ts b/packages/driver/cypress/integration/dom/visibility_spec.ts index 495efe3e06e3..9fc025fdbc5d 100644 --- a/packages/driver/cypress/integration/dom/visibility_spec.ts +++ b/packages/driver/cypress/integration/dom/visibility_spec.ts @@ -312,8 +312,8 @@ describe('src/cypress/dom/visibility', () => { `) this.$parentPointerEventsNone = add(`\ -
- parent pointer-events: none +
+ parent pointer-events: none
\ `)