Bug 1484157 - Add bounds check tests for WebDriver pause action. r=whimboo
authorAndreas Tolfsen <ato@sny.no>
Fri, 17 Aug 2018 10:18:01 +0100
changeset 487698 51acbb8dc5013a729f91bb6127d7234be010904b
parent 487697 6f2e61c51d4b96589f105bdc4c2de2921f67d183
child 487699 7555241630cee413ed62a44919e5b93c224e635a
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1484157
milestone63.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 1484157 - Add bounds check tests for WebDriver pause action. r=whimboo The pause action takes an unsigned integer as input, but it was discovered in https://github.com/mozilla/geckodriver/issues/1355 that chromedriver accepts floating point values. To achieve conformance in this area, this will test various allowed and disallowed values so that the pause action's bounds are properly checked.
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/webdriver/tests/actions/bounds.py
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -422098,16 +422098,22 @@
     ]
    ],
    "webdriver/tests/accept_alert/accept.py": [
     [
      "/webdriver/tests/accept_alert/accept.py",
      {}
     ]
    ],
+   "webdriver/tests/actions/bounds.py": [
+    [
+     "/webdriver/tests/actions/bounds.py",
+     {}
+    ]
+   ],
    "webdriver/tests/actions/control_click.py": [
     [
      "/webdriver/tests/actions/control_click.py",
      {}
     ]
    ],
    "webdriver/tests/actions/key.py": [
     [
@@ -554854,17 +554860,17 @@
    "85dd7324815b8f8ef1a1d0496224c1a0661db9d8",
    "support"
   ],
   "css/css-transitions/support/generalParallelTest.js": [
    "f6e14128fc07f08984ac705b2f6ec03f02bc2215",
    "support"
   ],
   "css/css-transitions/support/helper.js": [
-   "eb5959ce5e1a13bf51b4228f36fe851618a12697",
+   "aa3efe8012268115734bd91bff8f82ceb8d26eea",
    "support"
   ],
   "css/css-transitions/support/import-green.css": [
    "537104e663364492c6ef388e4afce190e9c5bc58",
    "support"
   ],
   "css/css-transitions/support/import-red.css": [
    "9945ef47114c2841a746c99a2fb1e93e050aac8b",
@@ -642610,17 +642616,17 @@
    "c473961cb64f424e3402b265746a612b09cb7dfe",
    "support"
   ],
   "tools/webdriver/webdriver/__init__.py": [
    "b29b95e376344271b5b942d548d9e6d55ea275db",
    "support"
   ],
   "tools/webdriver/webdriver/client.py": [
-   "a8c9a061ccf50b1b870283871e2e4ea55bc4e8cc",
+   "34d1a90dde2d91e70a6c1b1bb1db6b2e07127d70",
    "support"
   ],
   "tools/webdriver/webdriver/error.py": [
    "b2337ff3b38f57828c72d76e49ef8893d30b578c",
    "support"
   ],
   "tools/webdriver/webdriver/protocol.py": [
    "18a3d52c8a3b537ba75d487fd7f6c5cde206ec3e",
@@ -643246,17 +643252,17 @@
    "f63869636da79cdcdc961e137d4f044055d74de4",
    "support"
   ],
   "tools/wptrunner/wptrunner/wptmanifest/tests/test_tokenizer.py": [
    "a64ce0c7bb7d8d089a8cb1365c0477a08652eacc",
    "support"
   ],
   "tools/wptrunner/wptrunner/wptrunner.py": [
-   "aab5996afd94e78686a027fd8546ca83e77766f4",
+   "74f7a7b9e733f1b73b9937705c6472b66e117c04",
    "support"
   ],
   "tools/wptrunner/wptrunner/wpttest.py": [
    "c29ba974a99786f687f2aead1ba14045c12fb643",
    "support"
   ],
   "tools/wptserve/.gitignore": [
    "8e87d388488bbc21c664209fecd2f3e030411b0e",
@@ -647433,16 +647439,20 @@
   "webdriver/tests/accept_alert/accept.py": [
    "a111f103bf142b4041f2a8d1c6017de79b54560e",
    "wdspec"
   ],
   "webdriver/tests/actions/__init__.py": [
    "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
    "support"
   ],
+  "webdriver/tests/actions/bounds.py": [
+   "e218c851e75220cea0c296461dad1d8427619afb",
+   "wdspec"
+  ],
   "webdriver/tests/actions/conftest.py": [
    "47aad72ba05d4e0c7afe989030c91c7824cb0b07",
    "support"
   ],
   "webdriver/tests/actions/control_click.py": [
    "2ec819b772fcfa4d0a37395aa64fb89ad7686bda",
    "wdspec"
   ],
@@ -647562,17 +647572,17 @@
    "1ed7db6e8e320575ffa99ec2f7b7cf2cfeb0ee6a",
    "wdspec"
   ],
   "webdriver/tests/delete_session/__init__.py": [
    "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
    "support"
   ],
   "webdriver/tests/delete_session/delete.py": [
-   "835f2525792136e7aa0082e9b32165b662e8cdd8",
+   "d0b4d796308e20d057df0a02edc3a9ed428d21eb",
    "wdspec"
   ],
   "webdriver/tests/dismiss_alert/__init__.py": [
    "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
    "support"
   ],
   "webdriver/tests/dismiss_alert/dismiss.py": [
    "c0efc38b47fd8b5d3d9fcf89a4dd803a9d38ec2f",
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webdriver/tests/actions/bounds.py
@@ -0,0 +1,51 @@
+import pytest
+
+from tests.support.asserts import assert_error, assert_success
+
+
+def perform_actions(session, actions):
+    return session.transport.send(
+        "POST",
+        "/session/{session_id}/actions".format(session_id=session.session_id),
+        {"actions": actions})
+
+
+@pytest.mark.parametrize("action_type", ["none", "key", "pointer"])
+def test_pause_positive_integer(session, action_type):
+    for valid_duration in [0, 1]:
+        actions = [{
+            "type": action_type,
+            "id": "foobar",
+            "actions": [{
+                "type": "pause",
+                "duration": valid_duration
+            }]
+        }]
+        response = perform_actions(session, actions)
+        assert_success(response)
+
+    actions = [{
+        "type": action_type,
+        "id": "foobar",
+        "actions": [{
+            "type": "pause",
+            "duration": -1
+        }]
+    }]
+    response = perform_actions(session, actions)
+    assert_error(response, "invalid argument")
+
+
+@pytest.mark.parametrize("action_type", ["none", "key", "pointer"])
+def test_pause_invalid_types(session, action_type):
+    for invalid_type in [0.0, None, "foo", True, [], {}]:
+        actions = [{
+            "type": action_type,
+            "id": "foobar",
+            "actions": [{
+                "type": "pause",
+                "duration": invalid_type
+            }]
+        }]
+        response = perform_actions(session, actions)
+        assert_error(response, "invalid argument")