Bug 1342162 - Make timeout API in client backwards compatible; r?whimboo
This makes the session timeout duration configuration API backwards
compatible with earlier Firefoxen.
As Marionette changes to accept pageLoad, we must still continue to allow
"page load" as a key for as long as the Marionette Python client is used
for Firefox upgrade tests.
MozReview-Commit-ID: Ln4D3bY2d7f
--- a/testing/marionette/client/marionette_driver/timeout.py
+++ b/testing/marionette/client/marionette_driver/timeout.py
@@ -31,17 +31,20 @@ class Timeouts(object):
ms = sec * 1000
try:
self._marionette._send_message("setTimeouts", {name: ms})
except errors.UnknownCommandException:
# remove when 55 is stable
self._marionette._send_message("timeouts", {"type": name, "ms": ms})
def _get(self, name):
- ms = self._marionette._send_message("getTimeouts", key=name)
+ ts = self._marionette._send_message("getTimeouts")
+ if name not in ts:
+ raise KeyError()
+ ms = ts[name]
return ms / 1000
@property
def script(self):
"""Get the session's script timeout. This specifies the time
to wait for injected scripts to finished before interrupting
them. It is by default 30 seconds.
@@ -58,25 +61,33 @@ class Timeouts(object):
@property
def page_load(self):
"""Get the session's page load timeout. This specifies the time
to wait for the page loading to complete. It is by default 5
minutes (or 300 seconds).
"""
- return self._get("pageLoad")
+ # remove fallback when Firefox 56 is stable
+ try:
+ return self._get("pageLoad")
+ except KeyError:
+ return self._get("page load")
@page_load.setter
def page_load(self, sec):
"""Set the session's page load timeout. This specifies the time
to wait for the page loading to complete.
"""
- self._set("pageLoad", sec)
+ # remove fallback when Firefox 56 is stable
+ try:
+ self._set("pageLoad", sec)
+ except errors.InvalidArgumentException:
+ return self._set("page load", sec)
@property
def implicit(self):
"""Get the session's implicit wait timeout. This specifies the
time to wait for the implicit element location strategy when
retrieving elements. It is by default disabled (0 seconds).
"""