MCPcopy
hub / github.com/callstack/agent-device / buildPressSequenceSteps

Function buildPressSequenceSteps

src/core/dispatch-interactions.ts:418–441  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  x: number,
  y: number,
  series: PressSeriesOptions,
)

Source from the content-addressed store, hash-verified

416}
417
418function buildPressSequenceSteps(
419 device: DeviceInfo,
420 x: number,
421 y: number,
422 series: PressSeriesOptions,
423): RunnerSequenceStep[] {
424 const kind = series.doubleTap ? 'doubleTap' : series.holdMs > 0 ? 'longPress' : 'tap';
425 // Mirror the individual `tap` command: on touch-input iOS (not the tvOS leaf), tap steps
426 // use synthesized HID taps (synthesizedTapAt) rather than the drag-based XCUICoordinate
427 // tapAt, matching iosTapCommand.
428 const synthesized = kind === 'tap' && isIosFamily(device) && !isTvOsDevice(device);
429 return Array.from({ length: series.count }, (_, index) => {
430 const [dx, dy] = computeDeterministicJitter(index, series.jitterPx);
431 const isLast = index === series.count - 1;
432 return {
433 kind,
434 x: x + dx,
435 y: y + dy,
436 ...(synthesized ? { synthesized: true } : {}),
437 ...(series.holdMs > 0 ? { durationMs: series.holdMs } : {}),
438 ...(!isLast && series.intervalMs > 0 ? { pauseMs: series.intervalMs } : {}),
439 };
440 });
441}
442
443// Unrolls a swipe series into `sequence` drag steps, replacing the retired `dragSeries` runner
444// command. Ping-pong becomes per-step endpoint swapping (odd indices reversed), matching the

Callers 1

runIosPressSequenceFunction · 0.85

Calls 3

isIosFamilyFunction · 0.90
isTvOsDeviceFunction · 0.90

Tested by

no test coverage detected