diff --git a/docs/writing-tests/testdriver-extension-tutorial.md b/docs/writing-tests/testdriver-extension-tutorial.md index ca867c392da70e..6a1da4e0077de1 100644 --- a/docs/writing-tests/testdriver-extension-tutorial.md +++ b/docs/writing-tests/testdriver-extension-tutorial.md @@ -90,8 +90,16 @@ We will leave this unimplemented and override it in another file. Lets do that n #### WebDriver BiDi -For commands using WebDriver BiDi, add the methods to `window.test_driver.bidi`. Parameters are passed as a single object `params`. - +For commands using WebDriver BiDi, add the methods to `test_driver.bidi`. Parameters are passed as a single object `params`. For example [`test_driver.bidi.permissions.set_permission`](https://github.com/web-platform-tests/wpt/blob/5ec8ba6d68f27d49a056cbf940e3bc9a8324c538/resources/testdriver.js#L183). + +Before calling `test_driver_internal` method, assert the `bidi` testdriver feature is enabled. +```javascript +set_permission: function (params) { + assertBidiIsEnabled(); + return window.test_driver_internal.bidi.permissions.set_permission( + params); +} +``` ### [tools/wptrunner/wptrunner/testdriver-extra.js](https://github.com/web-platform-tests/wpt/blob/master/tools/wptrunner/wptrunner/testdriver-extra.js) diff --git a/docs/writing-tests/testdriver.md b/docs/writing-tests/testdriver.md index 462c7b85503cb9..42a862fbe1e139 100644 --- a/docs/writing-tests/testdriver.md +++ b/docs/writing-tests/testdriver.md @@ -32,6 +32,20 @@ document when using testdriver from a different context): The api in `test_driver.bidi` provides access to the [WebDriver BiDi](https://w3c.github.io/webdriver-bidi) protocol. +### Markup ### + +To use WebDriver BiDi, enable the `bidi` feature in `testdriver.js` by adding +`feature=bidi` query string parameter. Details are in [RFC 214: Add testdriver features](https://github.com/web-platform-tests/rfcs/blob/master/rfcs/testdriver-features.md). +```html + +``` + +```javascript +// META: script=/resources/testdriver.js?feature=bidi +``` + +[Example](https://github.com/web-platform-tests/wpt/blob/aae46926b1fdccd460e1c6eaaf01ca20b941fbce/infrastructure/webdriver/bidi/subscription.html#L6). + ### Context ### A WebDriver BiDi "browsing context" is equivalent to an diff --git a/infrastructure/metadata/infrastructure/testdriver/bidi/bluetooth/simulate_adapter.https.html.ini b/infrastructure/metadata/infrastructure/testdriver/bidi/bluetooth/simulate_adapter.https.html.ini index 7c3127d167a740..a40a56bcdb9bd8 100644 --- a/infrastructure/metadata/infrastructure/testdriver/bidi/bluetooth/simulate_adapter.https.html.ini +++ b/infrastructure/metadata/infrastructure/testdriver/bidi/bluetooth/simulate_adapter.https.html.ini @@ -1 +1,2 @@ -disabled: https://github.com/web-platform-tests/wpt/issues/47544 +disabled : + if product != "chrome": @True diff --git a/infrastructure/metadata/infrastructure/testdriver/bidi/permissions/set_permission.https.html.ini b/infrastructure/metadata/infrastructure/testdriver/bidi/permissions/set_permission.https.html.ini index 7c3127d167a740..1a5ac47c67d942 100644 --- a/infrastructure/metadata/infrastructure/testdriver/bidi/permissions/set_permission.https.html.ini +++ b/infrastructure/metadata/infrastructure/testdriver/bidi/permissions/set_permission.https.html.ini @@ -1 +1,2 @@ -disabled: https://github.com/web-platform-tests/wpt/issues/47544 +disabled: + if product != "chrome": @True diff --git a/infrastructure/metadata/infrastructure/webdriver/bidi/subscription.html.ini b/infrastructure/metadata/infrastructure/webdriver/bidi/subscription.html.ini index 7c3127d167a740..1a5ac47c67d942 100644 --- a/infrastructure/metadata/infrastructure/webdriver/bidi/subscription.html.ini +++ b/infrastructure/metadata/infrastructure/webdriver/bidi/subscription.html.ini @@ -1 +1,2 @@ -disabled: https://github.com/web-platform-tests/wpt/issues/47544 +disabled: + if product != "chrome": @True diff --git a/infrastructure/metadata/infrastructure/webdriver/bidi/subscription.window.js.ini b/infrastructure/metadata/infrastructure/webdriver/bidi/subscription.window.js.ini new file mode 100644 index 00000000000000..1a5ac47c67d942 --- /dev/null +++ b/infrastructure/metadata/infrastructure/webdriver/bidi/subscription.window.js.ini @@ -0,0 +1,2 @@ +disabled: + if product != "chrome": @True diff --git a/infrastructure/testdriver/bidi/bluetooth/simulate_adapter.https.html b/infrastructure/testdriver/bidi/bluetooth/simulate_adapter.https.html index 3850fa26974a32..ed60285c41fabe 100644 --- a/infrastructure/testdriver/bidi/bluetooth/simulate_adapter.https.html +++ b/infrastructure/testdriver/bidi/bluetooth/simulate_adapter.https.html @@ -3,7 +3,7 @@ TestDriver bidi.bluetooth.simulate_adapter method - + - + - + + + """.encode("utf-8") + + s = create("html/test.html", contents=contents) + s.testdriver_features == None + + +@pytest.mark.parametrize("features", + [[], ['feature_1'], ['feature_1', 'feature_2']]) +def test_html_testdriver_features(features): + contents = f""" +