Re: [w3c/push-api] WPT testability (Issue #365)

ikram1201 left a comment (w3c/push-api#365)

I'd like to take the TPAC action to "propose and implement cross-browser push-message injection" ([minutes](https://www.w3.org/2026/11/TPAC2026-WebAppsWG-Day123.html#day-2-declarative-push-and-automated-tests)), which has no owner yet.

Two things since then. @eerii opened web-platform-tests/wpt#65094, which adds `test_driver.deliver_push_message(scope, data)` on top of new Chromium-only CDP commands, and Ms2ger noted it needs an RFC because no WebDriver endpoint backs it. And on wpt.fyi, `subscribe()` itself fails in every browser (Chrome "permission denied", Firefox "Error retrieving push subscription", Safari's permission stays at "prompt"), so `push-event.https.any.js` never gets to the push step.

A spec-defined command would give that work a standard target. A sketch, following @saschanaz's suggestion at TPAC to inject a payload into a normally created subscription:

**Deliver push message**, a WebDriver extension command in a new Automation section (like Generic Sensor or Compute Pressure):
- Parameters: `scope` (URL), `body` (base64, optional), `contentEncoding` (default `"aes128gcm"`).
- Run [Get Registration](https://w3c.github.io/ServiceWorker/#get-registration-algorithm) for the current top-level browsing context's storage key and `scope`. If it returns null, or the registration has no push subscription, return **invalid argument**.
- Otherwise run the [Receiving a Push Message](https://w3c.github.io/push-api/#receiving-a-push-message) steps for that subscription with this message, so decryption and the declarative push message parser are exercised. A body that fails to decrypt fires no event, which invalid-payload tests can check. Acknowledgement is a no-op.

Tests can build the encrypted body with `encrypt()` in `push-api/resources/helpers.js`. Leo Tenenbaum's `pushMessage()` helper from October already wraps it, so pointing tests at the command would be a small change.

Questions before I write spec text:
1. WebDriver Classic, BiDi, or both? Or a TestUtils method instead? (@saschanaz, you leaned that way for notifications in w3c/webdriver-bidi#1199.)
2. How should `subscribe()` succeed under automation? I'd suggest a UA-local subscription whose endpoint is never contacted.
3. Should `pushsubscriptionchange` (also in wpt#65094) go in the same PR?

I'm happy to do the spec PR, the testdriver and wptrunner wiring (with @eerii, building on #65094), and the test ports. @marcoscaceres, could this get Agenda+ for Monday's call?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/365#issuecomment-7082871120
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/push-api/issues/365/7082871120@github.com>

Received on Sunday, 22 November 2026 17:29:44 UTC