UI tests might pass when they should fail in some cases #21523
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
While working on another issue there was a UI tests where the expected image should have changed, but the UI test passed even without updating it.
Debugging through the code turned out that the problem is caused by the handling of the result of the compare command.
The error returned by the compare command is either a text error that says e.g. that image height or width differs or it is a numeric value that represents the number of pixels that differ.
The compare command of imagemagick automatically uses the precision configured for imagemagick. This is by default
6
. So all numbers that have more than 6 digits will be converted to an exponential notation.We used to use
parseInt
to parse the response, causing a (string) value like1.3223e+06
to be converted to1
. As we ignore all numbers lower than 10, a test would pass even though the pixel difference was a lot higher.@snake14 @AltamashShaikh I remember you mentioned a similar problem in the past, where we couldn't find a problem. Guess this should be fixed with this one.
Review