injecting-touch-gestures

Simulate synthetic touch events in Jetpack Compose UI tests using TouchInjectionScope DSL.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/trancee/MeshLink-template --skill injecting-touch-gestures-trancee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: injecting-touch-gestures
Source: https://github.com/trancee/MeshLink-template/tree/main/.agents/skills/android-testing-skills/compose/actions/injecting-touch-gestures
Command: npx skills add https://github.com/trancee/MeshLink-template --skill injecting-touch-gestures-trancee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill eliminates flaky UI tests caused by hardcoded screen coordinates and deprecated gesture APIs, ensuring your Compose interactions are robust, device-agnostic, and deterministic.

Core Features & Use Cases

  • Node-Local Precision: Uses the TouchInjectionScope DSL to perform actions relative to a component's own coordinates rather than absolute screen pixels.
  • Advanced Gesture Support: Provides native support for complex interactions like multi-touch swipes, pinch-to-zoom, and velocity-controlled flings.
  • Use Case: When testing a custom draggable component, use this skill to simulate a swipe with specific velocity to verify that the component's fling animation behaves correctly across different screen sizes.

Quick Start

Use the injecting-touch-gestures skill to perform a swipe gesture on the node tagged with my-button-tag from its center to the right edge.

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 multi-touch gestures like pinch-to-zoom in Jetpack Compose UI tests?

You can simulate multi-touch gestures in Jetpack Compose UI tests using the TouchInjectionScope DSL, which provides native support for pinch-to-zoom, multi-touch swipes, and velocity-controlled flings.

Why are my Compose UI tests flaky when performing swipe gestures across different screen sizes?

Compose UI tests become flaky when using hardcoded absolute screen pixels. Using a node-local coordinate system with the TouchInjectionScope DSL ensures gestures are relative to the component, making tests device-agnostic and deterministic.

Can I test velocity-based fling animations in Jetpack Compose?

Yes, you can test velocity-based fling animations in Jetpack Compose by simulating synthetic touch events with specific velocities through the TouchInjectionScope DSL to verify your component's fling behavior.

Do I need androidx.compose.ui:ui-test-junit4 to perform precise touch event simulations?

Yes, performing precise touch event simulations with this approach requires the androidx.compose.ui:ui-test-junit4 dependency to access the TouchInjectionScope DSL and execute synthetic interactions.

What is the best way to perform coordinate-based drags in Compose UI testing without deprecated APIs?

The best way to perform coordinate-based drags in Compose UI testing is using the TouchInjectionScope DSL, which replaces deprecated gesture APIs and targets precise node-local coordinates for stable cross-device interactions.