Skip to content

UI tests might pass when they should fail in some cases #21523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2023
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Nov 13, 2023

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 like 1.3223e+06 to be converted to 1. 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

@sgiehl sgiehl added c: Tests & QA For issues related to automated tests or making it easier to QA & test issues. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Nov 13, 2023
@sgiehl sgiehl added this to the 5.0.0 milestone Nov 13, 2023
@sgiehl sgiehl requested a review from a team November 13, 2023 09:33
Copy link
Contributor

@michalkleiner michalkleiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked in a browser console and the change works as expected.

@sgiehl
Copy link
Member Author

sgiehl commented Nov 13, 2023

Will merge this one now. The remaining failing tests will be fixed separately.

@sgiehl sgiehl merged commit 3956094 into 5.x-dev Nov 13, 2023
@sgiehl sgiehl deleted the fixuitestissue branch November 13, 2023 12:24
sgiehl added a commit that referenced this pull request Nov 13, 2023
sgiehl added a commit that referenced this pull request Nov 13, 2023
@snake14
Copy link
Contributor

snake14 commented Nov 13, 2023

@sgiehl Thank you for figuring out the issue and fixing it. I believe that this should resolve issue #21244

@AltamashShaikh
Copy link
Contributor

Thanks @sgiehl :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Tests & QA For issues related to automated tests or making it easier to QA & test issues. Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Development

Successfully merging this pull request may close these issues.

4 participants