Page tree
Skip to end of metadata
Go to start of metadata

iOS 3D Touch is designed to allow applications to support a new level of interaction with the user. An application that uses 3D touch performs different actions based on the level of pressure exerted by the user when tapping the screen. This implies that when your test activates the 3D functionality, you will need a mechanism that provides different levels of touch intensity when "tapping" the screen.

Perfecto Touch Command

Perfecto provides the Touch command that includes a parameter that supports an Option parameter that supplies the missing link.

Interactive Mode

For manual testers, perform a 3D Touch by holding down the (keyboard) Ctrl and Alt keys together with tapping the screen with mouse. This will be interpreted as a forceful tapping of the screen at the coordinates.

Native Automation

For users of Perfecto's Native Automation use the Touch function (in the Functions tab) to perform the 3D Touch. Open the Advanced Parameters, and:

  • Select the Force value in the Operation mode parameter.
  • Provide either:
    • Exact <X, Y> coordinates where to tap the screen.
    • Coordinates as percentages - to allow for different screen resolutions.

Note: The coordinates on the screen start from <0, 0> in the upper left corner of the screen and are given in pixels.

Alternatively, use the Record mode and create the action interactively, as above.

Selenium/Appium Automation Scripts

To activate the Touch function in 3D Touch mode use the following (Java) sample code as a basis:

Map<String, Object> parms = new HashMap<>();
parms.put("location", “80,270”);
parms.put("operation", "force"); 
Object res = driver.executeScript("mobile:touch:tap", parms);

Supported platforms

The 3D Touch is supported on iOS devices running iOS 10.3 or later and support the necessary hardware:

  • iPhone 6S and 6S+
  • iPhone 7 and 7+
  • iPhone 8 and 8+

Limitations

  • On iOS 11 – using 3D Touch in SpringBoard is unstable and may cause the device to become unresponsive after an action (usually released by just pressing the Home button). This is a limitation stemming from Apple’s API.
  • 3D Touch commands cannot be sent using the Appium driver.performTouchAction(touchAction) method.
  • When executing a script using the Appium value for the automationName capability on iOS 11 or on supported iOS 10 devices with the XCUITest value for the automationName capability, coordinates retrieved from objects will not be executed correctly using Perfecto’s Touch command.
    The reason is that Appium bases the screen size on UI Points, whereas in Perfecto the screen size is based on Rendered Pixels.
    For an explanation about the difference, see: https://www.paintcodeapp.com/news/iphone-6-screens-demystified