zinserjan / wdio-screenshot

A WebdriverIO plugin. Additional commands for taking screenshots with WebdriverIO.
MIT License
109 stars 43 forks source link

BaseStrategy.setScrollArea endY is out of range #66

Open GaryAlway opened 7 years ago

GaryAlway commented 7 years ago

re: BaseStrategy.js

I updated the following code in order to debug your library as I was getting an exception when saving full document screenshots.

} else if (endY > documentHeight) { throw new Error(${endY} is out of range ${documentHeight}); }

The output is as follows:

Error: 2030 is out of range 2029 at MergeScreenshotStrategy.setScrollArea (node_modules/wdio-screenshot/lib/utils/strategies/BaseStrategy.js:48:15) at makeAreaScreenshot$ (node_modules/wdio-screenshot/lib/modules/makeAreaScreenshot.js:85:30) at tryCatch (node_modules/regenerator-runtime/runtime.js:64:40) at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:355:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:116:21) at tryCatch (node_modules/regenerator-runtime/runtime.js:64:40) at invoke (node_modules/regenerator-runtime/runtime.js:154:20) at node_modules/regenerator-runtime/runtime.js:164:13 at process._tickDomainCallback (internal/process/next_tick.js:129:7)

GaryAlway commented 7 years ago

I am still getting this error but only occasionally. Do you have any idea why this might be happening? Thanks

mansn commented 7 years ago

@GaryAlway I'm guessing that this relates to zinserjan/wdio-screenshot/pull/54. Not sure if it's going to get merged though, sounds like there might be some other solution being built.

emilyrohrbough commented 6 years ago

Currently, when using the wdio-visual-regression service, when using checkElement() and an element is larger than the viewport, the screenshot fails because the BaseStrategy attempts to scroll the element in view. The error outputs are a bit unclear as to why until digging through code.

Outputs typically received:

endX is out of range

or

endY is out of range

I have logged an issue to add an additional option to "crop" the element screenshot at the viewport edge: https://github.com/zinserjan/wdio-screenshot/issues/87