Bug 1478368 - [wdspec] Use a default window size of 800x600.
Previously we set this window size when restoring all default
values for a session during test teardown. Which means that
the very first test after the browser has been started will
run with the browser window default size.
This change enforces that all tests use the default window
size of 800x600.
MozReview-Commit-ID: Kiog3Ri2RJT
--- a/testing/web-platform/tests/webdriver/tests/support/fixtures.py
+++ b/testing/web-platform/tests/webdriver/tests/support/fixtures.py
@@ -14,16 +14,17 @@ from tests.support.wait import wait
default_host = "http://127.0.0.1"
default_port = "4444"
default_script_timeout = 30
default_page_load_timeout = 300
default_implicit_wait_timeout = 0
+default_window_size = (800, 600)
_current_session = None
_custom_session = False
def ignore_exceptions(f):
def inner(*args, **kwargs):
try:
@@ -67,17 +68,17 @@ def cleanup_session(session):
@ignore_exceptions
def _restore_window_state(session):
"""Reset window to an acceptable size.
This also includes bringing it out of maximized, minimized,
or fullscreened state.
"""
- session.window.size = (800, 600)
+ session.window.size = default_window_size
@ignore_exceptions
def _restore_windows(session):
"""Close superfluous windows opened by the test.
It will not end the session implicitly by closing the last window.
"""
current_window = session.window_handle
@@ -208,16 +209,19 @@ def session(capabilities, configuration,
configuration["port"],
capabilities=caps)
try:
_current_session.start()
except webdriver.error.SessionNotCreatedException:
if not _current_session.session_id:
raise
+ # Enforce a fixed default window size
+ _current_session.window.size = default_window_size
+
yield _current_session
cleanup_session(_current_session)
def current_session():
return _current_session