question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calling screenshot() on an element that changes sizes after scrolling throws 'is invalid for option "size"' exception

See original GitHub issue

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.

RangeError: The value "-36960000" is invalid for option "size"
    at Function.allocUnsafe (buffer.js:272:3)
    at Jimp.cropQuiet (Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/@jimp/plugin-crop/dist/index.js:42:27)
    at Jimp.<computed> [as crop] (Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/@jimp/core/dist/index.js:1266:23)
    at crop (Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/packages/server/lib/screenshots.js:145:26)
    at Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/packages/server/lib/screenshots.js:209:22
    at arrayEach (Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/lodash/lodash.js:9342:14)
    at stitchScreenshots (Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/packages/server/lib/screenshots.js:206:7)
    at Library/Caches/Cypress/3.8.1/Cypress.app/Contents/Resources/app/packages/server/lib/screenshots.js:350:21
    at processImmediate (internal/timers.js:439:21)

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jennifer-shehanecommented, Jul 7, 2020

This is still failing in 4.9.0. Full reproducible example:

index.html

<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>

spec.js

it('screenshot element', () => {
  cy.visit('index.html')
  cy.get('main').screenshot()
})
Screen Shot 2020-07-07 at 11 19 20 AM
0reactions
cypress-bot[bot]commented, Jul 21, 2020

Released in 4.11.0.

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use Touch Actions in Appium: Swipe Tap Touch
Press by using an element and duration (in seconds); Press by using x,y coordinates, and duration (in seconds); Horizontal swipe by using the ......
Read more >
HTML2Canvas does not render full div, only what is visible on ...
I'm using v5 beta 3. When this code runs, it only renders what is visible on the screen. The #potenzial-page div is essentially...
Read more >
Common issues and resolutions for Power Apps
This article lists some common issues that you might encounter while using Power Apps. Where applicable, workarounds are provided. Note. For ...
Read more >
ImageView - Android Developers
android:accessibilityLiveRegion, Indicates to accessibility services whether the user should be notified when this view changes.
Read more >
Modal | Components - BootstrapVue
These buttons can be customized by setting various props on the component. You can customize the size of the buttons, disable buttons, hide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found