Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gecko Bug 1824664] [wdspec] Add "Get Element Text" tests for ShadowRoot with slot. #43282

Merged
merged 1 commit into from
Nov 21, 2023

[wdspec] Add "Get Element Text" tests for ShadowRoot with slot.

5aef8e4
Select commit
Failed to load commit list.
Merged

[Gecko Bug 1824664] [wdspec] Add "Get Element Text" tests for ShadowRoot with slot. #43282

[wdspec] Add "Get Element Text" tests for ShadowRoot with slot.
5aef8e4
Select commit
Failed to load commit list.
Community-TC Integration / wpt-chrome-dev-results succeeded Nov 21, 2023 in 3m 41s

Community-TC (pull_request)

Collect results for all tests affected by a pull request in chrome.

Details

View task in Taskcluster
View logs in Taskcluster

WPT Command: python3 ./wpt run --channel=dev --no-fail-on-unexpected --log-wptreport=../artifacts/wpt_report.json --log-wptscreenshot=../artifacts/wpt_screenshot.txt --affected base_head --log-mach-level=info --log-mach=- -y --no-pause --no-restart-on-unexpected --install-fonts --no-headless --verify-log-full --enable-swiftshader chrome


        ("cheese", "<slot><span style=\"display: none\">foo</span>bar</slot>", "cheese"),
        ("", "<slot><span>foo</span>bar</slot>", "foobar"),
        ("", "<slot><span>foo</span></slot>bar", "foobar"),
        ("", "<slot><span style=\"display: none\">foo</span>bar</slot>", "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"""
            <test-container>{text}</test-container>
            <script>
                class TestContainer extends HTMLElement {{
                    connectedCallback() {{
                        const shadow = this.attachShadow({{ mode: "open" }});
                        shadow.innerHTML = "{inner_html}";
                    }}
                }}
    
                customElements.define("test-container", TestContainer);
            </script>
            """)
    
        element = session.find.css("test-container", all=False)
    
        result = get_element_text(session, element.id)
>       assert_success(result, expected)

element    = <WebElement 457810D87CA7807212824E3B471041DB_element_53>
expected   = 'foobar'
inline     = <function inline.<locals>.inline at 0x7fb06d1e95e0>
inner_html = '<slot><span>foo</span>bar</slot>'
result     = <Response: status=200 body={"value": ""}>
session    = <Session 2fdf3c2e2d84dc427a1e58a077a94147>
text       = ''

webdriver/tests/classic/get_element_text/get.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <Response: status=200 body={"value": ""}>, value = 'foobar'

    def assert_success(response, value=None):
        """
        Verify that the provided webdriver.Response instance described
        a valid success response as defined by `dfn-send-a-response` and
        the provided response value.
    
        :param response: ``webdriver.Response`` instance.
        :param value: Expected value of the response body, if any.
        """
        assert response.status == 200, str(response.error)
    
        if value is not None:
>           assert response.body["value"] == value
E           AssertionError: assert '' == 'foobar'
E             - foobar

response   = <Response: status=200 body={"value": ""}>
value      = 'foobar'

webdriver/tests/support/asserts.py:71: AssertionError
  FAIL test_shadow_root_slot[default outside] - AssertionError: assert 'bar' == 'foobar'
session = <Session 2fdf3c2e2d84dc427a1e58a077a94147>
inline = <function inline.<locals>.inline at 0x7fb06d1e9670>, text = ''
inner_html = '<slot><span>foo</span></slot>bar', expected = 'foobar'

    @pytest.mark.parametrize("text, inner_html, expected", [
        ("cheese", "<slot><span>foo</span>bar</slot>", "cheese"),
        ("cheese", "<slot><span>foo</span></slot>bar", "cheesebar"),
        ("cheese", "<slot><span style=\"display: none\">foo</span>bar</slot>", "cheese"),
        ("", "<slot><span>foo</span>bar</slot>", "foobar"),
        ("", "<slot><span>foo</span></slot>bar", "foobar"),
        ("", "<slot><span style=\"display: none\">foo</span>bar</slot>", "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"""
            <test-container>{text}</test-container>
            <script>
                class TestContainer extends HTMLElement {{
                    connectedCallback() {{
                        const shadow = this.attachShadow({{ mode: "open" }});
                        shadow.innerHTML = "{inner_html}";
                    }}
                }}
    
                customElements.define("test-container", TestContainer);
            </script>
            """)
    
        element = session.find.css("test-container", all=False)
    
        result = get_element_text(session, element.id)
>       assert_success(result, expected)

element    = <WebElement 23523604DF4A630417E6379B2B88CA2F_element_56>
expected   = 'foobar'
inline     = <function inline.<locals>.inline at 0x7fb06d1e9670>
inner_html = '<slot><span>foo</span></slot>bar'
result     = <Response: status=200 body={"value": "bar"}>
session    = <Session 2fdf3c2e2d84dc427a1e58a077a94147>
text       = ''

webdriver/tests/classic/get_element_text/get.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <Response: status=200 body={"value": "bar"}>, value = 'foobar'

    def assert_success(response, value=None):
        """
        Verify that the provided webdriver.Response instance described
        a valid success response as defined by `dfn-send-a-response` and
        the provided response value.
    
        :param response: ``webdriver.Response`` instance.
        :param value: Expected value of the response body, if any.
        """
        assert response.status == 200, str(response.error)
    
        if value is not None:
>           assert response.body["value"] == value
E           AssertionError: assert 'bar' == 'foobar'
E             - foobar
E             + bar

response   = <Response: status=200 body={"value": "bar"}>
value      = 'foobar'

webdriver/tests/support/asserts.py:71: AssertionError
  FAIL test_shadow_root_slot[default hidden] - AssertionError: assert '' == 'bar'
session = <Session 2fdf3c2e2d84dc427a1e58a077a94147>
inline = <function inline.<locals>.inline at 0x7fb06d1d8e50>, text = ''
inner_html = '<slot><span style="display: none">foo</span>bar</slot>'
expected = 'bar'

    @pytest.mark.parametrize("text, inner_html, expected", [
        ("cheese", "<slot><span>foo</span>bar</slot>", "cheese"),
        ("cheese", "<slot><span>foo</span></slot>bar", "cheesebar"),
        ("cheese", "<slot><span style=\"display: none\">foo</span>bar</slot>", "cheese"),
        ("", "<slot><span>foo</span>bar</slot>", "foobar"),
        ("", "<slot><span>foo</span></slot>bar", "foobar"),
        ("", "<slot><span style=\"display: none\">foo</span>bar</slot>", "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"""
            <test-container>{text}</test-container>
            <script>
                class TestContainer extends HTMLElement {{
                    connectedCallback() {{
                        const shadow = this.attachShadow({{ mode: "open" }});
                        shadow.innerHTML = "{inner_html}";
                    }}
                }}
    
                customElements.define("test-container", TestContainer);
            </script>
            """)
    
        element = session.find.css("test-container", all=False)
    
        result = get_element_text(session, element.id)
>       assert_success(result, expected)

element    = <WebElement EEEFF6F8AAADF6B88AA57A9CD282D349_element_59>
expected   = 'bar'
inline     = <function inline.<locals>.inline at 0x7fb06d1d8e50>
inner_html = '<slot><span style="display: none">foo</span>bar</slot>'
result     = <Response: status=200 body={"value": ""}>
session    = <Session 2fdf3c2e2d84dc427a1e58a077a94147>
text       = ''

webdriver/tests/classic/get_element_text/get.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

response = <Response: status=200 body={"value": ""}>, value = 'bar'

    def assert_success(response, value=None):
        """
        Verify that the provided webdriver.Response instance described
        a valid success response as defined by `dfn-send-a-response` and
        the provided response value.
    
        :param response: ``webdriver.Response`` instance.
        :param value: Expected value of the response body, if any.
        """
        assert response.status == 200, str(response.error)
    
        if value is not None:
>           assert response.body["value"] == value
E           AssertionError: assert '' == 'bar'
E             - bar

response   = <Response: status=200 body={"value": ""}>
value      = 'bar'

webdriver/tests/support/asserts.py:71: AssertionError
  FAIL test_pretty_print_xml - AssertionError: assert '' == 'cheese'
session = <Session 2fdf3c2e2d84dc427a1e58a077a94147>
inline = <function inline.<locals>.inline at 0x7fb06d1e91f0>

    def test_pretty_print_xml(session, inline):
        session.url = inline("<xml><foo>che<bar>ese</bar></foo></xml>", doctype="xml")
    
        elem = session.find.css("foo", all=False)
>       assert elem.text == "cheese"
E       AssertionError: assert '' == 'cheese'
E         - cheese

elem       = <WebElement 46A1925E1BDA24058FA129251DEDF7F0_element_64>
inline     = <function inline.<locals>.inline at 0x7fb06d1e91f0>
session    = <Session 2fdf3c2e2d84dc427a1e58a077a94147>

webdriver/tests/classic/get_element_text/get.py:145: AssertionError
 0:39.62 INFO Got 1 unexpected results, with 0 unexpected passes
 0:39.62 wptserve INFO Stopped WebTransport over HTTP/3 server on 127.0.0.1:11000
 0:39.67 wptserve INFO Stopped http server on 127.0.0.1:8443
 0:39.89 wptserve INFO Stopped http server on 127.0.0.1:9000
 0:39.89 wptserve INFO Stopped http server on 127.0.0.1:8000
 0:39.89 wptserve INFO Stopped http server on 127.0.0.1:8445
 0:39.89 wptserve INFO Stopped http server on 127.0.0.1:8003
 0:39.89 wptserve INFO Close on: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 8889))
 0:39.89 wptserve INFO Stopped http server on 127.0.0.1:8001
 0:39.89 wptserve INFO Stopped http server on 127.0.0.1:8446
 0:39.89 wptserve INFO Stopped http server on 127.0.0.1:8444
 0:39.89 wptserve INFO Close on: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 8888))
 0:39.89 wptserve INFO Stopped http server on 127.0.0.1:8002
 0:39.99 INFO Removed font: Ahem.ttf
 0:40.01 INFO Closing logging queue
 0:40.01 INFO queue closed
 0:40.01 INFO Tolerating 1 unexpected results
[taskcluster 2023-11-21 11:35:42.057Z] === Task Finished ===
[taskcluster 2023-11-21 11:35:42.801Z] Successful task run with exit code: 0 completed in 176.437 seconds