Last updated: Jun 27, 2019 13:48
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 Force Touch Command
Perfecto's Touch command supports the 3D touch.
Prerequisites: The device must have Force Touch/3D Touch and it must be enabled.
To check if 3D touch is enabled go to: Settings > General > Accessibility > 3D Touch = On
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.
For users of Perfecto's Native Automation use the Touch function (in the Functions tab) to perform the 3D Touch.
- Open the Advanced Parameters
- 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.
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:
Perfecto's 3D Touch support is available for all iOS devices (iPhone6S or later) running iOS 10.3 or later, on XCUITest framework, and support the necessary hardware.
- 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.
When using 3D touch on iOS device the following menu items are not usable: "Mark My Location", "Send My Location" and "Search Nearby" button. These cannot be clicked manually or automatically. This limitation stems from Apple's implementation.
- 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