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

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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

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)

having the same problem… any workarounds here? thanks

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

@drumslave-git Yes, your issue is because when run in headless mode we set XVFB to render at 1280x720, this is the size of the screen, so a screenshot cannot be taken larger than the actual screen.