From 1a0633b5e4bc9dc6f784ebd11a3ac6ceca71e291 Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Tue, 21 Nov 2023 11:28:58 +0000 Subject: [PATCH] [wdspec] Add "Get Element Text" tests for ShadowRoot with slot. Differential Revision: https://phabricator.services.mozilla.com/D193651 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1824664 gecko-commit: 8c758adbe3cbecd8c1ea1990921a78072254e6f3 gecko-reviewers: webdriver-reviewers, jgraham --- .../tests/classic/get_element_text/get.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/webdriver/tests/classic/get_element_text/get.py b/webdriver/tests/classic/get_element_text/get.py index 2a2363c0528eef..547152b2a72e3c 100644 --- a/webdriver/tests/classic/get_element_text/get.py +++ b/webdriver/tests/classic/get_element_text/get.py @@ -102,6 +102,42 @@ def test_read_element_text(session, inline): assert_success(result, "oo") +@pytest.mark.parametrize("text, inner_html, expected", [ + ("cheese", "foobar", "cheese"), + ("cheese", "foobar", "cheesebar"), + ("cheese", "foobar", "cheese"), + ("", "foobar", "foobar"), + ("", "foobar", "foobar"), + ("", "foobar", "bar"), +], ids=[ + "custom visible", + "custom outside", + "custom hidden", + "default visible", + "default outside", + "default hidden", +]) +def test_shadow_root_slot(session, inline, text, inner_html, expected): + session.url = inline(f""" + {text} + + """) + + element = session.find.css("test-container", all=False) + + result = get_element_text(session, element.id) + assert_success(result, expected) + + def test_pretty_print_xml(session, inline): session.url = inline("cheese", doctype="xml")