From db065869e8ff859e7d297b04b21115a9669da745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20David=20Garc=C3=ADa=20Gomez?= <1581288+sarvaje@users.noreply.github.com> Date: Fri, 13 Aug 2021 01:17:42 -0700 Subject: [PATCH] Fix some shadow root tests (#29924) --- tools/webdriver/webdriver/client.py | 2 +- webdriver/tests/find_element_from_shadow_root/find.py | 10 +++++----- .../find_element_from_shadow_root/user_prompts.py | 2 +- webdriver/tests/find_elements_from_shadow_root/find.py | 10 ++++------ .../find_elements_from_shadow_root/user_prompts.py | 2 +- webdriver/tests/support/asserts.py | 2 ++ 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/webdriver/webdriver/client.py b/tools/webdriver/webdriver/client.py index 2c7b1c5dbeb12a..61c04a377c5096 100644 --- a/tools/webdriver/webdriver/client.py +++ b/tools/webdriver/webdriver/client.py @@ -392,7 +392,7 @@ def __init__(self, session, id): @classmethod def from_json(cls, json, session): uuid = json[ShadowRoot.identifier] - return cls(uuid, session) + return cls(session, uuid) def send_shadow_command(self, method, uri, body=None): url = "shadow/{}/{}".format(self.id, uri) diff --git a/webdriver/tests/find_element_from_shadow_root/find.py b/webdriver/tests/find_element_from_shadow_root/find.py index 87941d495e1355..1d3e6fbf4ec937 100644 --- a/webdriver/tests/find_element_from_shadow_root/find.py +++ b/webdriver/tests/find_element_from_shadow_root/find.py @@ -54,7 +54,7 @@ def test_detached_shadow_root(session, get_shadow_page): shadow_root = custom_element.shadow_root session.refresh() - response = find_element(session, shadow_root.id, "css", "input") + response = find_element(session, shadow_root.id, "css selector", "input") assert_error(response, "detached shadow root") @@ -64,7 +64,7 @@ def test_found_element_equivalence(session, get_shadow_page): expected = session.execute_script("return arguments[0].shadowRoot.querySelector('input')", args=(custom_element,)) shadow_root = custom_element.shadow_root - response = find_element(session, shadow_root.id, "css", "input") + response = find_element(session, shadow_root.id, "css selector", "input") value = assert_success(response) assert_same_element(session, value, expected) @@ -83,7 +83,7 @@ def test_find_element(session, get_shadow_page, using, value): args=(custom_element,)) shadow_root = custom_element.shadow_root response = find_element(session, shadow_root.id, using, value) - assert_success(response) + value = assert_success(response) assert_same_element(session, value, expected) @@ -104,7 +104,7 @@ def test_find_element_link_text(session, get_shadow_page, document, value): shadow_root = custom_element.shadow_root response = find_element(session, shadow_root.id, "link text", value) - assert_success(response) + value = assert_success(response) assert_same_element(session, value, expected) @@ -126,7 +126,7 @@ def test_find_element_partial_link_text(session, get_shadow_page, document, valu shadow_root = custom_element.shadow_root response = find_element(session, shadow_root.id, "partial link text", value) - assert_success(response) + value = assert_success(response) assert_same_element(session, value, expected) diff --git a/webdriver/tests/find_element_from_shadow_root/user_prompts.py b/webdriver/tests/find_element_from_shadow_root/user_prompts.py index 3813a7df5d3242..e1326cf599a4af 100644 --- a/webdriver/tests/find_element_from_shadow_root/user_prompts.py +++ b/webdriver/tests/find_element_from_shadow_root/user_prompts.py @@ -14,7 +14,7 @@ def find_element(session, shadow_id, using, value): return session.transport.send( "POST", "session/{session_id}/shadow/{shadow_id}/element".format( session_id=session.session_id, - element_id=shadow_id), + shadow_id=shadow_id), {"using": using, "value": value}) diff --git a/webdriver/tests/find_elements_from_shadow_root/find.py b/webdriver/tests/find_elements_from_shadow_root/find.py index f70a4b45aadb05..5336ac16307770 100644 --- a/webdriver/tests/find_elements_from_shadow_root/find.py +++ b/webdriver/tests/find_elements_from_shadow_root/find.py @@ -13,8 +13,8 @@ def find_elements(session, shadow_id, using, value): {"using": using, "value": value}) -def test_null_parameter_value(session, http, inline): - session.url = inline("
") +def test_null_parameter_value(session, http, get_shadow_page): + session.url = get_shadow_page("") custom_element = session.find.css("custom-shadow-element", all=False) shadow_root = custom_element.shadow_root @@ -54,7 +54,7 @@ def test_detached_shadow_root(session, get_shadow_page): shadow_root = custom_element.shadow_root session.refresh() - response = find_elements(session, shadow_root.id, "css", "input") + response = find_elements(session, shadow_root.id, "css selector", "input") assert_error(response, "detached shadow root") @@ -62,7 +62,7 @@ def test_find_elements_equivalence(session, get_shadow_page): session.url = get_shadow_page("") custom_element = session.find.css("custom-shadow-element", all=False) shadow_root = custom_element.shadow_root - response = find_elements(session, shadow_root.id, "css", "input") + response = find_elements(session, shadow_root.id, "css selector", "input") assert_success(response) @@ -92,7 +92,6 @@ def test_find_elements(session, get_shadow_page, using, value): def test_find_elements_link_text(session, get_shadow_page, document, value): # Step 8 - 9 session.url = get_shadow_page("