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

Element is hidden by parent but should('not.be.visible') fails #683

Closed
bahmutov opened this issue Sep 22, 2017 · 3 comments
Closed

Element is hidden by parent but should('not.be.visible') fails #683

bahmutov opened this issue Sep 22, 2017 · 3 comments
Labels
pkg/driver This is due to an issue in the packages/driver directory topic: visibility 👁 type: unexpected behavior User expected result, but got another

Comments

@bahmutov
Copy link
Contributor

All versions of Cypress

I created the test (skipped for now) in https://github.com/bahmutov/element-e2e-tests/blob/201dba8758e70fd9fa9b6c5e0669237889c574f4/cypress/integration/steps-spec.js#L60-L65

  it.skip('hides code by default', () => {
    // hmm, the element is behind other elements, why
    // is it visible?
    firstSteps()
      .find('.highlight code').should('not.be.visible')
  })

The element .highlight code is inside parent .meta div. I expect the element .highlight code to NOT be visible, by Cypress thinks it is.

screen shot 2017-09-22 at 11 15 06 am

The DOM (note parent .meta div)

screen shot 2017-09-22 at 11 18 40 am

The problem is that .meta div has a border of 1 pixel, which is visible. Thus, our visibility algorithm thinks the .highlight code inside is visible too. This is incorrect - only the parent's border is visible, the children inside cannot be seen: the border pushes them out, and there is overflow: hidden

screen shot 2017-09-22 at 11 18 26 am

@bahmutov bahmutov added type: bug type: unexpected behavior User expected result, but got another labels Sep 22, 2017
@jennifer-shehane
Copy link
Member

Related: #677

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jun 10, 2019

This issue no longer occurs in Cypress version 3.3.1. It's a bit hard to tell whether this is because Cypress fixed the issue or because the application code in question has changed (since the original reproduction visits a public url instead of a statically provided HTML).

Either way, we will close since this is no longer reproducible.

Screen Shot 2019-06-10 at 3 14 57 PM

The code below now passes

it('hides code by default', () => {
  cy.visit("http://element.eleme.io/#/en-US/component")
  cy.contains('.nav-item', 'Steps').click()
  cy.get('.demo-steps').first()
    .find('.highlight code').should('not.be.visible')
})

@jennifer-shehane jennifer-shehane removed the stage: needs investigating Someone from Cypress needs to look at this label Jun 10, 2019
@avallete
Copy link
Contributor

avallete commented Jun 1, 2021

This issue occured to me while working with radix-ui "drawer" element on mobile.

I'll try to setup a MWE to debug this issue ASAP. But the bug is still here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/driver This is due to an issue in the packages/driver directory topic: visibility 👁 type: unexpected behavior User expected result, but got another
Projects
None yet
Development

No branches or pull requests

3 participants