Crunch-io / nightwatch-vrt

Visual Regression Testing tools for nightwatch.js
MIT License
64 stars 20 forks source link

UnhandledPromiseRejectionWarning: RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range #22

Open bkosse opened 6 years ago

bkosse commented 6 years ago

When using Firefox Geckodriver, vrt returns the following error when capturing a screenshot of the specified element:

(node:24488) UnhandledPromiseRejectionWarning: RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 7253872. Received -1179984 at boundsError (internal/buffer.js:55:9) at Buffer.readUInt32BE (internal/buffer.js:198:5) at Jimp.<anonymous> (D:\TFS\Wavin\Wavin_SXP_TestAutomation\Nightwatch\node_modules\jimp\index.js:896:37) at Jimp.scan (D:\TFS\Wavin\Wavin_SXP_TestAutomation\Nightwatch\node_modules\jimp\index.js:679:15) at Jimp.crop (D:\TFS\Wavin\Wavin_SXP_TestAutomation\Nightwatch\node_modules\jimp\index.js:895:10) at Jimp.read.then (D:\TFS\Wavin\Wavin_SXP_TestAutomation\Nightwatch\node_modules\nightwatch-vrt\commands\captureElementScreenshot.js:65:24) at process._tickCallback (internal/process/next_tick.js:68:7) (node:24488) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:24488) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This error does not occur when using Chromedriver.

nightwatch: v0.9.21 vrt: v0.2.6 Geckodriver: v0.21.0 Selenium Standalone Server: v3.13.0

Element specifications: y = -156.1999969482422 height = 1115.199951171875 screenshot.bitmap.height = 959

x = 0 width = 1891 screenshot.bitmap.width = 1891

digitalresistor commented 6 years ago

Do you have a sample that I can use to re-create this issue?

ihorsavka commented 6 years ago

Same here

bkosse commented 6 years ago

Basically the issue occurs when the selected element exceeds the viewport of the browser. But only in Firefox.

So on this page (https://github.com/Crunch-io/nightwatch-vrt/issues/22) when trying to capture the element with class .js-discussion the error occurs.

browser.assert.screenshotIdenticalToBaseline(element, '.js-discussion');

Qvatra commented 5 years ago

have exactly the same for chrome

apboon commented 3 years ago

Same here. Chrome 88.

issue occurs when the selected element exceeds the viewport of the browser

I must agree. I was trying screenshotIdenticalToBaseline on body and in some cases the body's height exceeded the browser's viewport. My temporary solution / workaround: I'm adding style body { height: 100%; } before comparison.

Pverma96 commented 3 years ago

Same here. Chrome 88.

issue occurs when the selected element exceeds the viewport of the browser

I must agree. I was trying screenshotIdenticalToBaseline on body and in some cases the body's height exceeded the browser's viewport. My temporary solution / workaround: I'm adding style body { height: 100%; } before comparison.

@apboon Could you please elaborate a little more about your workaround and where have you added the style in the project.

apboon commented 3 years ago

Not any particular location in my project. I just made sure the style was applied with the objective of the thing that a wanted to capture isn't larger than the browser's viewport.