Comparing a screen to its version in the previous execution or comparing a div to a baseline of itself is pretty straightforward. We use expressions like the following ones to do so.
compare screen to previous version
compare image of "my_div" to previous version with allowance of "5%"
compare screen to previous version with allowance of "5%" treating error as "minor"
It's comparing a screen or a div to an image stored in test data that can be a bit more complex. The commands are similar.
compare screen to stored value "Saved Screenshot" treating error as "minor"
compare image of "logo" to stored value "logoFile" with allowance of "5%"
However, there is one key thing that must be taken into consideration when using the latter method...screen resolution. testRigor uses pixel-by-pixel comparison, which means that images in test data have to be as close in size as possible to the size of the screen or div they are being compared to. The screen resolution in the test suite settings must also be taken into account. For best results, the image uploaded into test data should be taken or cropped from a full-sized screenshot taken by testRigor. An image taken or cropped from a computer that has a different screen resolution from the one in the test suite settings will not match a reasonably low allowance.
An allowance set too low, may make for an unrealistic expectation, while an allowance set too high may end up defeating the purpose of a validation. This is also true for the discrepancy between images used in test data and images on the screen. In this case, when the image in test data matches the one on the screen, testRigor can identify the location of the click. This is used to interact with images that have no other way to be targeted or referenced (e.g., you need to click on an image on a canvas or a clear image inside a larger image).
click on image from stored value "Logo"
click on image from stored value "Logo" with less than "10" % discrepancy
click on the 6th element by image from stored value "logo" with less than "10" % discrepancy
The default discrepancy is 20%.