Bug 1415694 - Test webdriver actions keyboard shortcuts; r=ato
authorMaja Frydrychowicz <mjzffr@gmail.com>
Wed, 08 Nov 2017 14:19:56 -0500
changeset 444233 1f5a9447c57a5416fbe0aa062bd31810b0ee2ff0
parent 444232 3242ac6fdb3879f723145e6b07fff04a5c960d1e
child 444234 6b1f342836ba9405cb13714614c9e850f0bb1a29
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1415694
milestone58.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 1415694 - Test webdriver actions keyboard shortcuts; r=ato MozReview-Commit-ID: 7izqD8JLoNv
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/webdriver/tests/actions/key_shortcuts.py
testing/web-platform/tests/webdriver/tests/actions/support/keys.py
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -384302,16 +384302,22 @@
   },
   "wdspec": {
    "webdriver/tests/actions/key.py": [
     [
      "/webdriver/tests/actions/key.py",
      {}
     ]
    ],
+   "webdriver/tests/actions/key_shortcuts.py": [
+    [
+     "/webdriver/tests/actions/key_shortcuts.py",
+     {}
+    ]
+   ],
    "webdriver/tests/actions/modifier_click.py": [
     [
      "/webdriver/tests/actions/modifier_click.py",
      {
       "timeout": "long"
      }
     ]
    ],
@@ -541906,17 +541912,17 @@
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html": [
    "604c6ee2bd78187a600dd28e03b60caf89580cfe",
    "testharness"
   ],
   "html/browsers/origin/cross-origin-objects/cross-origin-objects.html": [
-   "9202ebf4d640ffccec49451bae23526c24a1053b",
+   "ce27e8e729f434ce3e908a49a1ffd733bcdcd06a",
    "testharness"
   ],
   "html/browsers/origin/cross-origin-objects/frame.html": [
    "7f982fe347ac7fbc14e853d14a2535685a970395",
    "support"
   ],
   "html/browsers/origin/cross-origin-objects/win-documentdomain.sub.html": [
    "37d2be417bbc3b8473c2d4bfaa3b7a9973140ce9",
@@ -586525,16 +586531,20 @@
   "webdriver/tests/actions/conftest.py": [
    "ebdbe326fd2fc53a3522b846505808496407b5b8",
    "support"
   ],
   "webdriver/tests/actions/key.py": [
    "69542dc107d881bf18dfff3203bfd7a9ec31b4ad",
    "wdspec"
   ],
+  "webdriver/tests/actions/key_shortcuts.py": [
+   "dbe27dd0b1625169fc8cc2055f8fb49d5a4a78d2",
+   "wdspec"
+  ],
   "webdriver/tests/actions/modifier_click.py": [
    "2ec22f44973e6da3b9506ad7cc9fd0949f3ef8b5",
    "wdspec"
   ],
   "webdriver/tests/actions/mouse.py": [
    "d7af66e45c8e306b4258b92c54ed86073fd21c8d",
    "wdspec"
   ],
@@ -586546,17 +586556,17 @@
    "3b10143dea60567f30b4ab6c544e005d02f31fc3",
    "wdspec"
   ],
   "webdriver/tests/actions/support/__init__.py": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "webdriver/tests/actions/support/keys.py": [
-   "636991372c21e52b623ed4ada9dfb675dd7f7e14",
+   "61fc98ac2abeeb82486e6689c9cc16d0aa444b69",
    "support"
   ],
   "webdriver/tests/actions/support/refine.py": [
    "0d244bffe67ef57be68aad99f1cbc7440ff80e27",
    "support"
   ],
   "webdriver/tests/actions/support/test_actions_wdspec.html": [
    "94b6f474bb4417cf2c06cb5fc6042c01bde98aa2",
@@ -596618,17 +596628,17 @@
    "f95cceffe7485aac7b53d3f891ad87d50ccc8b1d",
    "testharness"
   ],
   "webrtc/RTCConfiguration-rtcpMuxPolicy.html": [
    "a9beda60053916185106aedac98014123d6f7105",
    "testharness"
   ],
   "webrtc/RTCDTMFSender-helper.js": [
-   "54456b1c74d55552fdad0405f55dcd728205b561",
+   "0c2e8862deffeec71ac925642647bb9ee4ad70ff",
    "support"
   ],
   "webrtc/RTCDTMFSender-insertDTMF.https.html": [
    "50ef787a77512dc7eea7731b9766fda4d1456694",
    "testharness"
   ],
   "webrtc/RTCDTMFSender-ontonechange-long.https.html": [
    "d89602fd655bf032cadfc538291ccea858eb2446",
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webdriver/tests/actions/key_shortcuts.py
@@ -0,0 +1,49 @@
+from tests.actions.support.keys import Keys, MODIFIER_KEY
+from tests.actions.support.refine import get_keys
+
+
+def test_mod_a_and_backspace_deletes_all_text(session, key_reporter, key_chain):
+    key_chain.send_keys("abc d") \
+             .key_down(MODIFIER_KEY) \
+             .key_down("a") \
+             .key_up(MODIFIER_KEY) \
+             .key_up("a") \
+             .key_down(Keys.BACKSPACE) \
+             .perform()
+    assert get_keys(key_reporter) == ""
+
+
+def test_mod_a_mod_c_right_mod_v_pastes_text(session, key_reporter, key_chain):
+    initial = "abc d"
+    key_chain.send_keys(initial) \
+             .key_down(MODIFIER_KEY) \
+             .key_down("a") \
+             .key_up(MODIFIER_KEY) \
+             .key_up("a") \
+             .key_down(MODIFIER_KEY) \
+             .key_down("c") \
+             .key_up(MODIFIER_KEY) \
+             .key_up("c") \
+             .send_keys([Keys.RIGHT]) \
+             .key_down(MODIFIER_KEY) \
+             .key_down("v") \
+             .key_up(MODIFIER_KEY) \
+             .key_up("v") \
+             .perform()
+    assert get_keys(key_reporter) == initial * 2
+
+
+def test_mod_a_mod_x_deletes_all_text(session, key_reporter, key_chain):
+    key_chain.send_keys("abc d") \
+             .key_down(MODIFIER_KEY) \
+             .key_down("a") \
+             .key_up(MODIFIER_KEY) \
+             .key_up("a") \
+             .key_down(MODIFIER_KEY) \
+             .key_down("x") \
+             .key_up(MODIFIER_KEY) \
+             .key_up("x") \
+             .perform()
+    assert get_keys(key_reporter) == ""
+
+
--- a/testing/web-platform/tests/webdriver/tests/actions/support/keys.py
+++ b/testing/web-platform/tests/webdriver/tests/actions/support/keys.py
@@ -15,16 +15,17 @@
 # specific language governing permissions and limitations
 # under the License.
 
 """
 The Keys implementation.
 """
 
 from inspect import getmembers
+import sys
 
 
 class Keys(object):
     """
     Set of special keys codes.
 
     See also https://w3c.github.io/webdriver/webdriver-spec.html#h-keyboard-actions
     """
@@ -735,8 +736,13 @@ ALL_EVENTS = {
         "ctrl": False,
         "key": "ZenkakuHankaku",
         "location": 0,
         "meta": False,
         "shift": False,
         "value": u"\ue040",
     }
 }
+
+if sys.platform == 'darwin':
+    MODIFIER_KEY = Keys.META
+else:
+    MODIFIER_KEY = Keys.CONTROL