1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Raw touch dispatch — backs [`crate::Tab::tap`] / [`crate::Element::tap`].
//!
//! A tap is a bare `Input.dispatchTouchEvent` `touchStart` → `touchEnd`
//! pair, with no `Emulation.setTouchEmulationEnabled` preamble. That CDP
//! call flips touch-*capability* signals (`ontouchstart` in `window`,
//! `navigator.maxTouchPoints`, `matchMedia('(pointer: coarse)')`) — a
//! separate mobile-emulation concern (Phase 7), not something a tap needs.
//! The bare dispatch already fires the page's `touchstart` / `touchend`
//! handlers (and, on a clickable element, the browser's own synthesized
//! `click`), which is the whole point of a tap.
use json;
use crateResult;
use crateTab;
/// Dispatch a tap at `(x, y)` in viewport coordinates: `touchStart` with a
/// single touch point, then `touchEnd` with an empty `touchPoints` array —
/// the CDP contract for a lifted finger.
pub async
// `tap_at` is exercised via its callers' MockConnection tests — see
// `Tab::tap`'s `tap_dispatches_touchstart_with_point_then_touchend_empty`
// (`crate::tab::tests`) and `Element::tap`'s equivalent in
// `crate::element::actions::tests` — same pattern `mouse.rs` uses for
// `click_at`/`move_realistic` (dispatch fns need a live `Tab` +
// `MockConnection`, so the assertion lives at the call site).