(
device: DeviceInfo,
direction: ScrollDirection,
options?: { amount?: number; pixels?: number; durationMs?: number },
)
| 202 | } |
| 203 | |
| 204 | export async function scrollAndroid( |
| 205 | device: DeviceInfo, |
| 206 | direction: ScrollDirection, |
| 207 | options?: { amount?: number; pixels?: number; durationMs?: number }, |
| 208 | ): Promise<Record<string, unknown>> { |
| 209 | const size = await getAndroidScreenSize(device); |
| 210 | const plan = buildScrollGesturePlan({ |
| 211 | direction, |
| 212 | amount: options?.amount, |
| 213 | pixels: options?.pixels, |
| 214 | referenceWidth: size.width, |
| 215 | referenceHeight: size.height, |
| 216 | }); |
| 217 | const durationMs = options?.durationMs ?? 300; |
| 218 | |
| 219 | await runAndroidAdb(device, [ |
| 220 | 'shell', |
| 221 | 'input', |
| 222 | 'swipe', |
| 223 | String(plan.x1), |
| 224 | String(plan.y1), |
| 225 | String(plan.x2), |
| 226 | String(plan.y2), |
| 227 | String(durationMs), |
| 228 | ]); |
| 229 | |
| 230 | return { |
| 231 | ...plan, |
| 232 | ...(options?.durationMs !== undefined ? { durationMs: options.durationMs } : {}), |
| 233 | }; |
| 234 | } |
| 235 | |
| 236 | function resolveAndroidUserRotation(orientation: DeviceRotation): string { |
| 237 | switch (orientation) { |
no test coverage detected