Bug 1433390 - Move all assert helps into support.asserts. draft
authorHenrik Skupin <mail@hskupin.info>
Fri, 26 Jan 2018 11:40:29 +0100
changeset 747554 f01596c0fbcf586a474c17e7ed9d17da6bb47adf
parent 747168 59960ae69d7e675cfcfbf0ead6125cc8d3719f1f
child 747555 d58859781ee89630614074cabe4964c25d6eda48
push id96932
push userbmo:hskupin@gmail.com
push dateFri, 26 Jan 2018 10:47:06 +0000
bugs1433390
milestone60.0a1
Bug 1433390 - Move all assert helps into support.asserts. For a better management of assertion helpers those should be added to the central assertion helper module. MozReview-Commit-ID: DYMfOFl9Fjd
testing/web-platform/tests/webdriver/tests/actions/mouse.py
testing/web-platform/tests/webdriver/tests/actions/mouse_dblclick.py
testing/web-platform/tests/webdriver/tests/actions/support/mouse.py
testing/web-platform/tests/webdriver/tests/support/asserts.py
--- a/testing/web-platform/tests/webdriver/tests/actions/mouse.py
+++ b/testing/web-platform/tests/webdriver/tests/actions/mouse.py
@@ -1,12 +1,13 @@
 import pytest
 
-from tests.actions.support.mouse import assert_move_to_coordinates, get_center
+from tests.actions.support.mouse import get_center
 from tests.actions.support.refine import get_events, filter_dict
+from tests.support.asserts import assert_move_to_coordinates
 from tests.support.inline import inline
 from tests.support.wait import wait
 
 
 def link_doc(dest):
     content = "<a href=\"{}\" id=\"link\">destination</a>".format(dest)
     return inline(content)
 
--- a/testing/web-platform/tests/webdriver/tests/actions/mouse_dblclick.py
+++ b/testing/web-platform/tests/webdriver/tests/actions/mouse_dblclick.py
@@ -1,12 +1,13 @@
 import pytest
 
-from tests.actions.support.mouse import assert_move_to_coordinates, get_center
+from tests.actions.support.mouse import get_center
 from tests.actions.support.refine import get_events, filter_dict
+from tests.support.asserts import assert_move_to_coordinates
 
 
 _DBLCLICK_INTERVAL = 640
 
 
 # Using local fixtures because we want to start a new session between
 # each test, otherwise the clicks in each test interfere with each other.
 @pytest.fixture(autouse=True)
--- a/testing/web-platform/tests/webdriver/tests/actions/support/mouse.py
+++ b/testing/web-platform/tests/webdriver/tests/actions/support/mouse.py
@@ -1,13 +1,5 @@
-def assert_move_to_coordinates(point, target, events):
-    for e in events:
-        if e["type"] != "mousemove":
-            assert e["pageX"] == point["x"]
-            assert e["pageY"] == point["y"]
-            assert e["target"] == target
-
-
 def get_center(rect):
     return {
         "x": rect["width"] / 2 + rect["x"],
         "y": rect["height"] / 2 + rect["y"],
     }
--- a/testing/web-platform/tests/webdriver/tests/support/asserts.py
+++ b/testing/web-platform/tests/webdriver/tests/support/asserts.py
@@ -143,8 +143,16 @@ def assert_element_has_focus(target_elem
     session = target_element.session
 
     active_element = session.execute_script("return document.activeElement")
     active_tag = active_element.property("localName")
     target_tag = target_element.property("localName")
 
     assert active_element == target_element, (
         "Focussed element is <%s>, not <%s>" % (active_tag, target_tag))
+
+
+def assert_move_to_coordinates(point, target, events):
+    for e in events:
+        if e["type"] != "mousemove":
+            assert e["pageX"] == point["x"]
+            assert e["pageY"] == point["y"]
+            assert e["target"] == target