Bug 1432105 - Stop pointer action tests from restarting Firefox. r=whimboo, a=test-only
authorMaja Frydrychowicz <mjzffr@gmail.com>
Mon, 12 Feb 2018 10:48:31 -0500
changeset 460514 298636c044705d583f4a85822db5e5f505220e8d
parent 460513 0027aa6624e41ac0e7dfa6b56ef1f70ee9ddafd7
child 460515 989d666031dbef2dfdbe575aad0edda22275a095
push id8963
push userryanvm@gmail.com
push dateTue, 03 Apr 2018 15:25:18 +0000
treeherdermozilla-beta@14ea71e3100e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo, test-only
bugs1432105
milestone60.0
Bug 1432105 - Stop pointer action tests from restarting Firefox. r=whimboo, a=test-only MozReview-Commit-ID: 29P3Uit7U7V
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/webdriver/tests/actions/modifier_click.py
testing/web-platform/tests/webdriver/tests/actions/mouse_dblclick.py
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -385557,19 +385557,17 @@
     [
      "/webdriver/tests/actions/key_shortcuts.py",
      {}
     ]
    ],
    "webdriver/tests/actions/modifier_click.py": [
     [
      "/webdriver/tests/actions/modifier_click.py",
-     {
-      "timeout": "long"
-     }
+     {}
     ]
    ],
    "webdriver/tests/actions/mouse.py": [
     [
      "/webdriver/tests/actions/mouse.py",
      {}
     ]
    ],
@@ -593268,25 +593266,25 @@
    "d589b53f0096893600e696b43ec19ca84e5ee2ab",
    "wdspec"
   ],
   "webdriver/tests/actions/key_shortcuts.py": [
    "dbe27dd0b1625169fc8cc2055f8fb49d5a4a78d2",
    "wdspec"
   ],
   "webdriver/tests/actions/modifier_click.py": [
-   "88a384182fdd9df1515b9d8cfda8f56aed138ec7",
+   "f0ed71cbb6550ef496096541531f3b4fa3f4c6e2",
    "wdspec"
   ],
   "webdriver/tests/actions/mouse.py": [
    "edad7693fcd01b418821942edb870191db64ea41",
    "wdspec"
   ],
   "webdriver/tests/actions/mouse_dblclick.py": [
-   "f6afcb8c0fa017d58a9fcdd3cc474e0c8fd52db5",
+   "9ab61ed4fd678c04bdcc929466b4a867e5a2048e",
    "wdspec"
   ],
   "webdriver/tests/actions/pointer_origin.py": [
    "a9a99d58daec7719ee53ed758f566ccceb582f65",
    "wdspec"
   ],
   "webdriver/tests/actions/sequence.py": [
    "d43caf0f8607a76c3baed7806664b686bde21fda",
--- a/testing/web-platform/tests/webdriver/tests/actions/modifier_click.py
+++ b/testing/web-platform/tests/webdriver/tests/actions/modifier_click.py
@@ -1,103 +1,69 @@
-# META: timeout=long
-
 import pytest
 
 from tests.actions.support.refine import filter_dict, get_events
 from tests.actions.support.keys import Keys
 
 
-# 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)
-def release_actions(mod_click_session, request):
-    request.addfinalizer(mod_click_session.actions.release)
-
-
-@pytest.fixture
-def mod_click_session(new_session, url, add_browser_capabilites):
-    _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}})
-    session.url = url("/webdriver/tests/actions/support/test_actions_wdspec.html")
-
-    return session
-
-
-@pytest.fixture
-def key_chain(mod_click_session):
-    return mod_click_session.actions.sequence("key", "keyboard_id")
-
-
-@pytest.fixture
-def mouse_chain(mod_click_session):
-    return mod_click_session.actions.sequence(
-        "pointer",
-        "pointer_id",
-        {"pointerType": "mouse"})
-
-
 @pytest.mark.parametrize("modifier, prop", [
    (Keys.ALT, "altKey"),
    (Keys.R_ALT, "altKey"),
    (Keys.META, "metaKey"),
    (Keys.R_META, "metaKey"),
    (Keys.SHIFT, "shiftKey"),
    (Keys.R_SHIFT, "shiftKey"),
 ])
-def test_modifier_click(mod_click_session,
-                       key_chain,
-                       mouse_chain,
-                       modifier,
-                       prop):
+def test_modifier_click(session, test_actions_page, key_chain, mouse_chain, modifier, prop):
     key_chain \
         .pause(200) \
         .key_down(modifier) \
         .pause(200) \
         .key_up(modifier)
-    outer = mod_click_session.find.css("#outer", all=False)
+    outer = session.find.css("#outer", all=False)
     mouse_chain.click(element=outer)
-    mod_click_session.actions.perform([key_chain.dict, mouse_chain.dict])
+    session.actions.perform([key_chain.dict, mouse_chain.dict])
     expected = [
         {"type": "mousemove"},
         {"type": "mousedown"},
         {"type": "mouseup"},
         {"type": "click"},
     ]
     defaults = {
         "altKey": False,
         "metaKey": False,
         "shiftKey": False,
         "ctrlKey": False
     }
     for e in expected:
         e.update(defaults)
         if e["type"] != "mousemove":
             e[prop] = True
-    filtered_events = [filter_dict(e, expected[0]) for e in get_events(mod_click_session)]
+    filtered_events = [filter_dict(e, expected[0]) for e in get_events(session)]
     assert expected == filtered_events
 
 
-def test_many_modifiers_click(mod_click_session, key_chain, mouse_chain):
-    outer = mod_click_session.find.css("#outer", all=False)
+def test_many_modifiers_click(session, test_actions_page, key_chain, mouse_chain):
+    outer = session.find.css("#outer", all=False)
     key_chain \
         .pause(0) \
         .key_down(Keys.CONTROL) \
         .key_down(Keys.SHIFT) \
         .pause(0) \
         .key_up(Keys.CONTROL) \
         .key_up(Keys.SHIFT)
     mouse_chain \
         .pointer_move(0, 0, origin=outer) \
         .pause(0) \
         .pointer_down() \
         .pointer_up() \
         .pause(0) \
         .pause(0) \
         .pointer_down()
-    mod_click_session.actions.perform([key_chain.dict, mouse_chain.dict])
+    session.actions.perform([key_chain.dict, mouse_chain.dict])
     expected = [
         {"type": "mousemove"},
         # shift and ctrl presses
         {"type": "mousedown"},
         {"type": "mouseup"},
         {"type": "click"},
         # no modifiers pressed
         {"type": "mousedown"},
@@ -108,10 +74,10 @@ def test_many_modifiers_click(mod_click_
         "shiftKey": False,
         "ctrlKey": False
     }
     for e in expected:
         e.update(defaults)
     for e in expected[1:4]:
         e["shiftKey"] = True
         e["ctrlKey"] = True
-    events = [filter_dict(e, expected[0]) for e in get_events(mod_click_session)]
+    events = [filter_dict(e, expected[0]) for e in get_events(session)]
     assert events == expected
--- a/testing/web-platform/tests/webdriver/tests/actions/mouse_dblclick.py
+++ b/testing/web-platform/tests/webdriver/tests/actions/mouse_dblclick.py
@@ -1,106 +1,80 @@
 import pytest
 
 from tests.actions.support.mouse import get_inview_center, get_viewport_rect
 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)
-def release_actions(dblclick_session, request):
-    # release all actions after each test
-    # equivalent to a teardown_function, but with access to session fixture
-    request.addfinalizer(dblclick_session.actions.release)
-
-
-@pytest.fixture
-def dblclick_session(new_session, url, add_browser_capabilites):
-    _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}})
-    session.url = url("/webdriver/tests/actions/support/test_actions_wdspec.html")
-
-    return session
-
-
-@pytest.fixture
-def mouse_chain(dblclick_session):
-    return dblclick_session.actions.sequence(
-        "pointer",
-        "pointer_id",
-        {"pointerType": "mouse"})
-
-
 @pytest.mark.parametrize("click_pause", [0, 200])
-def test_dblclick_at_coordinates(dblclick_session, mouse_chain, click_pause):
+def test_dblclick_at_coordinates(session, test_actions_page, mouse_chain, click_pause):
     div_point = {
         "x": 82,
         "y": 187,
     }
     mouse_chain \
         .pointer_move(div_point["x"], div_point["y"]) \
         .click() \
         .pause(click_pause) \
         .click() \
         .perform()
-    events = get_events(dblclick_session)
+    events = get_events(session)
     assert_move_to_coordinates(div_point, "outer", events)
     expected = [
         {"type": "mousedown", "button": 0},
         {"type": "mouseup", "button": 0},
         {"type": "click", "button": 0},
         {"type": "mousedown", "button": 0},
         {"type": "mouseup", "button": 0},
         {"type": "click", "button": 0},
         {"type": "dblclick", "button": 0},
     ]
     assert len(events) == 8
     filtered_events = [filter_dict(e, expected[0]) for e in events]
     assert expected == filtered_events[1:]
 
 
-def test_dblclick_with_pause_after_second_pointerdown(dblclick_session, mouse_chain):
-        outer = dblclick_session.find.css("#outer", all=False)
-        center = get_inview_center(outer.rect, get_viewport_rect(dblclick_session))
+def test_dblclick_with_pause_after_second_pointerdown(session, test_actions_page, mouse_chain):
+        outer = session.find.css("#outer", all=False)
+        center = get_inview_center(outer.rect, get_viewport_rect(session))
         mouse_chain \
             .pointer_move(int(center["x"]), int(center["y"])) \
             .click() \
             .pointer_down() \
             .pause(_DBLCLICK_INTERVAL + 10) \
             .pointer_up() \
             .perform()
-        events = get_events(dblclick_session)
+        events = get_events(session)
         expected = [
             {"type": "mousedown", "button": 0},
             {"type": "mouseup", "button": 0},
             {"type": "click", "button": 0},
             {"type": "mousedown", "button": 0},
             {"type": "mouseup", "button": 0},
             {"type": "click", "button": 0},
             {"type": "dblclick", "button": 0},
         ]
         assert len(events) == 8
         filtered_events = [filter_dict(e, expected[0]) for e in events]
         assert expected == filtered_events[1:]
 
 
-def test_no_dblclick(dblclick_session, mouse_chain):
-        outer = dblclick_session.find.css("#outer", all=False)
-        center = get_inview_center(outer.rect, get_viewport_rect(dblclick_session))
+def test_no_dblclick(session, test_actions_page, mouse_chain):
+        outer = session.find.css("#outer", all=False)
+        center = get_inview_center(outer.rect, get_viewport_rect(session))
         mouse_chain \
             .pointer_move(int(center["x"]), int(center["y"])) \
             .click() \
             .pause(_DBLCLICK_INTERVAL + 10) \
             .click() \
             .perform()
-        events = get_events(dblclick_session)
+        events = get_events(session)
         expected = [
             {"type": "mousedown", "button": 0},
             {"type": "mouseup", "button": 0},
             {"type": "click", "button": 0},
             {"type": "mousedown", "button": 0},
             {"type": "mouseup", "button": 0},
             {"type": "click", "button": 0},
         ]