playwright.WireTap
playwright.WireTap(page)Passive tap on the Shiny websocket, with retrying expectations.
Construct it before page.goto() — history is complete from construction onward::
tap = WireTap(page)
page.goto(app.url)
tap.expect_input_value("bins", 30)
tap.expect_output_value("dist_data", lambda d: d["breaks"][0] == 43.0)
Cross-channel frame order (which output lands first, how outputs batch into a single values frame, busy/progress interleaving) is reactive-scheduling coincidence, not contract — so the tap deliberately does not expose a global frame stream. Within one channel (one output id, one message type, one input id) wire order is guaranteed, and the expect_* methods consume it through a cursor: each expectation scans the recorded history from just past the previous match, so values that arrive between checks are never missed — capture is lossless; polling only decides when to re-scan. Successive expectations on one channel therefore assert an ordered subsequence.
Methods
| Name | Description |
|---|---|
| all_input_values | Every value the client sent for input_id, in order. |
| all_messages | Every send_message() payload of message_id, in order. |
| all_output_values | Every value the server delivered for output_id, in order. |
| expect_input_value | As :meth:expect_output_value, for client-sent input values. |
| expect_message | As :meth:expect_output_value, for send_message() payloads. |
| expect_output_value | Retrying expectation against the values delivered for output_id. |
all_input_values
playwright.WireTap.all_input_values(input_id)Every value the client sent for input_id, in order.
Matches the bare id or any id:type wire id (e.g. the implicit :shinyreact.default suffix), so use the id you wrote in useShinyInput().
all_messages
playwright.WireTap.all_messages(message_id)Every send_message() payload of message_id, in order.
all_output_values
playwright.WireTap.all_output_values(output_id)Every value the server delivered for output_id, in order.
expect_input_value
playwright.WireTap.expect_input_value(input_id, matcher, timeout_s=10)As :meth:expect_output_value, for client-sent input values.
expect_message
playwright.WireTap.expect_message(message_id, matcher, timeout_s=10)As :meth:expect_output_value, for send_message() payloads.
expect_output_value
playwright.WireTap.expect_output_value(output_id, matcher, timeout_s=10)Retrying expectation against the values delivered for output_id.
A callable matcher is satisfied by a truthy return; any other object is compared for equality. Returns the matched value, or raises AssertionError at timeout_s. A matcher that raises on a value’s shape counts as a non-match.