web-platform-tests / wpt

Test suites for Web platform specs — including WHATWG, W3C, and others
https://web-platform-tests.org/
Other
4.88k stars 3.05k forks source link

WebDriver BiDi support in testdriver needs documentation #47565

Open rakuco opened 1 month ago

rakuco commented 1 month ago

Now that #45823 has been merged, it would be good to update the existing testdriver documentation. Having support for https://w3c.github.io/permissions/#webdriver-bidi-command-permissions-setPermission in testdriver would be great, but it is unclear how this is supposed to happen.

Specifically, at least https://web-platform-tests.org/writing-tests/testdriver.html and https://web-platform-tests.org/writing-tests/testdriver-extension-tutorial.html should be updated.

rakuco commented 1 month ago

cc @OrKoN @foolip

OrKoN commented 1 month ago

@rakuco extending testdriver.js with a WebDriver BiDi command does not require an RFC so you should be able to add the testdriver.js wrapper if you need to use the command.

sadym-chromium commented 1 month ago

@rakuco even though we will happily extend the documentation, I wonder what extension of the existing https://web-platform-tests.org/writing-tests/testdriver.html#permissions do you need?

rakuco commented 1 month ago

I wonder what extension of the existing https://web-platform-tests.org/writing-tests/testdriver.html#permissions do you need?

The support for specifying an origin, which only exists in the BiDi endpoint. Without this, it's not possible to set permissions in cross-origin iframes.

OrKoN commented 1 month ago

I think set_permission is a bit special since it exists in both specs. I would suggest to change the implementation in tools/wptrunner/wptrunner/testdriver-extra.js to use the webdriver-bidi endpoint. I guess the third argument can be changed to be a context (window) or an origin (string), and if the context is a window, we take the window.location.origin as the default origin.