(
state: AppState,
udid: String,
payload: AccessibilityQueryPayload,
)
| 178 | } |
| 179 | |
| 180 | async fn query_element_payload( |
| 181 | state: AppState, |
| 182 | udid: String, |
| 183 | payload: AccessibilityQueryPayload, |
| 184 | ) -> Result<Value, AppError> { |
| 185 | let snapshot = cached_accessibility_tree_value( |
| 186 | state, |
| 187 | udid, |
| 188 | payload.source.as_deref(), |
| 189 | payload.max_depth, |
| 190 | payload.include_hidden.unwrap_or(false), |
| 191 | false, |
| 192 | ) |
| 193 | .await?; |
| 194 | let matches = query_compact_elements( |
| 195 | &snapshot, |
| 196 | &payload.selector, |
| 197 | payload.limit.unwrap_or(64).clamp(1, 512), |
| 198 | ); |
| 199 | Ok(json_value!({ |
| 200 | "action": "query", |
| 201 | "ok": true, |
| 202 | "source": snapshot.get("source").cloned().unwrap_or(Value::Null), |
| 203 | "count": matches.len(), |
| 204 | "matches": matches, |
| 205 | })) |
| 206 | } |
| 207 | |
| 208 | async fn wait_for_absent_element_payload( |
| 209 | state: AppState, |
no test coverage detected