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

.should("be.visible") doesn't interpet elements with " style='transform: scale(0,0)' " correctly #723

Closed
mellogarrett opened this issue Oct 10, 2017 · 3 comments · Fixed by #5590 · May be fixed by ngChile/ngx-devkit-cypress-builder#20 or neo355/grafana#2

Comments

@mellogarrett
Copy link

@mellogarrett mellogarrett commented Oct 10, 2017

Current behavior:

.should('be.visible') recognizes elements with style="transform: scale(0,0)" as being visible.

Desired behavior:

.should('be.visible') should determine that elements with style="transform: scale(0,0)" are actually not visible

How to reproduce:

  1. create an element on a page that has style="transform: scale(0,0)"
  2. write test that checks that element's visibility like so: cy.get('#el').should('be.visible');

Additional Info (images, stack traces, etc)

screen shot 2017-10-10 at 4 08 01 pm

  • Operating System: Mac OS Sierra
  • Cypress Version: 1.0.1
  • Browser Version: Chrome 61
@jennifer-shehane

This comment has been minimized.

Copy link
Member

@jennifer-shehane jennifer-shehane commented Jun 11, 2019

Can recreate with following code. The span should clearly not be visible as it cannot be seen.

index.html

<!DOCTYPE html>
<html>
<head></head>
<body>
  <div style="transform: scale(0,0)">
    <span id="transform-scale">TRANSFORMERS</span>
  </div>
</body>
</html>

spec file

it('should not be visible', function () {
  cy.visit('index.html')

  cy.get('#transform-scale').should('be.visible')
  cy.get('#transform-scale').should('not.be.visible')
})

Added a failing test here: #4421

jennifer-shehane added a commit that referenced this issue Jun 12, 2019
jennifer-shehane added a commit that referenced this issue Jun 19, 2019
* Add failing test case for visible element within overflow hidden then position absolute element.

Addresses #4395

* Write failing test case for when parent is flex and overflow hidden with el outside bounds

Addresses #4161

* Wrote failing test for visibility outside of clip-path

Addresses #1178

* Add failing tests for transform scale

Addresses #723

* Add failing test for backfact-visibility hidden example

* cs -> js fixes

* Add more specific error when el is not element

* Always return as visible when checking html or body

* Add comments + rename methods to be more exact

* Add case for isHidden when visibility is collapse

* Add failing test cases for visibility issues

* Add comment about how ensureVisibility works under the hood

* Add checks and tests for opacity: 0 to be hidden

* Simplify if/case statements to be more readable

* Expand check for offset parents to also check children of ancestor for positioning attributes

close #4395
close #755

* Fix issue where els with parents with absolute position inside overflow hidden would be calculated as not visible

* comment out opacity checks for patch release

* Add more tests around new visibility assertions

- Add case to make sure display none is not on the option or optgroup
itself

* Fix failing assertion - where el was undefined when looking for visibiliyt

* remove commented out code involving opacity 😬
@cypress-bot

This comment has been minimized.

Copy link

@cypress-bot cypress-bot bot commented Dec 5, 2019

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

@cypress-bot

This comment has been minimized.

Copy link

@cypress-bot cypress-bot bot commented Dec 12, 2019

Released in 3.8.0.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 16, 2019
@cypress-io cypress-io unlocked this conversation Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.