webdriverio / visual-testing

Image comparison / visual regression testing for WebdriverIO
https://webdriver.io/docs/visual-testing
MIT License
109 stars 41 forks source link

Take advantage of built in support for full page screenshots #622

Open nextlevelbeard opened 6 hours ago

nextlevelbeard commented 6 hours ago

Is your feature request related to a problem? Please describe. Often, the full page screenshots are unreliable and contain ghosting of elements due to scrolling effects. For example: see https://github.com/webdriverio/visual-testing/issues/125

Describe the solution you'd like Multiple browsers have built in support for this that deliver a clean and ghost free image.

For Firefox, we can create a client side script that calls the :screenshot command. See docs here: https://firefox-source-docs.mozilla.org/devtools-user/taking_screenshots/index.html#taking-screenshots-with-the-web-console

Then execute it with the executor function in getFullPageScreenshotsDataDesktop: https://github.com/webdriverio/visual-testing/blob/b40be9ddd0b8a370ac50c1e49cd6006a5225ca41/packages/webdriver-image-comparison/src/methods/screenshots.ts#L352

Describe alternatives you've considered

We could also call the webdriverIO API: browser.fullPageScreenshot(), if the browser is available to us. https://webdriver.io/docs/api/gecko/#fullpagescreenshot

christian-bromann commented 6 hours ago

We should update the saveScreenshot command in WebdriverIO core to use WebDriver Bidi primitives for taking screenshots. They provide full flexibility including full page screenshots.