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

[webdriver-bidi] Add tests for browsingContext.locateNodes #42565

Merged

Merge branch 'master' into webdriver-bidi-locate-nodes

00e6257
Select commit
Loading
Failed to load commit list.
Merged

[webdriver-bidi] Add tests for browsingContext.locateNodes #42565

Merge branch 'master' into webdriver-bidi-locate-nodes
00e6257
Select commit
Loading
Failed to load commit list.
Community-TC Integration / wpt-chrome-dev-results succeeded Nov 28, 2023 in 3m 45s

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


                           'shadowRoot': None}},
                {'sharedId': '6547267F33170B61BE754B31070AD49F_element_17',
                 'type': 'node',
                 'value': {'attributes': {},
                           'childNodeCount': 0,
                           'localName': 'p',
                           'namespaceURI': 'http://www.w3.org/1999/xhtml',
                           'nodeType': 1,
                           'shadowRoot': None}}]}
params_fn  = <function BrowsingContext.locate_nodes at 0x7f9d725c6820>
raw_result = False
result_fn  = <function BrowsingContext._locate_nodes at 0x7f9d725c68b0>
self       = <webdriver.bidi.modules.browsing_context.BrowsingContext object at 0x7f9d7245bca0>

tools/webdriver/webdriver/bidi/modules/_module.py:76: UnknownCommandException
  FAIL test_locate_with_multiple_context_nodes[innerText-foo] - webdriver.bidi.error.UnknownCommandException: unknown command (Unknown command 'browsingContext.locateNodes'.)
bidi_session = <webdriver.bidi.client.BidiSession object at 0x7f9d7245be20>
inline = <function inline.<locals>.inline at 0x7f9d71738700>
top_context = {'children': [], 'context': '3189BF29B32044262999B05757BA3634', 'parent': None, 'url': 'https://web-platform.test:8443...%2Fdiv%3E%3Cdiv+data-class%3D%22two%22%3Ebar%3C%2Fdiv%3E%3C%2Fp%3E%0A+++++++++++++++++&mime=text%2Fhtml&charset=UTF-8'}
type = 'innerText', value = 'foo'

    @pytest.mark.parametrize("type,value", [
        ("css", "div[data-class='one']"),
        ("xpath", ".//div[@data-class='one']"),
        ("innerText", "foo")
    ])
    @pytest.mark.asyncio
    async def test_locate_with_multiple_context_nodes(bidi_session, inline, top_context, type, value):
        url = inline("""
                     <p id="parent-one"><div data-class="one">foo</div><div data-class="two">bar</div></p>
                     <p id="parent-two"><div data-class="one">foo</div><div data-class="two">bar</div></p>
                     """)
        await bidi_session.browsing_context.navigate(
            context=top_context["context"], url=url, wait="complete"
        )
    
        script_result = await bidi_session.script.evaluate(
            expression="""document.querySelectorAll("p")""",
            target=ContextTarget(top_context["context"]),
            await_promise=True,
        )
    
        context_nodes = script_result["value"]
    
>       result = await bidi_session.browsing_context.locate_nodes(
            context=top_context["context"],
            locator={ "type": type, "value": value },
            start_nodes=context_nodes
        )

bidi_session = <webdriver.bidi.client.BidiSession object at 0x7f9d7245be20>
context_nodes = [{'sharedId': 'D517C64297702194903532C82D463348_element_19',
  'type': 'node',
  'value': {'attributes': {'id': 'parent-one'},
            'childNodeCount': 0,
            'localName': 'p',
            'namespaceURI': 'http://www.w3.org/1999/xhtml',
            'nodeType': 1,
            'shadowRoot': None}},
 {'sharedId': 'D517C64297702194903532C82D463348_element_20',
  'type': 'node',
  'value': {'attributes': {},
            'childNodeCount': 0,
            'localName': 'p',
            'namespaceURI': 'http://www.w3.org/1999/xhtml',
            'nodeType': 1,
            'shadowRoot': None}},
 {'sharedId': 'D517C64297702194903532C82D463348_element_21',
  'type': 'node',
  'value': {'attributes': {'id': 'parent-two'},
            'childNodeCount': 0,
            'localName': 'p',
            'namespaceURI': 'http://www.w3.org/1999/xhtml',
            'nodeType': 1,
            'shadowRoot': None}},
 {'sharedId': 'D517C64297702194903532C82D463348_element_22',
  'type': 'node',
  'value': {'attributes': {},
            'childNodeCount': 0,
            'localName': 'p',
            'namespaceURI': 'http://www.w3.org/1999/xhtml',
            'nodeType': 1,
            'shadowRoot': None}}]
inline     = <function inline.<locals>.inline at 0x7f9d71738700>
script_result = {'type': 'nodelist',
 'value': [{'sharedId': 'D517C64297702194903532C82D463348_element_19',
            'type': 'node',
            'value': {'attributes': {'id': 'parent-one'},
                      'childNodeCount': 0,
                      'localName': 'p',
                      'namespaceURI': 'http://www.w3.org/1999/xhtml',
                      'nodeType': 1,
                      'shadowRoot': None}},
           {'sharedId': 'D517C64297702194903532C82D463348_element_20',
            'type': 'node',
            'value': {'attributes': {},
                      'childNodeCount': 0,
                      'localName': 'p',
                      'namespaceURI': 'http://www.w3.org/1999/xhtml',
                      'nodeType': 1,
                      'shadowRoot': None}},
           {'sharedId': 'D517C64297702194903532C82D463348_element_21',
            'type': 'node',
            'value': {'attributes': {'id': 'parent-two'},
                      'childNodeCount': 0,
                      'localName': 'p',
                      'namespaceURI': 'http://www.w3.org/1999/xhtml',
                      'nodeType': 1,
                      'shadowRoot': None}},
           {'sharedId': 'D517C64297702194903532C82D463348_element_22',
            'type': 'node',
            'value': {'attributes': {},
                      'childNodeCount': 0,
                      'localName': 'p',
                      'namespaceURI': 'http://www.w3.org/1999/xhtml',
                      'nodeType': 1,
                      'shadowRoot': None}}]}
top_context = {'children': [],
 'context': '3189BF29B32044262999B05757BA3634',
 'parent': None,
 'url': 'https://web-platform.test:8443/webdriver/tests/support/inline.py?doc=%3C%21doctype+html%3E%0A%3Cmeta+charset%3DUTF-8%3E%0A%0A+++++++++++++++++%3Cp+id%3D%22parent-one%22%3E%3Cdiv+data-class%3D%22one%22%3Efoo%3C%2Fdiv%3E%3Cdiv+data-class%3D%22two%22%3Ebar%3C%2Fdiv%3E%3C%2Fp%3E%0A+++++++++++++++++%3Cp+id%3D%22parent-two%22%3E%3Cdiv+data-class%3D%22one%22%3Efoo%3C%2Fdiv%3E%3Cdiv+data-class%3D%22two%22%3Ebar%3C%2Fdiv%3E%3C%2Fp%3E%0A+++++++++++++++++&mime=text%2Fhtml&charset=UTF-8'}
type       = 'innerText'
url        = 'https://web-platform.test:8443/webdriver/tests/support/inline.py?doc=%3C%21doctype+html%3E%0A%3Cmeta+charset%3DUTF-8%3E%0A%0A+++++++++++++++++%3Cp+id%3D%22parent-one%22%3E%3Cdiv+data-class%3D%22one%22%3Efoo%3C%2Fdiv%3E%3Cdiv+data-class%3D%22two%22%3Ebar%3C%2Fdiv%3E%3C%2Fp%3E%0A+++++++++++++++++%3Cp+id%3D%22parent-two%22%3E%3Cdiv+data-class%3D%22one%22%3Efoo%3C%2Fdiv%3E%3Cdiv+data-class%3D%22two%22%3Ebar%3C%2Fdiv%3E%3C%2Fp%3E%0A+++++++++++++++++&mime=text%2Fhtml&charset=UTF-8'
value      = 'foo'

webdriver/tests/bidi/browsing_context/locate_nodes/start_nodes.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <webdriver.bidi.modules.browsing_context.BrowsingContext object at 0x7f9d7245bca0>
kwargs = {'context': '3189BF29B32044262999B05757BA3634', 'locator': {'type': 'innerText', 'value': 'foo'}, 'start_nodes': [{'sh...lue': {'attributes': {}, 'childNodeCount': 0, 'localName': 'p', 'namespaceURI': 'http://www.w3.org/1999/xhtml', ...}}]}
raw_result = False
params = {'context': '3189BF29B32044262999B05757BA3634', 'locator': {'type': 'innerText', 'value': 'foo'}, 'startNodes': [{'sha...lue': {'attributes': {}, 'childNodeCount': 0, 'localName': 'p', 'namespaceURI': 'http://www.w3.org/1999/xhtml', ...}}]}
mod_name = 'browsingContext', cmd_name = 'browsingContext.locateNodes'
future = <[AttributeError("'UnknownCommandException' object has no attribute 'error'") raised in repr()] Future object at 0x7f9d717434c0>

    @functools.wraps(params_fn)
    async def inner(self: Any, **kwargs: Any) -> Any:
        raw_result = kwargs.pop("raw_result", False)
        params = remove_undefined(params_fn(self, **kwargs))
    
        # Convert the classname and the method name to a bidi command name
        mod_name = owner.__name__[0].lower() + owner.__name__[1:]
        if hasattr(owner, "prefix"):
            mod_name = f"{owner.prefix}:{mod_name}"
        cmd_name = f"{mod_name}.{to_camelcase(name)}"
    
        future = await self.session.send_command(cmd_name, params)
>       result = await future
E       webdriver.bidi.error.UnknownCommandException: unknown command (Unknown command 'browsingContext.locateNodes'.)

cmd_name   = 'browsingContext.locateNodes'
future     = <[AttributeError("'UnknownCommandException' object has no attribute 'error'") raised in repr()] Future object at 0x7f9d717434c0>
kwargs     = {'context': '3189BF29B32044262999B05757BA3634',
 'locator': {'type': 'innerText', 'value': 'foo'},
 'start_nodes': [{'sharedId': 'D517C64297702194903532C82D463348_element_19',
                  'type': 'node',
                  'value': {'attributes': {'id': 'parent-one'},
                            'childNodeCount': 0,
                            'localName': 'p',
                            'namespaceURI': 'http://www.w3.org/1999/xhtml',
                            'nodeType': 1,
                            'shadowRoot': None}},
                 {'sharedId': 'D517C64297702194903532C82D463348_element_20',
                  'type': 'node',
                  'value': {'attributes': {},
                            'childNodeCount': 0,
                            'localName': 'p',
                            'namespaceURI': 'http://www.w3.org/1999/xhtml',
                            'nodeType': 1,
                            'shadowRoot': None}},
                 {'sharedId': 'D517C64297702194903532C82D463348_element_21',
                  'type': 'node',
                  'value': {'attributes': {'id': 'parent-two'},
                            'childNodeCount': 0,
                            'localName': 'p',
                            'namespaceURI': 'http://www.w3.org/1999/xhtml',
                            'nodeType': 1,
                            'shadowRoot': None}},
                 {'sharedId': 'D517C64297702194903532C82D463348_element_22',
                  'type': 'node',
                  'value': {'attributes': {},
                            'childNodeCount': 0,
                            'localName': 'p',
                            'namespaceURI': 'http://www.w3.org/1999/xhtml',
                            'nodeType': 1,
                            'shadowRoot': None}}]}
mod_name   = 'browsingContext'
name       = 'locate_nodes'
owner      = <class 'webdriver.bidi.modules.browsing_context.BrowsingContext'>
params     = {'context': '3189BF29B32044262999B05757BA3634',
 'locator': {'type': 'innerText', 'value': 'foo'},
 'startNodes': [{'sharedId': 'D517C64297702194903532C82D463348_element_19',
                 'type': 'node',
                 'value': {'attributes': {'id': 'parent-one'},
                           'childNodeCount': 0,
                           'localName': 'p',
                           'namespaceURI': 'http://www.w3.org/1999/xhtml',
                           'nodeType': 1,
                           'shadowRoot': None}},
                {'sharedId': 'D517C64297702194903532C82D463348_element_20',
                 'type': 'node',
                 'value': {'attributes': {},
                           'childNodeCount': 0,
                           'localName': 'p',
                           'namespaceURI': 'http://www.w3.org/1999/xhtml',
                           'nodeType': 1,
                           'shadowRoot': None}},
                {'sharedId': 'D517C64297702194903532C82D463348_element_21',
                 'type': 'node',
                 'value': {'attributes': {'id': 'parent-two'},
                           'childNodeCount': 0,
                           'localName': 'p',
                           'namespaceURI': 'http://www.w3.org/1999/xhtml',
                           'nodeType': 1,
                           'shadowRoot': None}},
                {'sharedId': 'D517C64297702194903532C82D463348_element_22',
                 'type': 'node',
                 'value': {'attributes': {},
                           'childNodeCount': 0,
                           'localName': 'p',
                           'namespaceURI': 'http://www.w3.org/1999/xhtml',
                           'nodeType': 1,
                           'shadowRoot': None}}]}
params_fn  = <function BrowsingContext.locate_nodes at 0x7f9d725c6820>
raw_result = False
result_fn  = <function BrowsingContext._locate_nodes at 0x7f9d725c68b0>
self       = <webdriver.bidi.modules.browsing_context.BrowsingContext object at 0x7f9d7245bca0>

tools/webdriver/webdriver/bidi/modules/_module.py:76: UnknownCommandException
 0:46.85 INFO Got 8 unexpected results, with 0 unexpected passes
 0:46.86 wptserve INFO Stopped WebTransport over HTTP/3 server on 127.0.0.1:11000
 0:46.87 wptserve INFO Close on: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 8888))
 0:46.87 wptserve INFO Stopped http server on 127.0.0.1:8444
 0:46.87 wptserve INFO Stopped http server on 127.0.0.1:8001
 0:46.89 wptserve INFO Stopped http server on 127.0.0.1:8000
 0:46.90 wptserve INFO Stopped http server on 127.0.0.1:8003
 0:46.90 wptserve INFO Stopped http server on 127.0.0.1:8002
 0:46.90 wptserve INFO Stopped http server on 127.0.0.1:8446
 0:46.90 wptserve INFO Stopped http server on 127.0.0.1:9000
 0:46.90 wptserve INFO Close on: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 8889))
 0:46.90 wptserve INFO Stopped http server on 127.0.0.1:8445
 0:47.20 wptserve INFO Stopped http server on 127.0.0.1:8443
 0:47.23 INFO Removed font: Ahem.ttf
 0:47.25 INFO Closing logging queue
 0:47.25 INFO queue closed
 0:47.25 INFO Tolerating 8 unexpected results
X connection to :99.0 broken (explicit kill or server shutdown).

[taskcluster 2023-11-28 11:09:01.031Z] === Task Finished ===
[taskcluster 2023-11-28 11:09:01.830Z] Successful task run with exit code: 0 completed in 176.634 seconds