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.

3.5.0-3.6.1 regression screenshot on element can be out of bounds

See original GitHub issue

Current behavior:

We take a screenshot of an element:

image

which is clearly within bounds but we get the following error from cypress:

RangeError [ERR_OUT_OF_RANGE] [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 7423996. Received -6368
at boundsError (internal/buffer.js:58:9)
at Buffer.readUInt32BE (internal/buffer.js:205:5)
at Jimp.<anonymous> (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\@jimp\plugin-crop\dist\index.js:46:37)
at scan (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\@jimp\utils\dist\index.js:46:9)
at Jimp.scanQuiet (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\@jimp\core\dist\index.js:1308:32)
at Jimp.cropQuiet (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\@jimp\plugin-crop\dist\index.js:45:12)
at Jimp.(anonymous function) [as crop] (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\@jimp\core\dist\index.js:1222:23)
at crop (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\lib\screenshots.js:145:26)
at d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\lib\screenshots.js:362:19
at tryCatcher (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:729:18)
at _drainQueueStep (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (d:\work\1\s\node_modules\.azure_pipeline_cypress_cache\3.6.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (internal/timers.js:443:21)

so somehow, cypress thinks the element begins at -6368.

Steps to reproduce: (app code and test code)

I can try and work on a small repro case, but I wanted to check first to see if there are any other reports (cannot find myself in github issues) or you have an idea of what to check?

Also, I’m not particularly bothered by this issue as I will just change the screenshots to be full page in this case - they are only shaving off a few pixels.

Versions

3.6.1, windows 10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
artipsinghcommented, Jun 15, 2020

Hi @jennifer-shehane I am getting an element out of bounds exception with some element.

cypress 4.0.2 cypress-plugin-snapshots 1.2.9 cypress-visual-regression 1.0.5 @jennifer-shehane can I DM you my test with the failing line?

 RangeError: The value of "offset" is out of range. It must be >= 0 and <= 4382396. Received -3312
  RangeError [ERR_OUT_OF_RANGE] [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 4382396. Received -3312
      at boundsError (internal/buffer.js:72:9)
      at Buffer.readUInt32BE (internal/buffer.js:295:5)
      at Jimp.<anonymous> (/Users/artisingh/Library/Caches/Cypress/4.0.2/Cypress.app/Contents/Resources/app/packages/server/node_modules/@jimp/plugin-crop/dist/index.js:45:37)
2reactions
aronmgvcommented, Nov 22, 2019

having the same problem… any workarounds here? thanks

it happens only via cypress run, does not happen with cypress open…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to capture the screenshot of a specific element rather ...
This program captures the screenshot of the whole page and crop the element based on its location. The element image will be available...
Read more >
screenshot - Cypress Documentation
Cypress then automatically takes a screenshot when the test fails, but it is possible something in your application changed within this 100ms timeframe....
Read more >
Taking screenshots — Firefox Source Docs documentation
With this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the...
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