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-firefox-nightly-results succeeded Nov 28, 2023 in 7m 31s

Community-TC (pull_request)

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

Details

View task in Taskcluster
View logs in Taskcluster

WPT Command: python3 ./wpt run --channel=nightly --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 --binary=/home/test/build/firefox/firefox firefox


params_fn  = <function BrowsingContext.locate_nodes at 0x7fdca7a24ee0>
raw_result = False
result_fn  = <function BrowsingContext._locate_nodes at 0x7fdca7a24f70>
self       = <webdriver.bidi.modules.browsing_context.BrowsingContext object at 0x7fdca6da27f0>

tools/webdriver/webdriver/bidi/modules/_module.py:76: UnknownCommandException
  FAIL test_locate_with_multiple_context_nodes[innerText-foo] - webdriver.bidi.error.UnknownCommandException: unknown command (browsingContext.locateNodes)
bidi_session = <webdriver.bidi.client.BidiSession object at 0x7fdca6da2850>
inline = <function inline.<locals>.inline at 0x7fdca6ba7f70>
top_context = {'children': [], 'context': '44552a23-e298-44c6-9f6f-ce9f53a2ed74', 'parent': None, 'url': 'https://web-platform.test:...%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 0x7fdca6da2850>
context_nodes = [{'sharedId': '46e4b461-7bd7-44e4-9129-021e1567cf23',
  'type': 'node',
  'value': {'attributes': {'id': 'parent-one'},
            'childNodeCount': 0,
            'localName': 'p',
            'namespaceURI': 'http://www.w3.org/1999/xhtml',
            'nodeType': 1,
            'shadowRoot': None}},
 {'sharedId': '26b3da5e-fe01-457c-9977-5f12cadd60ce',
  'type': 'node',
  'value': {'attributes': {},
            'childNodeCount': 0,
            'localName': 'p',
            'namespaceURI': 'http://www.w3.org/1999/xhtml',
            'nodeType': 1,
            'shadowRoot': None}},
 {'sharedId': 'f3d90769-a007-4b4c-9e06-ac621fe4a3cc',
  'type': 'node',
  'value': {'attributes': {'id': 'parent-two'},
            'childNodeCount': 0,
            'localName': 'p',
            'namespaceURI': 'http://www.w3.org/1999/xhtml',
            'nodeType': 1,
            'shadowRoot': None}},
 {'sharedId': 'deb130a8-5c92-4c56-984d-ae3ec5bf9073',
  '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 0x7fdca6ba7f70>
script_result = {'type': 'nodelist',
 'value': [{'sharedId': '46e4b461-7bd7-44e4-9129-021e1567cf23',
            'type': 'node',
            'value': {'attributes': {'id': 'parent-one'},
                      'childNodeCount': 0,
                      'localName': 'p',
                      'namespaceURI': 'http://www.w3.org/1999/xhtml',
                      'nodeType': 1,
                      'shadowRoot': None}},
           {'sharedId': '26b3da5e-fe01-457c-9977-5f12cadd60ce',
            'type': 'node',
            'value': {'attributes': {},
                      'childNodeCount': 0,
                      'localName': 'p',
                      'namespaceURI': 'http://www.w3.org/1999/xhtml',
                      'nodeType': 1,
                      'shadowRoot': None}},
           {'sharedId': 'f3d90769-a007-4b4c-9e06-ac621fe4a3cc',
            'type': 'node',
            'value': {'attributes': {'id': 'parent-two'},
                      'childNodeCount': 0,
                      'localName': 'p',
                      'namespaceURI': 'http://www.w3.org/1999/xhtml',
                      'nodeType': 1,
                      'shadowRoot': None}},
           {'sharedId': 'deb130a8-5c92-4c56-984d-ae3ec5bf9073',
            'type': 'node',
            'value': {'attributes': {},
                      'childNodeCount': 0,
                      'localName': 'p',
                      'namespaceURI': 'http://www.w3.org/1999/xhtml',
                      'nodeType': 1,
                      'shadowRoot': None}}]}
top_context = {'children': [],
 'context': '44552a23-e298-44c6-9f6f-ce9f53a2ed74',
 '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 0x7fdca6da27f0>
kwargs = {'context': '44552a23-e298-44c6-9f6f-ce9f53a2ed74', 'locator': {'type': 'innerText', 'value': 'foo'}, 'start_nodes': [...lue': {'attributes': {}, 'childNodeCount': 0, 'localName': 'p', 'namespaceURI': 'http://www.w3.org/1999/xhtml', ...}}]}
raw_result = False
params = {'context': '44552a23-e298-44c6-9f6f-ce9f53a2ed74', 'locator': {'type': 'innerText', 'value': 'foo'}, 'startNodes': [{...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 0x7fdca6afe240>

    @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 (browsingContext.locateNodes)
E       
E       Remote-end stacktrace:
E       
E       RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
E       WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:190:5
E       UnknownCommandError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:768:5
E       execute@chrome://remote/content/shared/webdriver/Session.sys.mjs:271:13
E       onPacket@chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs:211:37
E       onMessage@chrome://remote/content/server/WebSocketTransport.sys.mjs:127:18
E       handleEvent@chrome://remote/content/server/WebSocketTransport.sys.mjs:109:14

cmd_name   = 'browsingContext.locateNodes'
future     = <[AttributeError("'UnknownCommandException' object has no attribute 'error'") raised in repr()] Future object at 0x7fdca6afe240>
kwargs     = {'context': '44552a23-e298-44c6-9f6f-ce9f53a2ed74',
 'locator': {'type': 'innerText', 'value': 'foo'},
 'start_nodes': [{'sharedId': '46e4b461-7bd7-44e4-9129-021e1567cf23',
                  'type': 'node',
                  'value': {'attributes': {'id': 'parent-one'},
                            'childNodeCount': 0,
                            'localName': 'p',
                            'namespaceURI': 'http://www.w3.org/1999/xhtml',
                            'nodeType': 1,
                            'shadowRoot': None}},
                 {'sharedId': '26b3da5e-fe01-457c-9977-5f12cadd60ce',
                  'type': 'node',
                  'value': {'attributes': {},
                            'childNodeCount': 0,
                            'localName': 'p',
                            'namespaceURI': 'http://www.w3.org/1999/xhtml',
                            'nodeType': 1,
                            'shadowRoot': None}},
                 {'sharedId': 'f3d90769-a007-4b4c-9e06-ac621fe4a3cc',
                  'type': 'node',
                  'value': {'attributes': {'id': 'parent-two'},
                            'childNodeCount': 0,
                            'localName': 'p',
                            'namespaceURI': 'http://www.w3.org/1999/xhtml',
                            'nodeType': 1,
                            'shadowRoot': None}},
                 {'sharedId': 'deb130a8-5c92-4c56-984d-ae3ec5bf9073',
                  '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': '44552a23-e298-44c6-9f6f-ce9f53a2ed74',
 'locator': {'type': 'innerText', 'value': 'foo'},
 'startNodes': [{'sharedId': '46e4b461-7bd7-44e4-9129-021e1567cf23',
                 'type': 'node',
                 'value': {'attributes': {'id': 'parent-one'},
                           'childNodeCount': 0,
                           'localName': 'p',
                           'namespaceURI': 'http://www.w3.org/1999/xhtml',
                           'nodeType': 1,
                           'shadowRoot': None}},
                {'sharedId': '26b3da5e-fe01-457c-9977-5f12cadd60ce',
                 'type': 'node',
                 'value': {'attributes': {},
                           'childNodeCount': 0,
                           'localName': 'p',
                           'namespaceURI': 'http://www.w3.org/1999/xhtml',
                           'nodeType': 1,
                           'shadowRoot': None}},
                {'sharedId': 'f3d90769-a007-4b4c-9e06-ac621fe4a3cc',
                 'type': 'node',
                 'value': {'attributes': {'id': 'parent-two'},
                           'childNodeCount': 0,
                           'localName': 'p',
                           'namespaceURI': 'http://www.w3.org/1999/xhtml',
                           'nodeType': 1,
                           'shadowRoot': None}},
                {'sharedId': 'deb130a8-5c92-4c56-984d-ae3ec5bf9073',
                 '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 0x7fdca7a24ee0>
raw_result = False
result_fn  = <function BrowsingContext._locate_nodes at 0x7fdca7a24f70>
self       = <webdriver.bidi.modules.browsing_context.BrowsingContext object at 0x7fdca6da27f0>

tools/webdriver/webdriver/bidi/modules/_module.py:76: UnknownCommandException
 2:15.50 INFO Got 8 unexpected results, with 0 unexpected passes
 2:15.51 wptserve INFO Stopped WebTransport over HTTP/3 server on 127.0.0.1:11000
 2:15.65 wptserve INFO Stopped http server on 127.0.0.1:8003
 2:15.65 wptserve INFO Close on: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 8889))
 2:15.66 wptserve INFO Stopped http server on 127.0.0.1:8000
 2:15.67 wptserve INFO Stopped http server on 127.0.0.1:8001
 2:15.68 wptserve INFO Stopped http server on 127.0.0.1:8446
 2:15.68 wptserve INFO Stopped http server on 127.0.0.1:8002
 2:15.68 wptserve INFO Stopped http server on 127.0.0.1:8444
 2:15.68 wptserve INFO Stopped http server on 127.0.0.1:8445
 2:15.68 wptserve INFO Stopped http server on 127.0.0.1:9000
 2:15.68 wptserve INFO Close on: (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 8888))
 2:15.73 wptserve INFO Stopped http server on 127.0.0.1:8443
 2:15.79 INFO Removed font: Ahem.ttf
 2:15.82 INFO Closing logging queue
 2:15.82 INFO queue closed
 2:15.82 INFO Tolerating 8 unexpected results
[taskcluster 2023-11-28 11:12:44.878Z] === Task Finished ===
[taskcluster 2023-11-28 11:12:45.548Z] Successful task run with exit code: 0 completed in 240.607 seconds