-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Calling screenshot() on an element that changes sizes after scrolling throws 'is invalid for option "size"' exception #6099
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
Comments
Thanks @jennifer-shehane! I currently have a WIP branch that I can put a PR up for, which fixes this issue for us:
Additionally, here are a few other ways I've thought of to fix the issue so far:
|
This is still failing in 4.9.0. Full reproducible example:
<html>
<body>
<main style="transform: scaleY(10); background-color: blue; height: 50vh; transition: 10s;"></main>
<script>
window.addEventListener('scroll', () => {
const main = document.getElementsByTagName('main')[0]
main.style.transform = "scaleY(1)";
})
</script>
</body>
</html>
it('screenshot element', () => {
cy.visit('index.html')
cy.get('main').screenshot()
}) |
I've noticed that this issue isn't only related to changing the size after scrolling, there's also a bug with elements that extend beyond the top of the viewport. I've created a new issue here: #7966 |
The code for this is done in cypress-io/cypress#7962, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
Using the screenshot command on an element that changes sizes after scrolling causes an exception to be thrown when trying to stitch them together.
Desired behavior:
The screenshot command should properly create an image instead of throwing an exception.
Steps to reproduce:
See: https://github.com/Keysox/cypress-screenshot-issue
Versions
Cypress: 3.8.1
The text was updated successfully, but these errors were encountered: