Galooshi / happo

Visual diffing in CI for user interfaces
504 stars 16 forks source link

Wait for images defined in srcset attributes #223

Closed trotzig closed 6 years ago

trotzig commented 6 years ago

This commit is a port of changes I've made to the new runner for happo.io. By waiting for images in srcset attributes, we can prevent spurious diffs.

Instead of trying to figure out which one of the images will be displayed in the current viewport, I decided to download all. The tradeoff here being simplicity over performance (dowloading only one of the images would be faster).

While running tests locally, I noticed that I was getting 2x images compared to what's in CI. I decided to make the assertions a little looser to account for both 1x and 2x screenshots.