зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1772484 - [wdspec] Fix script execution tests to correctly encode and decode payload. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D149267
This commit is contained in:
Родитель
85dac95fed
Коммит
d1b7e19d3a
|
@ -0,0 +1,16 @@
|
|||
import webdriver.protocol as protocol
|
||||
|
||||
|
||||
def execute_async_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST",
|
||||
"/session/{session_id}/execute/async".format(**vars(session)),
|
||||
body,
|
||||
encoder=protocol.Encoder,
|
||||
decoder=protocol.Decoder,
|
||||
session=session,
|
||||
)
|
|
@ -1,16 +1,9 @@
|
|||
import os
|
||||
|
||||
from webdriver.client import ShadowRoot
|
||||
|
||||
from tests.support.asserts import assert_same_element, assert_success
|
||||
|
||||
|
||||
def execute_async_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/async".format(**vars(session)),
|
||||
body)
|
||||
from . import execute_async_script
|
||||
|
||||
|
||||
def test_arguments(session):
|
||||
|
@ -185,6 +178,5 @@ def test_shadow_root(session, inline):
|
|||
resolve(document.querySelector('custom-checkbox-element').shadowRoot);
|
||||
""")
|
||||
value = assert_success(response)
|
||||
assert isinstance(value, dict)
|
||||
assert "shadow-6066-11e4-a52e-4f735466cecf" in value
|
||||
assert value["shadow-6066-11e4-a52e-4f735466cecf"] == expected.id
|
||||
assert isinstance(value, ShadowRoot)
|
||||
assert value.id == expected.id
|
||||
|
|
|
@ -5,16 +5,7 @@ from webdriver.transport import Response
|
|||
|
||||
from tests.support.asserts import assert_error, assert_success
|
||||
from tests.support.sync import Poll
|
||||
|
||||
|
||||
def execute_async_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/async".format(**vars(session)),
|
||||
body)
|
||||
from . import execute_async_script
|
||||
|
||||
|
||||
def test_null_parameter_value(session, http):
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
from tests.support.asserts import assert_error, assert_success
|
||||
|
||||
|
||||
def execute_async_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/async".format(**vars(session)),
|
||||
body)
|
||||
from . import execute_async_script
|
||||
|
||||
|
||||
def test_promise_resolve(session):
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
from tests.support.asserts import assert_same_element, assert_success
|
||||
|
||||
|
||||
def execute_async_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/async".format(**vars(session)),
|
||||
body)
|
||||
from . import execute_async_script
|
||||
|
||||
|
||||
def test_content_attribute(session, inline):
|
||||
|
|
|
@ -3,16 +3,7 @@
|
|||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
|
||||
|
||||
|
||||
def execute_async_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/async".format(**vars(session)),
|
||||
body)
|
||||
from . import execute_async_script
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import webdriver.protocol as protocol
|
||||
|
||||
|
||||
def execute_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST",
|
||||
"/session/{session_id}/execute/sync".format(**vars(session)),
|
||||
body,
|
||||
encoder=protocol.Encoder,
|
||||
decoder=protocol.Decoder,
|
||||
session=session,
|
||||
)
|
|
@ -1,16 +1,9 @@
|
|||
import os
|
||||
|
||||
from webdriver.client import ShadowRoot
|
||||
|
||||
from tests.support.asserts import assert_same_element, assert_success
|
||||
|
||||
|
||||
def execute_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/sync".format(**vars(session)),
|
||||
body)
|
||||
from . import execute_script
|
||||
|
||||
|
||||
def test_arguments(session):
|
||||
|
@ -161,6 +154,5 @@ def test_shadow_root(session, inline):
|
|||
response = execute_script(session,
|
||||
"return document.querySelector('custom-checkbox-element').shadowRoot")
|
||||
value = assert_success(response)
|
||||
assert isinstance(value, dict)
|
||||
assert "shadow-6066-11e4-a52e-4f735466cecf" in value
|
||||
assert value["shadow-6066-11e4-a52e-4f735466cecf"] == expected.id
|
||||
assert isinstance(value, ShadowRoot)
|
||||
assert value.id == expected.id
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
from tests.support.asserts import assert_error, assert_same_element, assert_success
|
||||
|
||||
|
||||
def execute_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/sync".format(
|
||||
session_id=session.session_id),
|
||||
body)
|
||||
from . import execute_script
|
||||
|
||||
|
||||
def test_array(session):
|
||||
|
|
|
@ -1,21 +1,10 @@
|
|||
import pytest
|
||||
|
||||
from webdriver.error import NoSuchAlertException
|
||||
from webdriver.transport import Response
|
||||
|
||||
from tests.support.asserts import assert_error, assert_success
|
||||
from tests.support.sync import Poll
|
||||
|
||||
|
||||
def execute_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/sync".format(
|
||||
session_id=session.session_id),
|
||||
body)
|
||||
from . import execute_script
|
||||
|
||||
|
||||
def test_null_parameter_value(session, http):
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
import json
|
||||
|
||||
from tests.support.asserts import assert_success
|
||||
|
||||
from . import execute_script
|
||||
|
||||
_window_id = "window-fcc6-11e5-b4f8-330a88ab9d7f"
|
||||
_frame_id = "frame-075b-4da1-b6ba-e579c2d3230a"
|
||||
|
||||
|
||||
def execute_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/sync".format(**vars(session)),
|
||||
body)
|
||||
|
||||
|
||||
def test_initial_window(session):
|
||||
# non-auxiliary top-level browsing context
|
||||
response = execute_script(session, "return window;")
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
from tests.support.asserts import assert_error, assert_success
|
||||
|
||||
|
||||
def execute_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/sync".format(
|
||||
session_id=session.session_id),
|
||||
body)
|
||||
from . import execute_script
|
||||
|
||||
|
||||
def test_promise_resolve(session):
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
from tests.support.asserts import assert_same_element, assert_success
|
||||
|
||||
|
||||
def execute_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/sync".format(**vars(session)),
|
||||
body)
|
||||
from . import execute_script
|
||||
|
||||
|
||||
def test_content_attribute(session, inline):
|
||||
|
|
|
@ -3,17 +3,7 @@
|
|||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
|
||||
|
||||
|
||||
def execute_script(session, script, args=None):
|
||||
if args is None:
|
||||
args = []
|
||||
body = {"script": script, "args": args}
|
||||
|
||||
return session.transport.send(
|
||||
"POST", "/session/{session_id}/execute/sync".format(
|
||||
session_id=session.session_id),
|
||||
body)
|
||||
from . import execute_script
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
Загрузка…
Ссылка в новой задаче