Bug 1451727 - [marionette] Remove deprecated WebDriver commands. r=ato a=test-only
authorHenrik Skupin <mail@hskupin.info>
Fri, 06 Apr 2018 12:12:24 +0200
changeset 463172 5b7aa80c261963293a7f59a5845f67d85ab1c6cd
parent 463171 0c798753bf0722e547644c323cd9bdc0e497a461
child 463173 2906b68565838730bbcab48ba59f89c6f9810527
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1451727, 1348145
milestone60.0
Bug 1451727 - [marionette] Remove deprecated WebDriver commands. r=ato a=test-only Removes the following deprecated WebDriver commands from marionette client: Element.size, Element.location, set_script_timeout, set_search_timeout, and set_page_load_timeout. It doesn't touch get_window_position, set_window_position, window_size, and set_window_size because those are covered by bug 1348145. MozReview-Commit-ID: 9b74toO1Rzm
layout/base/tests/marionette/test_accessiblecaret_cursor_mode.py
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
--- a/layout/base/tests/marionette/test_accessiblecaret_cursor_mode.py
+++ b/layout/base/tests/marionette/test_accessiblecaret_cursor_mode.py
@@ -87,17 +87,17 @@ class AccessibleCaretCursorModeTestCase(
 
         # Tap the front of the input to make first caret appear.
         el.tap()
         sel.move_cursor_to_front()
         el.tap(*sel.cursor_location())
 
         # Move first caret to the bottom-right corner of the element.
         src_x, src_y = sel.first_caret_location()
-        dest_x, dest_y = el.size['width'], el.size['height']
+        dest_x, dest_y = el.rect['width'], el.rect['height']
         self.actions.flick(el, src_x, src_y, dest_x, dest_y).perform()
 
         self.actions.key_down(content_to_add).key_up(content_to_add).perform()
         self.assertEqual(target_content, sel.content)
 
     @parameterized(_input_id, el_id=_input_id)
     @parameterized(_textarea_id, el_id=_textarea_id)
     @parameterized(_contenteditable_id, el_id=_contenteditable_id)
@@ -214,17 +214,17 @@ class AccessibleCaretCursorModeTestCase(
         # Tap to make the cursor appear.
         before_image_1 = self.marionette.find_element(By.ID, 'before-image-1')
         before_image_1.tap()
 
         # Tap the front of the content to make first caret appear.
         sel.move_cursor_to_front()
         el.tap(*sel.cursor_location())
         src_x, src_y = sel.first_caret_location()
-        dest_x, dest_y = el.size['width'], el.size['height']
+        dest_x, dest_y = el.rect['width'], el.rect['height']
 
         # Drag the first caret to the bottom-right corner of the element.
         self.actions.flick(el, src_x, src_y, dest_x, dest_y).perform()
 
         self.actions.key_down(content_to_add).key_up(content_to_add).perform()
         self.assertEqual(target_content, sel.content)
 
     def test_move_cursor_to_front_by_dragging_caret_to_front_br_element(self):
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -143,46 +143,23 @@ class HTMLElement(object):
 
     def is_displayed(self):
         """Returns True if the element is displayed, False otherwise."""
         body = {"id": self.id}
         return self.marionette._send_message("WebDriver:IsElementDisplayed",
                                              body, key="value")
 
     @property
-    def size(self):
-        """A dictionary with the size of the element."""
-        warnings.warn("The size property has been deprecated and will be removed in a future version. \
-            Please use HTMLElement#rect", DeprecationWarning)
-        rect = self.rect
-        return {"width": rect["width"], "height": rect["height"]}
-
-    @property
     def tag_name(self):
         """The tag name of the element."""
         body = {"id": self.id}
         return self.marionette._send_message("WebDriver:GetElementTagName",
                                              body, key="value")
 
     @property
-    def location(self):
-        """Get an element's location on the page.
-
-        The returned point will contain the x and y coordinates of the
-        top left-hand corner of the given element.  The point (0,0)
-        refers to the upper-left corner of the document.
-
-        :returns: a dictionary containing x and y as entries
-        """
-        warnings.warn("The location property has been deprecated and will be removed in a future version. \
-            Please use HTMLElement#rect", DeprecationWarning)
-        rect = self.rect
-        return {"x": rect["x"], "y": rect["y"]}
-
-    @property
     def rect(self):
         """Gets the element's bounding rectangle.
 
         This will return a dictionary with the following:
 
           * x and y represent the top left coordinates of the ``HTMLElement``
             relative to top left corner of the document.
           * height and the width will contain the height and the width
@@ -1304,75 +1281,16 @@ class Marionette(object):
     @property
     def session_capabilities(self):
         """A JSON dictionary representing the capabilities of the
         current session.
 
         """
         return self.session
 
-    def set_script_timeout(self, timeout):
-        """Sets the maximum number of ms that an asynchronous script is
-        allowed to run.
-
-        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.
-
-        """
-        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 :func:`find_element` or
-        :func:`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.
-
-        """
-        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.
-
-        """
-        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.
 
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
@@ -82,18 +82,18 @@ class BaseMouseAction(MarionetteTestCase
         return self.marionette.execute_script("""
           if (window.click_x && window.click_y) {
             return {x: window.click_x, y: window.click_y};
           }
         """, sandbox=None)
 
     def get_element_center_point(self, elem):
         return {
-            "x": elem.location["x"] + elem.size["width"] / 2,
-            "y": elem.location["y"] + elem.size["height"] / 2
+            "x": elem.rect["x"] + elem.rect["width"] / 2,
+            "y": elem.rect["y"] + elem.rect["height"] / 2
         }
 
 
 class TestNonSpecCompliantPointerOrigin(BaseMouseAction):
 
     def setUp(self):
         super(TestNonSpecCompliantPointerOrigin, self).setUp()
 
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_timeouts.py
@@ -93,20 +93,8 @@ class TestTimeouts(MarionetteTestCase):
     def test_no_timeout_settimeout(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         self.marionette.timeout.script = 1
         self.assertTrue(self.marionette.execute_async_script("""
              var callback = arguments[arguments.length - 1];
              setTimeout(function() { callback(true); }, 500);
              """))
-
-    def test_deprecated_set_search_timeout(self):
-        self.marionette.set_search_timeout(1000)
-        self.assertEqual(1, self.marionette.timeout.implicit)
-
-    def test_deprecated_set_script_timeout(self):
-        self.marionette.set_script_timeout(2000)
-        self.assertEqual(2, self.marionette.timeout.script)
-
-    def test_deprecated_set_page_load_timeout(self):
-        self.marionette.set_page_load_timeout(3000)
-        self.assertEqual(3, self.marionette.timeout.page_load)