wdspec - fix for set window rect tests. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 09 Aug 2018 10:20:21 +0200
changeset 827836 46de4913cc16dfa50f34978601b97a25586fdfd1
parent 827835 056a3c3fcc42cf5e22bfa979b0390b3d88d83b65
child 827837 13e397e92d5ca9e372a4caeed11e58f0b8276c05
child 828825 9c0d106e4236e0b7c1dccec73cbd59fb646bc017
push id118590
push userbmo:hskupin@gmail.com
push dateThu, 09 Aug 2018 09:14:15 +0000
milestone63.0a1
wdspec - fix for set window rect tests. MozReview-Commit-ID: QwjybBxtBN
testing/web-platform/tests/webdriver/tests/set_window_rect/set.py
--- a/testing/web-platform/tests/webdriver/tests/set_window_rect/set.py
+++ b/testing/web-platform/tests/webdriver/tests/set_window_rect/set.py
@@ -163,16 +163,21 @@ def test_restore_from_maximized(session)
 
     response = set_window_rect(session, {"width": 400, "height": 400})
     value = assert_success(response)
     assert value["width"] == 400
     assert value["height"] == 400
 
 
 def test_height_width(session):
+    # The window position might be auto-adjusted by the browser
+    # if it exceeds the lower right corner. As such ensure that
+    # there is enough space left so no window move will occur.
+    session.window.position = (50, 50)
+
     original = session.window.rect
     max = session.execute_script("""
         return {
           width: window.screen.availWidth,
           height: window.screen.availHeight,
         }""")
 
     response = set_window_rect(session, {
@@ -245,20 +250,24 @@ def test_negative_x_y(session):
         assert rect["y"] <= 0
         assert rect["width"] == original["width"]
         assert rect["height"] == original["height"]
 
     # On macOS, windows can only be moved off the screen on the
     # horizontal axis.  The system menu bar also blocks windows from
     # being moved to (0,0).
     elif os == "mac":
-        assert_success(response, {"x": -8,
-                                  "y": 23,
-                                  "width": original["width"],
-                                  "height": original["height"]})
+        value = assert_success(response)
+
+        avail_top = session.execute_script("return window.screen.availTop;")
+
+        assert value == {"x": -8,
+                         "y": avail_top,
+                         "width": original["width"],
+                         "height": original["height"]}
 
     # It turns out that Windows is the only platform on which the
     # window can be reliably positioned off-screen.
     elif os == "windows":
         assert_success(response, {"x": -8,
                                   "y": -8,
                                   "width": original["width"],
                                   "height": original["height"]})