Mobile Control and Touch Events
Eggplant Functional provides many commands and functions specifically for when you use mobile devices as systems under test (SUTs) as described below.
For a summary of of supported SenseTalk commands, functions, and typetext keywords for different mobile devices, see Mobile Commands and Functions by Mobile Device Type.
ADBCallRemote
Function
This function is for Android devices only. It is not supported by SauceLabs.
Behavior: This function executes ADB calls to available Android devices and returns any output received from the ADB command. The ADBCallRemote
function requires a connection through Android Gateway, and can work with an Android device connected remotely to the Eggplant machine.
Parameters: Any call to the Android Debug Bridge (ADB) command line tool, such as push
, pull
, shell
, and logcat
, which you can use with or without associated parameters.
Example:
put ADBCallRemote("devices") into ListOfDevices -- Stores the output of the adb devices command in a variable.
Example:
put ADBCallRemote("shell input keyevent 82") -- Sends keyevent 82 to the device.
Example:
put the second word of the connectionInfo's serverID into Device -- Stores the adb serial number into a variable
delete "(" from Device -- Deletes the parentheses from the serial number so it can be used with the adbcall() function
delete ")" from Device
put ADBCallRemote (merge ("-s [[Device]] logcat -b events")) -- Uses the merge function to substitute the serial number into the adb command string
The ADBCall
function, an equivalent of the ADBCallRemote
Function, is deprecated as of Eggplant Functional 20.2.
Copy File
Command
Behavior: This command lets you copy a file either from the local machine to the SUT or from the SUT to the local machine. Use the prefix SUT:
before the path to indicate the SUT. Note that you can't use this command to copy a file from one location on the SUT to a different location on the SUT or to a different SUT. Copy File
works only with single files, not with folders.
Parameters: A source file path and a destination file path.
Example:
copy file "/local/path/to/file" to "SUT:/remote/path/to/file" // Sends a file to the SUT
Example:
copy file "SUT:/remote/requested/file" to "/local/path/to/receive/file" // Retrieves a file from the SUT
DoubleTap
Command
Behavior: This command executes a double tap at either the current location or the location specified by the parameter. This command is equivalent to a DoubleClick command, catered to mobile devices. Generally on mobile devices, a double-tap action causes the app to zoom.
Example:
DoubleTap the remotescreensize/2-- Sends a doubletap command to the center of the screen
Example:
WaitFor 5, "FullsizeMap"
DoubleTap "BuildingIcon" -- Sends a doubletap command to the location of an image named "BuildingIcon"
WaitFor 5, "ZoomedMap"