Bug 1388036 - Clean up fullscreen state after wdspec test. r?automatedtester
This ensures the window is not fullscreen after the test is finished.
MozReview-Commit-ID: GRCevDLlkRk
--- a/testing/web-platform/tests/webdriver/tests/support/fixtures.py
+++ b/testing/web-platform/tests/webdriver/tests/support/fixtures.py
@@ -46,16 +46,23 @@ def _restore_normal_window_state(session
if state == "maximized":
session.window.maximize()
elif state == "minimized":
session.window.minimize()
elif state == "fullscreen":
session.window.fullscreen()
+def _exit_fullscreen(session):
+ """If the window is in fullscreen state, exit fullscreen."""
+ if session.window.fullscreened:
+ session.window.fullscreen()
+ assert not session.window.fullscreened
+
+
def _restore_windows(session):
"""Closes superfluous windows opened by the test without ending
the session implicitly by closing the last window.
"""
current_window = session.window_handle
for window in _windows(session, exclude=[current_window]):
session.window_handle = window
@@ -150,16 +157,17 @@ def session(configuration, request):
raise
# finalisers are popped off a stack,
# making their ordering reverse
request.addfinalizer(lambda: _switch_to_top_level_browsing_context(_current_session))
request.addfinalizer(lambda: _restore_normal_window_state(_current_session))
request.addfinalizer(lambda: _restore_windows(_current_session))
request.addfinalizer(lambda: _dismiss_user_prompts(_current_session))
+ request.addfinalizer(lambda: _exit_fullscreen(_current_session))
request.addfinalizer(lambda: _ensure_valid_window(_current_session))
return _current_session
def new_session(configuration, request):
"""Return a factory function that will attempt to start a session with a given body.