Bug 1316622 - Deprecate old Marionette timeouts API; r?automatedtester,whimboo draft
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 10 Nov 2016 21:01:41 +0000
changeset 440372 4b6d960de8300e52993fe044530d27e32087faa3
parent 440371 86f80e546e8782914031e4576d87044862031b7f
child 440373 b6eaa9939a9a611a4264ecf2ba20ad7c002c68f2
push id36214
push userbmo:ato@mozilla.com
push dateThu, 17 Nov 2016 13:46:37 +0000
reviewersautomatedtester, whimboo
bugs1316622
milestone53.0a1
Bug 1316622 - Deprecate old Marionette timeouts API; r?automatedtester,whimboo This ensure backwards compatible for consumers. MozReview-Commit-ID: J2VOiB08xxV
testing/marionette/client/marionette_driver/marionette.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1323,67 +1323,64 @@ class Marionette(object):
 
         If a script does not return in the specified amount of time,
         a ScriptTimeoutException is raised.
 
         :param timeout: The maximum number of milliseconds an asynchronous
             script can run without causing an ScriptTimeoutException to
             be raised
 
+        .. note:: `set_script_timeout` is deprecated, please use
+            `timeout.script` setter.
+
         """
-        try:
-            self._send_message("setTimeouts", {"script": timeout})
-        except errors.MarionetteException as e:
-            # remove when 52.0a is stable
-            if "Not a Number" in e.message:
-                self._send_message("timeouts", {"type": "script", "ms": timeout})
-            else:
-                raise e
+        warnings.warn(
+            "set_script_timeout is deprecated, please use timeout.script setter",
+            DeprecationWarning)
+        self.timeout.script = timeout / 1000
 
     def set_search_timeout(self, timeout):
         """Sets a timeout for the find methods.
 
         When searching for an element using
         either :class:`Marionette.find_element` or
         :class:`Marionette.find_elements`, the method will continue
         trying to locate the element for up to timeout ms. This can be
         useful if, for example, the element you're looking for might
         not exist immediately, because it belongs to a page which is
         currently being loaded.
 
         :param timeout: Timeout in milliseconds.
 
+        .. note:: `set_search_timeout` is deprecated, please use
+            `timeout.implicit` setter.
+
         """
-        try:
-            self._send_message("setTimeouts", {"implicit": timeout})
-        except errors.MarionetteException as e:
-            # remove when 52.0a is stable
-            if "Not a Number" in e.message:
-                self._send_message("timeouts", {"type": "implicit", "ms": timeout})
-            else:
-                raise e
+        warnings.warn(
+            "set_search_timeout is deprecated, please use timeout.implicit setter",
+            DeprecationWarning)
+        self.timeout.implicit = timeout / 1000
 
     def set_page_load_timeout(self, timeout):
         """Sets a timeout for loading pages.
 
         A page load timeout specifies the amount of time the Marionette
         instance should wait for a page load operation to complete. A
         ``TimeoutException`` is returned if this limit is exceeded.
 
         :param timeout: Timeout in milliseconds.
 
+        .. note:: `set_page_load_timeout` is deprecated, please use
+            `timeout.page_load` setter.
+
         """
-        try:
-            self._send_message("setTimeouts", {"page load": timeout})
-        except errors.MarionetteException as e:
-            # remove when 52.0a is stable
-            if "Not a Number" in e.message:
-                self._send_message("timeouts", {"type": "page load", "ms": timeout})
-            else:
-                raise e
+        warnings.warn(
+            "set_page_load_timeout is deprecated, please use timeout.page_load setter",
+            DeprecationWarning)
+        self.timeout.page_load = timeout / 1000
 
     @property
     def current_window_handle(self):
         """Get the current window's handle.
 
         Returns an opaque server-assigned identifier to this window
         that uniquely identifies it within this Marionette instance.
         This can be used to switch to this window at a later point.