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.
This commit is contained in:
Andreas Tolfsen 2018-08-17 10:18:01 +01:00
parent eb86582a92
commit 8ca32c5454
2 changed files with 65 additions and 4 deletions

View File

@ -422103,6 +422103,12 @@
{}
]
],
"webdriver/tests/actions/bounds.py": [
[
"/webdriver/tests/actions/bounds.py",
{}
]
],
"webdriver/tests/actions/control_click.py": [
[
"/webdriver/tests/actions/control_click.py",
@ -554859,7 +554865,7 @@
"support"
],
"css/css-transitions/support/helper.js": [
"eb5959ce5e1a13bf51b4228f36fe851618a12697",
"aa3efe8012268115734bd91bff8f82ceb8d26eea",
"support"
],
"css/css-transitions/support/import-green.css": [
@ -642615,7 +642621,7 @@
"support"
],
"tools/webdriver/webdriver/client.py": [
"a8c9a061ccf50b1b870283871e2e4ea55bc4e8cc",
"34d1a90dde2d91e70a6c1b1bb1db6b2e07127d70",
"support"
],
"tools/webdriver/webdriver/error.py": [
@ -643251,7 +643257,7 @@
"support"
],
"tools/wptrunner/wptrunner/wptrunner.py": [
"aab5996afd94e78686a027fd8546ca83e77766f4",
"74f7a7b9e733f1b73b9937705c6472b66e117c04",
"support"
],
"tools/wptrunner/wptrunner/wpttest.py": [
@ -647438,6 +647444,10 @@
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
"support"
],
"webdriver/tests/actions/bounds.py": [
"e218c851e75220cea0c296461dad1d8427619afb",
"wdspec"
],
"webdriver/tests/actions/conftest.py": [
"47aad72ba05d4e0c7afe989030c91c7824cb0b07",
"support"
@ -647567,7 +647577,7 @@
"support"
],
"webdriver/tests/delete_session/delete.py": [
"835f2525792136e7aa0082e9b32165b662e8cdd8",
"d0b4d796308e20d057df0a02edc3a9ed428d21eb",
"wdspec"
],
"webdriver/tests/dismiss_alert/__init__.py": [

View File

@ -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")