Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dblclick() doesn't work as click() #3798

Closed
learningandworking opened this issue Mar 21, 2019 · 5 comments · Fixed by #3030
Closed

dblclick() doesn't work as click() #3798

learningandworking opened this issue Mar 21, 2019 · 5 comments · Fixed by #3030
Labels
pkg/driver This is due to an issue in the packages/driver directory topic: actionability type: bug

Comments

@learningandworking
Copy link

learningandworking commented Mar 21, 2019

Current behavior:

Error: CypressError: cy.dblclick() failed because this element is not visible:

+

This element '<span#hrefIncAdt.pax-add.pax-enabled>' is not visible because its content is being clipped by one of its parent elements, which has a CSS property of overflow: 'hidden', 'scroll' or 'auto'

Fix this problem, or use {force: true} to disable error checking.

Desired behavior:

  • The double click function gets NO error as click function works.

Steps to reproduce: (app code and test code)

Having the code to demonstrate the issue as below

context('Drop-down with navigation', () =>{
        it.only('Check drop-down with navigation', ()=>{
            cy.visit('https://www.spicejet.com/')
            cy.get('.adult-infant-child').within(() => {
                cy.get('#divpaxinfo').click()
                    // choose number of adult
                    cy.get('#divAdult #hrefIncAdt').dblclick()
                    // choose number of child
                    cy.get('#divChild #hrefIncChd').click()

            })
        })
    })
  1. Run the code above => get error

  2. Work around:
    Replace the line
    cy.get('#divAdult #hrefIncAdt').dblclick()
    by
    cy.get('#divAdult #hrefIncAdt').click()

Versions

  "devDependencies": {
    "cypress": "^3.1.5",
    "cypress-xpath": "^1.3.0",
    "eslint-plugin-cypress": "^2.2.1"
  }

node version: v9.3.0
OS: MAC OS

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Mar 22, 2019

The dblclick command runs a check to ensureVisibility:

https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/commands/actions/click.coffee#L232-L234

But the click command goes through the actionability.verify:

https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/actionability.coffee#L206-L208

The dblclick should go through the same actionability.verify - for one thing, when using dblclick, it doesn't scroll the element into view before trying to click. As a workaround, can you try to scroll the element you want to dblclick into view before issuing the dblclick using the scrollIntoView command?

@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Mar 22, 2019
@jennifer-shehane jennifer-shehane added type: bug pkg/driver This is due to an issue in the packages/driver directory difficulty: 1️⃣ topic: actionability labels Mar 22, 2019
@learningandworking
Copy link
Author

Thanks for your comment @jennifer-shehane

Tried to add a command below, but it didn't work

cy.get('#divChild #hrefIncChd')
                      .scrollIntoView()
                      .dblclick()

@Konstruktour
Copy link

in one case where dblclick didn't work the following workaround helped... maybe it also helps u

cy.get(....)
    .then((element) => {
        element.click();
        element.click();
});

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: ready for work The issue is reproducible and in scope stage: needs review The PR code is done & tested, needs review labels Aug 8, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Sep 6, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: needs review The PR code is done & tested, needs review stage: work in progress labels Sep 25, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Oct 7, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Oct 11, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 11, 2019

The code for this is done in cypress-io/cypress#3030, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 23, 2019

Released in 3.5.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/driver This is due to an issue in the packages/driver directory topic: actionability type: bug
Projects
None yet
3 participants