Bug 1636105 [wpt PR 23456] - [WebDriver] Add test for triple click, a=testonly
authorDavid Burns <david.burns@theautomatedtester.co.uk>
Thu, 21 May 2020 10:19:58 +0000
changeset 531994 302a8877799b25d515f61166456a1544fdaf7186
parent 531993 6090eaf4818d346ff68f012a790107ec957b644a
child 531995 32fa1c1dd4a7e4eb3e8458c87f7f9e216408a8fd
push id37449
push userncsoregi@mozilla.com
push dateTue, 26 May 2020 02:38:57 +0000
treeherdermozilla-central@da2c7b0ac9a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1636105, 23456
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1636105 [wpt PR 23456] - [WebDriver] Add test for triple click, a=testonly Automatic update from web-platform-tests [WebDriver] Add test for triple click (#23456) This test does a triple-click and then checks that the entire paragraph has been selected. This currently fails in all drivers. -- wpt-commits: 3b5a990d7cbbb6fc196282a3f99c2c1bf9f04915 wpt-pr: 23456
testing/web-platform/tests/webdriver/tests/perform_actions/pointer_tripleclick.py
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webdriver/tests/perform_actions/pointer_tripleclick.py
@@ -0,0 +1,34 @@
+from tests.perform_actions.support.refine import filter_dict, get_events
+from tests.support.asserts import assert_move_to_coordinates
+from tests.support.inline import inline
+
+lots_of_text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor "\
+               "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud "\
+               " exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
+
+
+def test_tripleclick_at_coordinates(session, mouse_chain):
+    """
+        This test does a triple click on a coordinate. On desktop platforms
+        this will select a paragraph. On mobile this will not have the same
+        desired outcome as taps are handled differently on mobile.
+    """
+    session.url = inline("""<div>
+          {}
+        </div>""".format(lots_of_text))
+    div = session.find.css("div", all=False)
+    div_rect = div.rect
+    div_centre = {
+        "x": div_rect["x"] + div_rect["width"]/2,
+        "y": div_rect["y"] + div_rect["height"]/2
+    }
+    mouse_chain \
+        .pointer_move(div_centre["x"], div_centre["y"]) \
+        .click() \
+        .click() \
+        .click() \
+        .perform()
+
+    actual_text = session.execute_script("return document.getSelection().toString();")
+
+    assert lots_of_text == actual_text