Bug 1396823 - Split multiple codepoint key test into two tests draft
authorGreg Fraley <gsfraley@gmail.com>
Tue, 06 Mar 2018 16:33:57 -0500
changeset 763913 08fddcb40e20
parent 763901 20015a8a21be
push id101598
push userbmo:gsfraley@gmail.com
push dateTue, 06 Mar 2018 21:34:18 +0000
bugs1396823
milestone60.0a1
Bug 1396823 - Split multiple codepoint key test into two tests MozReview-Commit-ID: H23Wwd0ySRP
testing/web-platform/tests/webdriver/tests/actions/special_keys.py
--- a/testing/web-platform/tests/webdriver/tests/actions/special_keys.py
+++ b/testing/web-platform/tests/webdriver/tests/actions/special_keys.py
@@ -1,15 +1,15 @@
 # META: timeout=long
 
 import pytest
 import time
-from webdriver import InvalidArgumentException
 from tests.actions.support.keys import ALL_EVENTS, Keys
 from tests.actions.support.refine import filter_dict, get_keys, get_events
+from webdriver import error
 
 @pytest.mark.parametrize("name,expected", ALL_EVENTS.items())
 def test_webdriver_special_key_sends_keydown(session,
                                              key_reporter,
                                              key_chain,
                                              name,
                                              expected):
     if name.startswith("F"):
@@ -40,32 +40,40 @@ def test_webdriver_special_key_sends_key
     # only printable characters should be recorded in input field
     entered_keys = get_keys(key_reporter)
     if len(expected["key"]) == 1:
         assert entered_keys == expected["key"]
     else:
         assert len(entered_keys) == 0
 
 
-@pytest.mark.parametrize("value,valid", [
-    (u"f", True),
-    (u"fa", False),
-    (u"\u0BA8\u0BBF", True),
-    (u"\u0BA8\u0BBFb", False),
-    (u"\u0BA8\u0BBF\u0BA8", False),
-    (u"\u1100\u1161\u11A8", True),
-    (u"\u1100\u1161\u11A8c", False)
+@pytest.mark.parametrize("value", [
+    (u"f"),
+    (u"\u0BA8\u0BBF"),
+    (u"\u1100\u1161\u11A8"),
 ])
 def test_multiple_codepoint_keys_behave_correctly(session,
                                                   key_reporter,
                                                   key_chain,
-                                                  value,
-                                                  valid):
-    try:
+                                                  value):
+    key_chain \
+        .key_down(value) \
+        .key_up(value) \
+        .perform()
+
+    assert get_keys(key_reporter) == value
+
+
+@pytest.mark.parametrize("value", [
+    (u"fa"),
+    (u"\u0BA8\u0BBFb"),
+    (u"\u0BA8\u0BBF\u0BA8"),
+    (u"\u1100\u1161\u11A8c")
+])
+def test_invalid_multiple_codepoint_keys_fail(session,
+                                              key_reporter,
+                                              key_chain,
+                                              value):
+    with pytest.raises(error.InvalidArgumentException):
         key_chain \
             .key_down(value) \
             .key_up(value) \
-            .perform()
-        
-        assert valid
-        assert get_keys(key_reporter) == value
-    except InvalidArgumentException:
-        assert not valid
\ No newline at end of file
+            .perform()
\ No newline at end of file