As proof of concept on my ubuntu1804 virtual machine, I was able to get the `test_window_rect.py` tests to all pass with the following changes: ``` diff -r d1001fea6e4c testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py --- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py Tue Dec 03 19:06:29 2019 +0100 +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py Wed Dec 04 11:41:26 2019 -0800 @@ -17,8 +17,8 @@ self.max = self.marionette.execute_script(""" return { - width: window.screen.availWidth, - height: window.screen.availHeight, + width: window.outerWidth, + height: window.outerHeight, }""", sandbox=None) # WebDriver spec says a resize cannot result in window being @@ -180,8 +186,10 @@ # assume a window can be moved to (0,0) or less. elif os == "linux": # certain WMs prohibit windows from being moved off-screen + top_margin = self.marionette.execute_script(""" + return {top_margin: window.screen.availTop}""", sandbox=None) self.assertLessEqual(new_position["x"], 0) - self.assertLessEqual(new_position["y"], 0) + self.assertLessEqual(new_position["y"], top_margin) # On macOS, windows can only be moved off the screen on the # horizontal axis. The system menu bar also blocks windows from ``` So, the challenge now is to incorporate this to the core `driver.js` so on ubuntu1804 the expectations is to take into account `window.screen.availTop` into the height pixel calculation.
Bug 1600391 Comment 13 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
As proof of concept on my ubuntu1804 virtual machine, I was able to get the `test_window_rect.py` tests to all pass with the following changes: ``` diff -r d1001fea6e4c testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py --- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py Tue Dec 03 19:06:29 2019 +0100 +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py Wed Dec 04 11:41:26 2019 -0800 @@ -17,8 +17,8 @@ self.max = self.marionette.execute_script(""" return { - width: window.screen.availWidth, - height: window.screen.availHeight, + width: window.outerWidth, + height: window.outerHeight, }""", sandbox=None) # WebDriver spec says a resize cannot result in window being @@ -180,8 +186,10 @@ # assume a window can be moved to (0,0) or less. elif os == "linux": # certain WMs prohibit windows from being moved off-screen + top_margin = self.marionette.execute_script(""" + return {top_margin: window.screen.availTop}""", sandbox=None) self.assertLessEqual(new_position["x"], 0) - self.assertLessEqual(new_position["y"], 0) + self.assertLessEqual(new_position["y"], top_margin) # On macOS, windows can only be moved off the screen on the # horizontal axis. The system menu bar also blocks windows from ``` ``` 1575488612328 Marionette DEBUG 15 -> [0,6,"WebDriver:ExecuteScript",{"script":"return {\n width: window.outerWidth,\n height: window.out ... args":[],"filename":"testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py","sandbox":null,"line":22}] 1575488612333 Marionette DEBUG 15 <- [1,6,null,{"value":{"width":1280,"height":1040}}] 1575488612334 Marionette DEBUG 15 -> [0,7,"WebDriver:SetWindowRect",{"y":null,"x":null,"width":1270,"height":1030}] THIS IS AN ALERT12801270104010301575488612384 Marionette DEBUG 15 <- [1,7,null,{"x":28,"y":50,"width":1270,"height":1030}] 1575488612385 Marionette DEBUG 15 -> [0,8,"WebDriver:SetWindowRect",{"y":50,"x":28,"width":1280,"height":1040}] THIS IS AN ALERT12701280103010401575488612445 Marionette DEBUG 15 <- [1,8,null,{"x":28,"y":50,"width":1280,"height":1040}] 1575488612447 Marionette DEBUG 15 -> [0,9,"WebDriver:ExecuteScript",{"script":"return document.fullscreenElement;","newSandbox":true,"args":[],"filename":"testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py","sandbox":null,"line":41}] 1575488612456 Marionette DEBUG 15 <- [1,9,null,{"value":null}] 1575488612457 Marionette DEBUG 15 -> [0,10,"WebDriver:DeleteSession",{}] 0:12.52 TEST_END: PASS 0:12.52 INFO SUMMARY ------- 0:12.52 INFO passed: 13 0:12.52 INFO failed: 0 0:12.52 INFO todo: 0 0:12.52 SUITE_END marionette-test ~~~~~~~~~~~~~~~ Ran 13 checks (13 tests) Expected results: 13 Unexpected results: 0 OK ``` So, the challenge now is to incorporate this to the core `driver.js` so on ubuntu1804 the expectations is to take into account `window.screen.availTop` into the height pixel calculation.
As proof of concept on my ubuntu1804 virtual machine, I was able to get the `test_window_rect.py` tests to all pass with the following changes: ``` diff -r d1001fea6e4c testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py --- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py Tue Dec 03 19:06:29 2019 +0100 +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py Wed Dec 04 11:41:26 2019 -0800 @@ -17,8 +17,8 @@ self.max = self.marionette.execute_script(""" return { - width: window.screen.availWidth, - height: window.screen.availHeight, + width: window.outerWidth, + height: window.outerHeight, }""", sandbox=None) # WebDriver spec says a resize cannot result in window being @@ -180,8 +186,10 @@ # assume a window can be moved to (0,0) or less. elif os == "linux": # certain WMs prohibit windows from being moved off-screen + top_margin = self.marionette.execute_script(""" + return {top_margin: window.screen.availTop}""", sandbox=None) self.assertLessEqual(new_position["x"], 0) - self.assertLessEqual(new_position["y"], 0) + self.assertLessEqual(new_position["y"], top_margin) # On macOS, windows can only be moved off the screen on the # horizontal axis. The system menu bar also blocks windows from ``` ``` 1575488612328 Marionette DEBUG 15 -> [0,6,"WebDriver:ExecuteScript",{"script":"return {\n width: window.outerWidth,\n height: window.out ... args":[],"filename":"testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py","sandbox":null,"line":22}] 1575488612333 Marionette DEBUG 15 <- [1,6,null,{"value":{"width":1280,"height":1040}}] 1575488612334 Marionette DEBUG 15 -> [0,7,"WebDriver:SetWindowRect",{"y":null,"x":null,"width":1270,"height":1030}] THIS IS AN ALERT12801270104010301575488612384 Marionette DEBUG 15 <- [1,7,null,{"x":28,"y":50,"width":1270,"height":1030}] 1575488612385 Marionette DEBUG 15 -> [0,8,"WebDriver:SetWindowRect",{"y":50,"x":28,"width":1280,"height":1040}] THIS IS AN ALERT12701280103010401575488612445 Marionette DEBUG 15 <- [1,8,null,{"x":28,"y":50,"width":1280,"height":1040}] 1575488612447 Marionette DEBUG 15 -> [0,9,"WebDriver:ExecuteScript",{"script":"return document.fullscreenElement;","newSandbox":true,"args":[],"filename":"testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py","sandbox":null,"line":41}] 1575488612456 Marionette DEBUG 15 <- [1,9,null,{"value":null}] 1575488612457 Marionette DEBUG 15 -> [0,10,"WebDriver:DeleteSession",{}] 0:12.52 TEST_END: PASS 0:12.52 INFO SUMMARY ------- 0:12.52 INFO passed: 13 0:12.52 INFO failed: 0 0:12.52 INFO todo: 0 0:12.52 SUITE_END marionette-test ~~~~~~~~~~~~~~~ Ran 13 checks (13 tests) Expected results: 13 Unexpected results: 0 OK ``` So, the challenge now is to incorporate this to the core `driver.js` so on ubuntu1804 the expectations is to take into account `window.screen.availTop` into the height pixel calculation that would work in all situations.