Skip to content
All articles

Insights~6 min read

Why Appium Long-Press and Pinch Tests Keep Failing

Appium long press and pinch gestures keep failing on different devices? See why scripted gestures turn flaky and what a sight-based alternative looks like.

TL;DR

Scripted gesture tests fail across devices because they encode fixed coordinates, timings and element lookups that shift with screen size, density and OS version. TaloTrace, a QA testing platform for web, iOS and Android apps, takes a sight-based approach: it looks at the screen and performs long-press and pinch itself, so there are no scripted coordinates or element IDs to maintain.

Key takeaways

  • Root cause: Scripted gestures bake in coordinates, durations and element lookups, and each of those varies by device.

  • Why it spreads: Maintenance can grow with the number of screen sizes and OS versions you cover, not only with the number of tests.

  • Common fixes: Relative coordinates, waits and per-device branches reduce flakiness but add code to maintain.

  • Different approach: TaloTrace navigates by looking at the screen, and its interaction range covers long-press and pinch.

  • Honest limits: TaloTrace runs on a browser, an Android emulator and an iOS Simulator, not physical devices.

What Does a Flaky Gesture Test Look Like in Practice?

On Monday the long-press that opens a context menu passes on your reference phone. On Tuesday it fails on a smaller screen, and the menu never appears. On Wednesday someone re-runs it and it passes, so nobody touches it.

By Friday the suite has a quiet category of tests that people re-run before they believe a red result. The pinch-to-zoom test on the photo viewer is in it. So is the drag handle on the reorder list. Each one has a history of being red for reasons that turned out not to be bugs.

This is the expensive part. A flaky gesture test costs the failure, then the investigation, then the re-run, then the erosion of trust in every other red result. Your team starts to read failures as noise, and a real regression can hide inside that noise.

If this sounds familiar, the pattern is common with scripted gesture tests in general: they depend on device-specific values such as coordinates and timing.

Why Do Long-Press and Pinch Gestures Break Across Devices?

A tap is forgiving. If the target is roughly where you expect, the tap lands. A long-press and a pinch are not forgiving, because each is defined by more than a position. Reasoning from how these gestures work, several things can vary underneath a script that looks identical on every device.

  • Coordinates: A script that targets fixed screen points assumes a layout. A different screen size, pixel density or aspect ratio moves the element, and the gesture lands beside it.
  • Timing: A long-press depends on a hold duration. If the app or the operating system recognises a long-press at a slightly different threshold, or the device is slower to respond, a hold that works on one device releases too early or too late on another.
  • Two-point geometry: A pinch needs two start points, a direction and a distance. Values that suit a large screen can overshoot or start outside the zoomable area on a small one.
  • Element lookups: Scripts often find the target through an identifier or a hierarchy path. If a layout changes between device classes or releases, the lookup can resolve to something else or to nothing.
  • OS gesture handling: Platform versions may handle touch sequences and system gestures differently.

None of these is exotic. Together they mean one gesture script carries a hidden assumption about the device it was written on, and the assumption fails quietly when the device changes.

Why Does the Maintenance Burden Keep Growing?

Script maintenance can grow with the number of screen sizes and OS versions you cover, not only with test count. Every new screen size, OS version and layout variant is a new place where the hard-coded values might be wrong. Ten gesture tests across two devices is manageable. The same ten across a wider spread of configurations multiplies the places they can drift.

There is also a diagnostic cost. When a pinch test fails, you have to work out whether the app is broken, the script is wrong for this device, or the timing was unlucky. That triage takes an engineer, and it takes the same engineer again next time.

The result can be that the people best placed to find real mobile bugs spend their time keeping gesture scripts alive. That is a maintenance problem wearing the costume of a testing problem.

What Do Teams Usually Try, and Where Does It Run Out?

Common fixes include the following. Each helps, and each has a limit.

  • Relative coordinates: Computing positions from the element or screen size instead of hard-coding them removes one class of failure. It still depends on the element lookup resolving correctly, and the gesture logic still needs per-gesture tuning.
  • Explicit waits and retries: These absorb timing variation. They also slow the suite and can hide a genuine intermittent bug behind a green retry.
  • Per-device branches: A conditional for small screens, another for tablets. This works until the number of branches is itself the thing nobody wants to touch.
  • Wrapper helpers: A shared long-press or pinch helper centralises the tuning. It is a good move, but it is still code you own, and it still encodes assumptions about the devices you had in mind when you wrote it.
  • Doing nothing: Marking the flaky gesture tests as quarantined, or testing those gestures by hand before release. This keeps the suite green, but it quietly removes coverage of the interactions that are hardest to get right.

All of these treat the gesture as something you must describe precisely in code. The approach runs out because precision for one device is the cause of failure on the next.

What Does a Sight-Based Alternative Look Like?

The different approach is to stop describing the gesture in device-specific terms and let the tester look at the screen. TaloTrace navigates by looking at the screen, not by brittle element IDs, so it keeps working when the UI changes. There are no test scripts to write or maintain.

Its interaction range covers taps, typing, scrolling, swiping, long-press, double-tap, drag and pinch. That means the gestures that cause the most scripted flakiness are part of what TaloTrace does directly, rather than something you assemble from coordinates and durations.

You point TaloTrace at your app and, optionally, describe the flow you care about most in plain language. It explores the running app, plans the user journeys worth testing, drives each one to a verifiable outcome, and turns the journeys it completes into replayable scenarios. You can also author scenarios from a chat description or write them by hand. For a closer look at the mechanics, see how TaloTrace works.

How Does TaloTrace Know a Gesture Actually Worked?

A gesture that was sent is not a gesture that did its job. A long-press can be delivered and the menu still not open. TaloTrace deals with this by requiring proof of the outcome rather than assuming it.

A goal is marked done only when a machine-checkable predicate proves the outcome. The predicate must be false before the action and true after. A scan that produces no independently proven goal fails, rather than reporting an unverified journey as a pass.

When something does look wrong, TaloTrace independently verifies each finding before it reaches you. A screen recording is captured for every run, and each finding carries the time window inside that recording where the defect shows. A vision model also analyses the recording for visual and functional anomalies on screen, not only hard failures. So if a pinch misbehaves on one device, you can watch it instead of reconstructing it from a stack trace.

What Are the Limits You Should Know About?

It is worth being plain about what this does and does not cover. TaloTrace runs on three cloud-hosted, virtual execution planes: a browser for web apps, an Android emulator for Android apps and an Apple iOS Simulator for iOS apps. The plane is chosen automatically from the app's platform. Physical devices are not offered on any platform.

If your gesture failures only reproduce on specific physical hardware, that is outside what TaloTrace tests today. A sight-based approach does not depend on scripted coordinates or element lookups, so there is nothing device-specific to tune in a script.

It also does not mean maintenance vanishes or that nothing can ever fail. It means the gesture is no longer something you encode per device. If you are testing Android in particular, the post on AI QA testing for Android apps goes deeper, and the overview of an autonomous mobile app testing tool covers the wider picture.

How Do You Try It on Your Own App?

The quickest check is to take the gesture tests you currently quarantine or re-run, and see how TaloTrace handles those same flows. Point it at the app, describe the flow in plain language, and review the recording and findings it returns.

Beta is open, and access is granted after you apply or ask for a demo. Tell us which gestures cause you the most trouble.

Get early access or book a demo

Frequently asked questions

Why does a long-press pass on one device and fail on another?

A scripted long-press usually combines a target (an element or a coordinate) with a hold duration. Screen size, density, layout and how quickly the app responds can all differ between devices, so the same script can land on the wrong spot or release before the app registers the hold.

Why are pinch gestures harder to script than taps?

A pinch involves two moving points whose start positions, distance and speed all have to make sense for the screen in front of them. Fixed values written for one screen size can be too large, too small or off-centre on another.

Does TaloTrace support long-press and pinch?

Yes. TaloTrace's interaction range covers taps, typing, scrolling, swiping, long-press, double-tap, drag and pinch. It navigates by looking at the screen rather than relying on element IDs.

Does TaloTrace test on physical devices?

No. TaloTrace runs on cloud-hosted virtual planes: a browser for web apps, an Android emulator for Android apps and an Apple iOS Simulator for iOS apps. Physical devices are not offered on any platform.

Does a sight-based approach mean tests cannot fail?

No. It removes dependence on brittle element IDs, so tests keep working when the UI changes, but it does not mean nothing can ever go wrong. Each run records the screen and carries verdicts and evidence, so you can see what happened when something does.

You build. TaloTrace tests.

Public testing is coming soon. You can request early access in the meantime.

Book a demo
Request early access