You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
cy.click will not respect either coordinate option if it is passed as 0. This is because a truthy comparison is used to set the default option, when it should really check if it is a finite number.
This issue is most likely present on right click and double click as well.
Desired behavior:
x and y parameters can be 0 and the function will behave as it does for all other number values (and click the top left of the element).
Test code to reproduce
it('can specify x and/or y to be 0',()=>{const$btn=$('<button id="click-button">clicking button</button>').prependTo(cy.$$('body'))constposition=$btn.offset()cy.on('log:changed',(log,attr)=>{if(log.name==='click'&&attr._emittedAttrs.coords){constargs=attr._emittedAttrs.message.split(', ').map((i)=>parseInt(i))constcoords=attr._emittedAttrs.coordsexpect(coords.x).to.equal(coords.left)expect(coords.y).to.equal(coords.top)expect(coords.x).to.equal(position.left+args[0])expect(coords.y).to.equal(position.top+args[1])}})cy.get('#click-button').click(2,2)cy.get('#click-button').click(0,0)cy.get('#click-button').click(0,2)cy.get('#click-button').click(2,0)})
The text was updated successfully, but these errors were encountered:
I was a little unsure what the behavior was before from the description, but basically it would click 'center' which is the default position and ignore all coords. Example:
it('click 0 x coord',()=>{cy.visit('https://example.cypress.io//commands/actions')cy.get('#action-canvas').click(0,20)});it('click 0 y coord',()=>{cy.visit('https://example.cypress.io//commands/actions')cy.get('#action-canvas').click(20,0)});it('click 0 x 0 coord',()=>{cy.visit('https://example.cypress.io//commands/actions')cy.get('#action-canvas').click(0,0)});
The code for this is done in cypress-io/cypress#7339, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Current behavior:
cy.click
will not respect either coordinate option if it is passed as 0. This is because a truthy comparison is used to set the default option, when it should really check if it is a finite number.This issue is most likely present on right click and double click as well.
Desired behavior:
x
andy
parameters can be 0 and the function will behave as it does for all other number values (and click the top left of the element).Test code to reproduce
The text was updated successfully, but these errors were encountered: