Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pinch and zoom (gestures) an Image view in Android Espresso test? [duplicate]

I am working on automation of an image editing application and using Android Espresso as the framework. Please guide me How to pinch and zoom (gestures) an Image view in Android Espresso test

like image 589
Tarkik Avatar asked Aug 31 '25 21:08

Tarkik


1 Answers

You don't have methods in Espresso for that but you can use UiAutomator objects to perform these actions.

UiDevice myDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
myDevice.findObject(new UiSelector().text("element text to be found")).pinchIn(); //to zoom in
myDevice.findObject(new UiSelector().text("element text to be found")).pinchOut(); //to zoom out
like image 94
Sajal Singh Avatar answered Sep 03 '25 11:09

Sajal Singh