injecting-touch-gestures

Inject synthetic touch gestures into Jetpack Compose UI tests via performTouchInput.

303|10|Updated May 15, 2026
One-click install
npx skills add https://github.com/skydoves/android-testing-skills --skill injecting-touch-gestures
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: injecting-touch-gestures
Source: https://github.com/skydoves/android-testing-skills/tree/main/compose/actions/injecting-touch-gestures
Command: npx skills add https://github.com/skydoves/android-testing-skills --skill injecting-touch-gestures

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of unreliable or deprecated touch simulation in Jetpack Compose UI tests, helping you drive realistic gestures without relying on flaky screen coordinates.

Core Features & Use Cases

  • Synthetic touch via performTouchInput: Use the TouchInjectionScope DSL as the supported entry point for node-targeted touch injection.
  • Node-local, device-proof coordinates: Target gestures using geometry helpers like center, topLeft, bottomRight, and percentOffset to keep tests stable across screen sizes and layouts.
  • Advanced gesture coverage: Inject clicks, long-press, double-click, swipes, velocity-controlled flings, pinch-to-zoom, and multi-touch swipes, plus low-level primitives (down, moveTo, moveBy, move, up, cancel) for partial gestures and mid-gesture assertions.

Quick Start

Use injecting-touch-gestures to simulate a swipe or pinch inside a Compose test by calling performTouchInput on the target node selected by testTag.

Frequently Asked Questions about injecting-touch-gestures

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I simulate swipe and pinch-to-zoom gestures in Jetpack Compose UI tests?

Use the performTouchInput block with the TouchInjectionScope DSL to inject synthetic touch input directly onto a target node for Jetpack Compose UI tests. This enables velocity-controlled flings, multi-touch swipes, and pinch-to-zoom without relying on flaky screen coordinates.

What is the best way to replace deprecated performGesture usage in Android Compose testing?

The best way to replace deprecated performGesture usage in Android Compose testing is to use the performTouchInput API. It provides a TouchInjectionScope DSL for node-local synthetic touch input, ensuring reliable gesture simulation across various screen sizes.

How do I keep Compose UI test gestures stable across different device screen sizes?

To keep Compose UI test gestures stable across different device screen sizes, use coordinate geometry helpers like center, topLeft, bottomRight, and percentOffset within the TouchInjectionScope. This ensures device-proof targeting for synthetic touch input.

Can I split a partial touch gesture across multiple performTouchInput blocks in Compose tests?

Yes, you can split partial touch gestures across multiple performTouchInput blocks in Compose tests. Using low-level primitives like down, moveTo, moveBy, up, and cancel allows you to pause mid-gesture for assertions before continuing the touch injection.

Why are my Jetpack Compose touch injection assertions flaky during velocity-controlled flings?

Jetpack Compose touch injection assertions are flaky during velocity-controlled flings due to incorrect batching or clock handling. Ensure you use the TouchInjectionScope DSL within performTouchInput correctly to manage gesture timing and avoid flaky test results.