diff --git a/testing/web-platform/tests/webdriver/actions/conftest.py b/testing/web-platform/tests/webdriver/actions/conftest.py index 3e9037769984..b51a6d4e0cf6 100644 --- a/testing/web-platform/tests/webdriver/actions/conftest.py +++ b/testing/web-platform/tests/webdriver/actions/conftest.py @@ -6,6 +6,14 @@ def key_chain(session): return session.actions.sequence("key", "keyboard_id") +@pytest.fixture +def mouse_chain(session): + return session.actions.sequence( + "pointer", + "pointer_id", + {"pointerType": "mouse"}) + + @pytest.fixture(autouse=True) def release_actions(session, request): # release all actions after each test diff --git a/testing/web-platform/tests/webdriver/actions/key.py b/testing/web-platform/tests/webdriver/actions/key.py index c415e0771b18..d4f313c47353 100644 --- a/testing/web-platform/tests/webdriver/actions/key.py +++ b/testing/web-platform/tests/webdriver/actions/key.py @@ -1,21 +1,7 @@ import pytest from support.keys import Keys -from support.refine import get_keys, filter_dict - - -def get_events(session): - """Return list of key events recorded in the test_keys_page fixture.""" - events = session.execute_script("return allEvents.events;") or [] - # `key` values in `allEvents` may be escaped (see `escapeSurrogateHalf` in - # test_keys_wdspec.html), so this converts them back into unicode literals. - for e in events: - # example: turn "U+d83d" (6 chars) into u"\ud83d" (1 char) - if e["key"].startswith(u"U+"): - key = e["key"] - hex_suffix = key[key.index("+") + 1:] - e["key"] = unichr(int(hex_suffix, 16)) - return events +from support.refine import get_keys, filter_dict, get_events def test_lone_keyup_sends_no_events(session, key_reporter, key_chain): diff --git a/testing/web-platform/tests/webdriver/actions/mouse.py b/testing/web-platform/tests/webdriver/actions/mouse.py index e3b0583477a5..e5f57575be62 100644 --- a/testing/web-platform/tests/webdriver/actions/mouse.py +++ b/testing/web-platform/tests/webdriver/actions/mouse.py @@ -1,4 +1,8 @@ -import pytest +from support.refine import get_events -def test_nothing(): - assert True + +#def test_nothing(session, test_actions_page, mouse_chain): +# mouse_chain \ +# .pointer_down(1) \ +# .perform() +# assert True diff --git a/testing/web-platform/tests/webdriver/actions/sequence.py b/testing/web-platform/tests/webdriver/actions/sequence.py index dacebb999bbf..960b800dff84 100644 --- a/testing/web-platform/tests/webdriver/actions/sequence.py +++ b/testing/web-platform/tests/webdriver/actions/sequence.py @@ -1,18 +1,4 @@ -from support.refine import get_keys, filter_dict - - -def get_events(session): - """Return list of key events recorded in the test_keys_page fixture.""" - events = session.execute_script("return allEvents.events;") or [] - # `key` values in `allEvents` may be escaped (see `escapeSurrogateHalf` in - # test_keys_wdspec.html), so this converts them back into unicode literals. - for e in events: - # example: turn "U+d83d" (6 chars) into u"\ud83d" (1 char) - if e["key"].startswith(u"U+"): - key = e["key"] - hex_suffix = key[key.index("+") + 1:] - e["key"] = unichr(int(hex_suffix, 16)) - return events +from support.refine import get_keys, filter_dict, get_events def test_no_actions_send_no_events(session, key_reporter, key_chain): diff --git a/testing/web-platform/tests/webdriver/actions/support/refine.py b/testing/web-platform/tests/webdriver/actions/support/refine.py index 08a5f8875da3..3a6d63e04ce9 100644 --- a/testing/web-platform/tests/webdriver/actions/support/refine.py +++ b/testing/web-platform/tests/webdriver/actions/support/refine.py @@ -1,3 +1,17 @@ +def get_events(session): + """Return list of key events recorded in the test_keys_page fixture.""" + events = session.execute_script("return allEvents.events;") or [] + # `key` values in `allEvents` may be escaped (see `escapeSurrogateHalf` in + # test_keys_wdspec.html), so this converts them back into unicode literals. + for e in events: + # example: turn "U+d83d" (6 chars) into u"\ud83d" (1 char) + if "key" in e and e["key"].startswith(u"U+"): + key = e["key"] + hex_suffix = key[key.index("+") + 1:] + e["key"] = unichr(int(hex_suffix, 16)) + return events + + def get_keys(input_el): """Get printable characters entered into `input_el`. diff --git a/testing/web-platform/tests/webdriver/actions/support/test_actions_wdspec.html b/testing/web-platform/tests/webdriver/actions/support/test_actions_wdspec.html index ccc2726aefc4..38b3885f6f41 100644 --- a/testing/web-platform/tests/webdriver/actions/support/test_actions_wdspec.html +++ b/testing/web-platform/tests/webdriver/actions/support/test_actions_wdspec.html @@ -1,8 +1,17 @@ -