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

Blackout area is offset from where it should be when upgrading to 9.7.0 from 9.5.4 #22173

Closed
sandy-farnsworth opened this issue Jun 7, 2022 · 14 comments · Fixed by #22756
Closed
Assignees
Labels
Reproducible Can be reproduced topic: cy.origin Problems or enhancements related to cy.origin command type: bug type: regression A bug that didn't appear until a specific Cy version release

Comments

@sandy-farnsworth
Copy link

sandy-farnsworth commented Jun 7, 2022

Current behavior

Blackout is not blacking out the specified area in 9.7.0. It seems to be trying, but the blacked out area is offset from where it should be.

This is my blackout area in Cypress 9.5.4:
blackout_9 5 4

I am attempting to upgrade to 9.7.0, and the wrong area is being blacked out. The tests haven't changed.
blackout_9 7 0

Desired behavior

Blackout the specified area.

Test code to reproduce

     cy.findByAutomationID(`drive`)
        .should(`be.visible`)
        .matchImageSnapshot({ blackout: [`[data-automation-id="drive-item-modified-date"]`] })

Cypress Version

9.7.0

Other

I also tried one or two Cypress 9.6 versions and saw the same behavior there. I am unable to upgrade past 9.5.4 since it breaks my visual tests that use blackout. It seems like blackout is still functioning, it's just blacking out the wrong area on the page. These tests have been working properly with all versions of Cypress since July, 2021.
The tests work great in Cypress 9.5.4.

@cypress-bot cypress-bot bot added stage: internal stage: investigating Someone from Cypress is looking into this and removed stage: internal labels Jun 8, 2022
@AtofStryker
Copy link
Contributor

Hey @sandy-farnsworth. Thank you for creating an issue! Would you be able to provide a reproduction to demonstrate the issue you are running into? I created a reproduction repository here that you are more than welcome to use. I was not able to reproduce it. It looks like you are using something similar to Google Drive, where I tried to create something similar. Here is the screenshot I received: drive screenshot -- screenshots

@sandy-farnsworth
Copy link
Author

@AtofStryker I will do that. Did you try with multiple elements?

@cypress-bot cypress-bot bot added stage: awaiting response Potential fix was proposed; awaiting response and removed stage: investigating Someone from Cypress is looking into this labels Jun 10, 2022
@AtofStryker
Copy link
Contributor

@AtofStryker I will do that. Did you try with multiple elements?

I did not, but what I will do right now is add a few other docs to the folder to help with your test case.

@AtofStryker
Copy link
Contributor

@sandy-farnsworth I added two more docs to the list. Hopefully this helps!
Screen Shot 2022-06-13 at 11 41 02 AM

@sandy-farnsworth
Copy link
Author

Thank you.

@sandy-farnsworth
Copy link
Author

I am still investigating the issue. I found that when I run my visual tests in the cypress test runner, that blackout is working properly. When I run my tests through CI, which uses the Cypress docker container for 9.7.0, the blackout area is offset. I am trying to track down what is causing that difference.

@jordanhennell
Copy link

jordanhennell commented Jun 16, 2022

I have noticed the same issue after upgrading. It appears to due to using jQuery's offset to calculate the top and left position of the blackout element, which returns values relative to the document. But then the blackout element is positioned absolutely.

The current workaround in my project is to set __cypress-blackout elements to position: fixed.

@AtofStryker
Copy link
Contributor

@jordanhennell I wonder if some of this got introduced in v9.6 with the cy.origin PR, since we refactored/changed some of the dimension calculation code. Are you able to provide a reproducible example by chance? I can see how this is a bug, but have had some issues getting it to show up.

@jordanhennell
Copy link

Indeed it does look to have been introduced when adding cross origin support. Got a small repro here, where it's attempting to blackout the English label.

cy.visit("https://www.wikipedia.org/")
    .get('.central-featured') // centered (margin: 0 auto) globe with languages around it
    .screenshot({
        blackout: ['[lang=en]']
    });

Wikipedia English Label Blackout

@cypress-bot cypress-bot bot added stage: investigating Someone from Cypress is looking into this and removed stage: awaiting response Potential fix was proposed; awaiting response labels Jun 17, 2022
@AtofStryker
Copy link
Contributor

@jordanhennell I got the same results from your test case. Thank you for providing that! Definitely a regression/bug.

@AtofStryker AtofStryker added type: bug type: regression A bug that didn't appear until a specific Cy version release topic: cy.origin Problems or enhancements related to cy.origin command labels Jun 17, 2022
@AtofStryker
Copy link
Contributor

reproduction is up to date here

@AtofStryker AtofStryker added the Reproducible Can be reproduced label Jun 17, 2022
@sandy-farnsworth
Copy link
Author

Thank you @jordanhennell !

@cypress-bot cypress-bot bot added stage: routed to e2e-core and removed stage: investigating Someone from Cypress is looking into this stage: routed to e2e-core labels Jun 21, 2022
@mjhenkes mjhenkes added stage: investigating Someone from Cypress is looking into this and removed stage: fire watch labels Jun 21, 2022
@cypress-bot cypress-bot bot added stage: routed to e2e-auth and removed stage: investigating Someone from Cypress is looking into this labels Jun 21, 2022
@AtofStryker AtofStryker removed their assignment Jun 21, 2022
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: routed to e2e-auth labels Jul 12, 2022
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jul 13, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 13, 2022

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

@chrisbreiding
Copy link
Contributor

Released in 10.3.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.3.1, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reproducible Can be reproduced topic: cy.origin Problems or enhancements related to cy.origin command type: bug type: regression A bug that didn't appear until a specific Cy version release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants