( session: SessionState, button: SnapshotNode, )
| 268 | } |
| 269 | |
| 270 | async function tapAndroidDialogButton( |
| 271 | session: SessionState, |
| 272 | button: SnapshotNode, |
| 273 | ): Promise<AndroidDialogButtonTapResult> { |
| 274 | if (!button.rect) { |
| 275 | return { ok: false, exitCode: 1, stdout: '', stderr: 'button has no rect' }; |
| 276 | } |
| 277 | const { x, y } = centerOfRect(button.rect); |
| 278 | const result = await runAndroidAdb( |
| 279 | session.device, |
| 280 | ['shell', 'input', 'tap', String(Math.round(x)), String(Math.round(y))], |
| 281 | { allowFailure: true }, |
| 282 | ); |
| 283 | if (result.exitCode !== 0) { |
| 284 | return { |
| 285 | ok: false, |
| 286 | exitCode: result.exitCode, |
| 287 | stdout: result.stdout.trim(), |
| 288 | stderr: result.stderr.trim(), |
| 289 | }; |
| 290 | } |
| 291 | return { ok: true, x, y }; |
| 292 | } |
| 293 | |
| 294 | function findCloseAppButton( |
| 295 | nodes: SnapshotNode[], |
no test coverage detected
searching dependent graphs…