Tap - operation¶
- Android - mobile devices
- Apple iPhone / iPad (iOS)
This operation simulates tapping on a specific element or position on the device screen.
There are 3 types of tap available in Suitest:
- Single tap - Regular tap on the screen
- Double tap - Double tapping on the screen within a very quick time period
- Long tap - Touching the screen and holding a finger there for a while
Tapping can be performed on:
-
an
element
- on the center of its bounding box (if the element is obscured by other elements or not completely visible the operation may not work as expected) -
a
position
- on specified coordinates defined in pixels relative to the top left corner of the app
Single tap on the target¶
To perform this operation in the Suitest Test editor
use the Tap line with single
type:
To perform this operation in the Suitest JavaScript API use the Tap command in conjunction with the chosen subject:
await suitest.element('logoImg').tap('single');
await suitest.position(100, 200).tap('single');
Double tap on the target¶
You can send double tap action to tap on the target twice in a very short time. You can do so either on an element or on a position.
In Test editor:
In JavaScript API, you can use one of the following two examples based on the target:
await suitest.element('logoImg').tap('double');
await suitest.position(100, 200).tap('double');
Long tap on the target¶
You can execute the long tap (also known as long press) action to simulate pressing of the screen for a defined period of time (minimum value is 1 second). You can do so either on an element or on specific position:
In Test editor:
In JavaScript API, you can use one of the following two examples based on the target:
Please note that JavaScript API command parameter duration is defined in milliseconds.
await suitest.element('logoImg').tap('long', 1000);
await suitest.position(100, 200).tap('long', 3000);