question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests fail when run on high resolution monitors

See original GitHub issue

What MDC-Web Version are you using?

0.6.0

What browser(s) is this bug affecting?

NA, however it is happening on a 4k monitor

What OS are you using?

16.04.2 LTS

What are the steps to reproduce the bug?

  1. Procure a high resolution monitor
  2. Pull on master and make no changes
  3. Run npm run test
  4. Observe the failed test

What is the expected behavior?

Expect the tests to pass

What is the actual behavior?

The console complains with the following:

Chrome 56.0.2924 (Linux 0.0.0) MDCSimpleMenu adapter#getAnchorDimensions returns the dimensions of the anchor container FAILED
	AssertionError: expected 20.99609375 to equal 21
	    at Context.<anonymous> (webpack:///test/unit/mdc-menu/mdc-simple-menu.test.js:311:9 <- test/unit/index.js:16729:16)

Any other information you believe would be useful?

I have not been able to reproduce the issue on any computer that has monitor specs similar to a Macbook Pro’s retina display or lower.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
anton-kachurincommented, Mar 16, 2017

Was able to reproduce the bug by running Chrome with --force-device-scale-factor flag with a fractional value:

diff --git a/karma.conf.js b/karma.conf.js
index f094b67..6eb0447 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -21,6 +21,10 @@ const USING_TRAVISCI = Boolean(process.env.TRAVIS);
 const USING_SL = Boolean(process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY);

 const SL_LAUNCHERS = {
+  'chrome-device-scale': {
+    base: 'Chrome',
+    flags: ['--force-device-scale-factor=1.33'],
+  },
   'sl-chrome-stable': {
     base: 'SauceLabs',
     browserName: 'chrome',
@@ -165,5 +169,5 @@ module.exports = function(config) {
 };

 function determineBrowsers() {
-  return USING_SL ? Object.keys(SL_LAUNCHERS) : ['Chrome'];
+  return USING_SL ? Object.keys(SL_LAUNCHERS) : ['chrome-device-scale'];
 }

Getting exactly the same error:

Chrome 56.0.2924 (Windows 10 0.0.0) MDCSimpleMenu adapter#getAnchorDimensions returns the dimensions of the anchor container FAILED
        AssertionError: expected 20.9938907623291 to equal 21
            at Context.<anonymous> (webpack:///test/unit/mdc-menu/mdc-simple-menu.test.js:311:9 <- test/unit/index.js:15487:16)

@amsheehan, you probably will be able to choose some --force-device-scale-factor value which will prevent the test from failing. Most likely --force-device-scale-factor=1 will solve the problem.

0reactions
moog16commented, Jul 6, 2018

@abhiomkar, you tried to reproduce and weren’t able to. I’m going to close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: screen resolution seems to change between runs on
In an attempt to figure out the issue, we wrote a script to create a warning when the resolution is not a multiple...
Read more >
3DMark - [Problem] Desktop 1080p / Test 2K
Hi, I'm unable to do tests at higher resolutions because the switching from 1080p to 2K, 3DMark shows an error that tests are...
Read more >
Test failed on different monitor selenium webdriver java
when i execute code in office mean when i am connected with 2 screens every test case work fine both on laptop and...
Read more >
Windows 10 Screen Resolution error test box
I'm running windows 10 on a Lenovo computer. Every time I start my computer there is a screen resolution error box in the...
Read more >
Change desktop screen resolution in Selenium tests
By default, on BrowserStack, all Selenium tests that run on desktop run on a screen resolution of 1920x1080 . In this guide, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found