[Gecko Bug 1824664] [wdspec] Add "Get Element Text" tests for ShadowRoot with slot. #43282
Community-TC Integration / wpt-chrome-dev-stability
succeeded
Nov 21, 2023 in 7m 28s
Community-TC (pull_request)
Verify that all tests affected by a pull request are stable when executed in chrome.
Details
View task in Taskcluster
View logs in Taskcluster
WPT Command: python3 ./wpt run --channel=dev --verify --verify-no-chaos-mode --verify-repeat-loop=0 --verify-repeat-restart=10 --github-checks-text-file=/home/test/artifacts/checkrun.md --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
element = <WebElement 33231D58A670069D9F30DFB4ACA2E37F_element_53>
expected = 'foobar'
inline = <function inline.<locals>.inline at 0x7f7dec0deb80>
inner_html = '<slot><span>foo</span>bar</slot>'
result = <Response: status=200 body={"value": ""}>
session = <Session 726727f9870162974ce97b77682227e2>
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 726727f9870162974ce97b77682227e2>
inline = <function inline.<locals>.inline at 0x7f7dec0dd280>, 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 26A5BAD3329E655132924B70219AE0B8_element_56>
expected = 'foobar'
inline = <function inline.<locals>.inline at 0x7f7dec0dd280>
inner_html = '<slot><span>foo</span></slot>bar'
result = <Response: status=200 body={"value": "bar"}>
session = <Session 726727f9870162974ce97b77682227e2>
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 726727f9870162974ce97b77682227e2>
inline = <function inline.<locals>.inline at 0x7f7dec0dd940>, 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 8B1FAB1767C75F0C99BC0CAD3B7D91B6_element_59>
expected = 'bar'
inline = <function inline.<locals>.inline at 0x7f7dec0dd940>
inner_html = '<slot><span style="display: none">foo</span>bar</slot>'
result = <Response: status=200 body={"value": ""}>
session = <Session 726727f9870162974ce97b77682227e2>
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 726727f9870162974ce97b77682227e2>
inline = <function inline.<locals>.inline at 0x7f7dec0ddca0>
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 7AD86550E32673C5C9A3A3ABB1546102_element_64>
inline = <function inline.<locals>.inline at 0x7f7dec0ddca0>
session = <Session 726727f9870162974ce97b77682227e2>
webdriver/tests/classic/get_element_text/get.py:145: AssertionError
2:55.50 INFO Got 10 unexpected results, with 0 unexpected passes
2:55.51 wptserve INFO Stopped WebTransport over HTTP/3 server on 127.0.0.1:11000
2:55.51 wptserve INFO Stopped http server on 127.0.0.1:8443
2:55.90 wptserve INFO Stopped http server on 127.0.0.1:8000
2:55.90 wptserve INFO Stopped http server on 127.0.0.1:8002
2:55.90 wptserve INFO Close on: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 8888))
2:55.90 wptserve INFO Stopped http server on 127.0.0.1:8444
2:55.91 wptserve INFO Stopped http server on 127.0.0.1:9000
2:55.91 wptserve INFO Stopped http server on 127.0.0.1:8445
2:55.91 wptserve INFO Stopped http server on 127.0.0.1:8003
2:55.92 wptserve INFO Stopped http server on 127.0.0.1:8001
2:55.92 wptserve INFO Close on: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 8889))
2:55.92 wptserve INFO Stopped http server on 127.0.0.1:8446
2:56.01 INFO Removed font: Ahem.ttf
2:56.03 INFO Closing logging queue
2:56.03 INFO queue closed
2:56.07 INFO ::: Ran 10 of expected 10 iterations.
2:56.07 INFO ## All results ##
2:56.07 INFO ### /webdriver/tests/classic/get_element_text/get.py ###
2:56.07 INFO | Subtest | Results | Messages |
2:56.07 INFO |-----------------------------------------------------------|---------|-------------------------------------------------------------------------|
2:56.07 INFO | | OK | |
2:56.07 INFO | `test_no_top_browsing_context` | FAIL | `AssertionError: assert 'stale element reference' == 'no such element'` |
2:56.07 INFO | `test_no_browsing_context` | FAIL | `AssertionError: assert 'no such element' == 'no such window'` |
2:56.07 INFO | `test_no_such_element_with_invalid_value` | PASS | |
2:56.07 INFO | `test_no_such_element_with_shadow_root` | FAIL | `assert 500 == 404` |
2:56.07 INFO | `test_no_such_element_from_other_window_handle[open]` | FAIL | `AssertionError: assert 'stale element reference' == 'no such element'` |
2:56.07 INFO | `test_no_such_element_from_other_window_handle[closed]` | FAIL | `AssertionError: assert 'stale element reference' == 'no such element'` |
2:56.07 INFO | `test_no_such_element_from_other_frame[open]` | FAIL | `AssertionError: assert 'stale element reference' == 'no such element'` |
2:56.07 INFO | `test_no_such_element_from_other_frame[closed]` | FAIL | `AssertionError: assert 'stale element reference' == 'no such element'` |
2:56.07 INFO | `test_stale_element_reference[top_context]` | PASS | |
2:56.07 INFO | `test_stale_element_reference[child_context]` | PASS | |
2:56.07 INFO | `test_getting_text_of_a_non_existant_element_is_an_error` | PASS | |
2:56.07 INFO | `test_read_element_text` | PASS | |
2:56.07 INFO | `test_shadow_root_slot[custom visible]` | PASS | |
2:56.07 INFO | `test_shadow_root_slot[custom outside]` | PASS | |
2:56.07 INFO | `test_shadow_root_slot[custom hidden]` | PASS | |
2:56.07 INFO | `test_shadow_root_slot[default visible]` | FAIL | `AssertionError: assert '' == 'foobar'` |
2:56.07 INFO | `test_shadow_root_slot[default outside]` | FAIL | `AssertionError: assert 'bar' == 'foobar'` |
2:56.07 INFO | `test_shadow_root_slot[default hidden]` | FAIL | `AssertionError: assert '' == 'bar'` |
2:56.07 INFO | `test_pretty_print_xml` | FAIL | `AssertionError: assert '' == 'cheese'` |
2:56.07 INFO
2:56.07 INFO ::: Running tests in a loop with restarts 10 times : PASS
2:56.07 INFO :::
2:56.07 INFO ::: Test verification PASS
2:56.07 INFO :::
X connection to :99.0 broken (explicit kill or server shutdown).
[taskcluster 2023-11-21 11:39:29.861Z] === Task Finished ===
[taskcluster 2023-11-21 11:39:30.162Z] Successful task run with exit code: 0 completed in 405.596 seconds