capybara-screenshot-diff icon indicating copy to clipboard operation
capybara-screenshot-diff copied to clipboard

Full page screenshots

Open lwassermann opened this issue 1 year ago • 3 comments

I'm currently evaluating adding this gem for visual regression testing. Thank you for all your work. I was quite worried about the image diffing until I found this gem 🙇.

Most of our screenshots are of different heights. We can just set a rather high screen height. But that would be adding a lot of whitespace to many of the images, and might require the occasional tweaking.

I've seen in the Selenium API that it's possible to send full_page: true as an option to save_screenshot. Would you welcome a patch where we add it to the screenshot-options -> capture_options -> Screenshoter#browser_save_screenshot -> Capybara/Selenium?

(Some more background: Unfortunately, this feature does not currently work in Chrome. This closed issue is the closest to a reason I have found.)

lwassermann avatar Jun 10 '24 18:06 lwassermann

I thought a bit and the screenshot-options -> capture_options way sounds not that great. I think we want all screenshots to be full_page: true. Repeating that in each test would add a bit of noise. Maybe a setting in the configuration? That would also enable them to be different for each driver. But I'm not quite sure how to reach that data from the Screenshoter yet.

lwassermann avatar Jun 11 '24 07:06 lwassermann

I think we will provide some interface to bypass capybara save_screenshot settings globally and not globally. I'll check this on the weekend, if others would not handle it before.

pftg avatar Jun 11 '24 09:06 pftg

I've been thinking about your suggestion. I understand that using full-page screenshots can be challenging when it comes to maintaining consistency and dealing with larger file sizes to store screenshots.

However, have you considered adjusting the window size before taking a screenshot? There's an option for this already, and it could potentially address the issues you've encountered.

pftg avatar Jun 11 '24 09:06 pftg

@lwassermann sorry for late PR. Please check

pftg avatar Jul 12 '24 16:07 pftg

Thank you for adjusting the proposal, and for merging it in 🙇

lwassermann avatar Jul 16 '24 13:07 lwassermann