Skip to content

Some jasmine tests fail depending on the screen resolution of the computer running the test #444

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

Closed
monfera opened this issue Apr 19, 2016 · 2 comments

Comments

@monfera
Copy link
Contributor

monfera commented Apr 19, 2016

When running tests in the Default resolution of a 13" MacBook, all of click_test.js passed; however, four failures were reported after increasing the resolution to the maximum in System Preferences. After much fiddling on my part, @etpinard suggested it may be to do with the browser window size. Indeed, the browser window was of a different size, depending on the resolution:

  • Default resolution: 1035 x 617
  • Highest resolution: 792 x 867

Manually resizing the already existing Chrome window and rerunning the test made it pass, confirming the suspicion that failure is due to less than expected viewport width.

@mdtusz
Copy link
Contributor

mdtusz commented Apr 19, 2016

Interesting. Is this because of the viewport width (and plots are being rendered at a different pixel-width?) or because of how OSX/Chrome handles pixel scaling when using the increased resolution mode (as in, does it use real pixel values or visible pixel values?).

In any case, it would probably be a good idea if we make sure all our tests have explicitly set widths and heights.

@monfera
Copy link
Contributor Author

monfera commented Apr 19, 2016

@mdtusz For this specific issue, it's the former. The devicePixelRatio is the same in both resolutions, the width was different (and Chrome even gave a different aspect ratio for the higher resolution mode). But in general it's true that there are multiple variables to consider, e.g.

  • The devicePixelRatio is important for Canvas and WebGL, because, without scaling up with it, the output will be pixelated (aliased). On a multimonitor setup, it can be different per monitor.
  • The browser zooming level is another variable. Maybe it's possible for it to get stuck at a non-100% level, failing a bunch of test cases.
  • Minimum font size might also impact pixel based comparisons, and potentially even jasmine tests.

I haven't tried to address these other variations in this little PR.

My $.02 is it's useful to set the screen size in test cases, e.g. to test window size responsiveness. It's also useful to have a basic window size for those type of tests that are not width/height sensitive or haven't (yet?) been sized explicitly. My immediate motivation was to be able to run the test suite without errors so it's but a small step.

etpinard added a commit that referenced this issue Apr 20, 2016
Specify window size for the karma chrome launcher (Fixes #444)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants