зеркало из https://github.com/mozilla/gecko-dev.git
bug 1492499: webdriver: add stress tests for window manipulation; r=automatedtester
Depends on D8410 Differential Revision: https://phabricator.services.mozilla.com/D8411 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
51c24a94ae
Коммит
5e151181ca
|
@ -0,0 +1,19 @@
|
|||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_success
|
||||
from tests.support.helpers import is_fullscreen
|
||||
|
||||
|
||||
def fullscreen_window(session):
|
||||
return session.transport.send(
|
||||
"POST", "session/{session_id}/window/fullscreen".format(**vars(session)))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("i", range(5))
|
||||
def test_stress(session, i):
|
||||
assert not is_fullscreen(session)
|
||||
response = fullscreen_window(session)
|
||||
assert_success(response)
|
||||
assert is_fullscreen(session)
|
|
@ -0,0 +1,42 @@
|
|||
# META: timeout=long
|
||||
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_success
|
||||
from tests.support.helpers import document_hidden
|
||||
|
||||
|
||||
def maximize_window(session):
|
||||
response = session.transport.send(
|
||||
"POST", "session/{session_id}/window/maximize".format(**vars(session)))
|
||||
rect = assert_success(response)
|
||||
return (rect["width"], rect["height"])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("i", range(5))
|
||||
def test_stress(session, i):
|
||||
"""
|
||||
Without defining the heuristics of each platform WebDriver runs on,
|
||||
the best we can do is to test that maximization occurs synchronously.
|
||||
|
||||
Not all systems and window managers support maximizing the window,
|
||||
but they are expected to do their best. The minimum requirement
|
||||
is that the maximized window is larger than its original size.
|
||||
|
||||
To ensure the maximization happened synchronously, we test
|
||||
that the size hasn't changed after a short amount of time,
|
||||
using a thread suspend. This is not ideal, but the best we
|
||||
can do given the level of platform ambiguity implied by WebDriver.
|
||||
"""
|
||||
session.window.size = (100, 100)
|
||||
session.window.position = (0, 0)
|
||||
original_size = session.window.size
|
||||
|
||||
size_after_maximize = maximize_window(session)
|
||||
assert size_after_maximize > original_size
|
||||
|
||||
t_end = time.time() + 3
|
||||
while time.time() < t_end:
|
||||
assert session.window.size == size_after_maximize
|
|
@ -0,0 +1,19 @@
|
|||
# META: timeout=long
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_success
|
||||
from tests.support.helpers import document_hidden
|
||||
|
||||
|
||||
def minimize_window(session):
|
||||
return session.transport.send(
|
||||
"POST", "session/{session_id}/window/minimize".format(**vars(session)))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("i", range(5))
|
||||
def test_stress(session, i):
|
||||
assert not document_hidden(session)
|
||||
response = minimize_window(session)
|
||||
assert_success(response)
|
||||
assert document_hidden(session)
|
Загрузка…
Ссылка в новой задаче