wswebcreation / webdriver-image-comparison

MIT License
43 stars 36 forks source link

New feature: Adding scaling images functionality #50

Closed asterium closed 4 years ago

asterium commented 4 years ago

At the moment webdriver-image-comparison saves images and perform image comparison as is, not taking into account dpr of devices screenshots were taken from. As a result, when running tests on devices with different dpr compared to ones baseline screenshot was taken from, you often get false negative. I.e. images taken from macbook with retina display compared to image taken from regular display produce following result: (mismatch percentage is 77%)

image

Current PR tries to address this issue via functionality of resemble.js scaleToSameSize In order to enable such functionality one needs to add flag scaleToSameSize : true either to plugin configuration or directly the the method of comparing images, e.g. compareElements

Comparison result after applying rescaling: (mismatch percentage is 2%) image