wdspec - fix for set window rect tests.
draft
--- 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"]})