зеркало из https://github.com/mozilla/gecko-dev.git
bug 1492499: webdriver: take 22px window border into account on maximizing; r=automatedtester,whimboo
On some systems and window managers, such as macOS and when X11 forwarding an application across systems, there exists a 22px window border that we cannot detect or do anything about. As this test is to verify that the width/height changed beyond 800x600, this assertion change should make the tests pass on more configurations. Depends on D8409 Differential Revision: https://phabricator.services.mozilla.com/D8410 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
327a967b87
Коммит
51c24a94ae
|
@ -5,7 +5,8 @@ import pytest
|
|||
from webdriver.transport import Response
|
||||
|
||||
from tests.support.asserts import assert_error, assert_success
|
||||
from tests.support.helpers import document_hidden, is_fullscreen
|
||||
from tests.support.helpers import (available_screen_size, document_hidden,
|
||||
is_fullscreen, screen_size)
|
||||
|
||||
|
||||
def set_window_rect(session, rect):
|
||||
|
@ -172,38 +173,31 @@ def test_height_width(session):
|
|||
session.window.position = (50, 50)
|
||||
|
||||
original = session.window.rect
|
||||
max = session.execute_script("""
|
||||
return {
|
||||
width: window.screen.availWidth,
|
||||
height: window.screen.availHeight,
|
||||
}""")
|
||||
screen_width, screen_height = screen_size(session)
|
||||
|
||||
response = set_window_rect(session, {
|
||||
"width": max["width"] - 100,
|
||||
"height": max["height"] - 100
|
||||
"width": screen_width - 100,
|
||||
"height": screen_height - 100
|
||||
})
|
||||
assert_success(response, {
|
||||
"x": original["x"],
|
||||
"y": original["y"],
|
||||
"width": max["width"] - 100,
|
||||
"height": max["height"] - 100
|
||||
"width": screen_width - 100,
|
||||
"height": screen_height - 100,
|
||||
})
|
||||
|
||||
|
||||
def test_height_width_larger_than_max(session):
|
||||
max = session.execute_script("""
|
||||
return {
|
||||
width: window.screen.availWidth,
|
||||
height: window.screen.availHeight,
|
||||
}""")
|
||||
screen_width, screen_height = screen_size(session)
|
||||
avail_width, avail_height = available_screen_size(session)
|
||||
|
||||
response = set_window_rect(session, {
|
||||
"width": max["width"] + 100,
|
||||
"height": max["height"] + 100
|
||||
"width": screen_width + 100,
|
||||
"height": screen_height + 100
|
||||
})
|
||||
rect = assert_success(response)
|
||||
assert rect["width"] >= max["width"]
|
||||
assert rect["height"] >= max["height"]
|
||||
assert rect["width"] >= avail_width
|
||||
assert rect["height"] >= avail_height
|
||||
|
||||
|
||||
def test_height_width_as_current(session):
|
||||
|
|
|
@ -181,3 +181,34 @@ def is_fullscreen(session):
|
|||
return session.execute_script("""
|
||||
return !!(window.fullScreen || document.webkitIsFullScreen)
|
||||
""")
|
||||
|
||||
|
||||
def document_dimensions(session):
|
||||
return tuple(session.execute_script("""
|
||||
let {devicePixelRatio} = window;
|
||||
let {width, height} = document.documentElement.getBoundingClientRect();
|
||||
return [width * devicePixelRatio, height * devicePixelRatio];
|
||||
"""))
|
||||
|
||||
|
||||
def screen_size(session):
|
||||
"""Returns the available width/height size of the screen."""
|
||||
return tuple(session.execute_script("""
|
||||
return [
|
||||
screen.availWidth,
|
||||
screen.availHeight,
|
||||
];
|
||||
"""))
|
||||
|
||||
|
||||
def available_screen_size(session):
|
||||
"""
|
||||
Returns the effective available screen width/height size,
|
||||
excluding any fixed window manager elements.
|
||||
"""
|
||||
return tuple(session.execute_script("""
|
||||
return [
|
||||
screen.availWidth - screen.availLeft,
|
||||
screen.availHeight - screen.availTop,
|
||||
];
|
||||
"""))
|
||||
|
|
Загрузка…
Ссылка в новой задаче