This PR is based off of #18429.
UI tests should be passing for this PR
fixed another test failure + made some tweaks
@peterhashair I don't see this failure in https://app.travis-ci.com/github/matomo-org/matomo/builds/243453117 can you link to it?
@diosmosis seems to work in general. But I got this JS error when a report page is loaded: