Skip to content
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

Re-enable Dashboard UI tests #8163

Merged
merged 3 commits into from Jun 22, 2015
Merged

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jun 21, 2015

fixes #8142 #8034

It looks like resemble causes the random crashes during UI tests on Travis CI. I can reproduce this locally and identified resemble as the problem. The tests crashed because of too much memory usage.
We now avoid loading the images into PhantomJS to compare them and we use resemble.js only as a fallback if there's a threshold defined (which is currently only the case for ImageGraph tests). The dashboard tests failed since the images are pretty long. By executing ImageMagick we seem to save a lot of memory and time. Eg currently on master the tests need more than 50 minutes whereas with this solution it takes only approx 37 minutes. This explains why the UI test build take longer the more failing tests there are as more pictures need to be compared using resemble (which is slow). So for green tests the time difference might be actually much less.

It should also fix a problem with resemble that we probably often not compared the whole image in tests. From the Resemble.js docs:

By default, the comparison algorithm skips pixels when the image width or height is larger than 1200 pixels. This is there to mitigate performance issues.

To fix this I do now set a largeImageThreshold parameter.

To improve performance of ImageMagick further I wanted to set an option to stop comparing as soon as there is at least one pixel difference but did not find such option.

FYI: https://developer.piwik.org/guides/tests-ui already mentions the requirement of ImageMagick. I was thinking about adding a check whether compare command exists in ./console tests:run-ui but decided not to as it I'm not sure re Windows etc. When compare does not exist there should be an error message once a screenshot is actually compared.

I'm not sure if we should merge directly. Ideally we would make master green before merging this one but in most cases the tests on master take more than 50 minutes which makes this a bit hard.

@tsteur tsteur added 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 labels Jun 21, 2015
@tsteur tsteur added this to the 2.14.0 milestone Jun 21, 2015
tsteur and others added 2 commits June 22, 2015 00:53
It looks like resemble causes the random crashes during UI tests
on Travis CI. I can reproduce this locally and identified resemble
as the problem. The tests crashed because of too much memory usage
We now also avoid loading the images into PhantomJS to compare
them. By executing ImageMagick we seem to save a lot of memory and
time. Eg currently on master the tests need more than 50
minutes whereas with this solution it takes only approx 37 minutes.
@tsteur tsteur force-pushed the avoid_resemble_comparison_if_possible branch from ce7d353 to 3d100bd Compare June 22, 2015 00:53
@tsteur
Copy link
Member Author

tsteur commented Jun 22, 2015

This PR also fixes an issue that we did not detect all UI regressions. Eg there was always a default tolerance in resemble.js that ignored small changes of a color. Eg if one only made the border slightly lighter it was not detected by resemble.js. I changed the file directly here but also issued a PR: rsmbl/Resemble.js#44

tsteur added a commit that referenced this pull request Jun 22, 2015
@tsteur tsteur merged commit 4fd9581 into master Jun 22, 2015
@tsteur tsteur deleted the avoid_resemble_comparison_if_possible branch June 22, 2015 02:12
@tsteur tsteur removed the Needs Review PRs that need a code review label Jun 22, 2015
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jun 24, 2015
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. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants