4

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

Tarkik
  • 178
  • 1
  • 11

1 Answers1

3

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
Anatolii
  • 14,139
  • 4
  • 35
  • 65
Sajal Singh
  • 365
  • 1
  • 7
  • 15