Skip to content

Commit

Permalink
chore(tests): ff headless click_spec, ff visibility_spec (#17397)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuceb authored Jul 19, 2021
1 parent 23edbc0 commit 62f492b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 29 deletions.
72 changes: 45 additions & 27 deletions packages/driver/cypress/integration/commands/actions/click_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/cypress/integration/dom/visibility_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ describe('src/cypress/dom/visibility', () => {
`)

this.$parentPointerEventsNone = add(`\
<div style="pointer-events: none;">
<span style="position: fixed; top: 20px;">parent pointer-events: none</span>
<div style="pointer-events: none">
<span style="position: fixed; left: 0; top: 50%;">parent pointer-events: none</span>
</div>\
`)

Expand Down

0 comments on commit 62f492b

Please sign in to comment.