Mobile SUT Information

Use these commands and functions in your SenseTalk scripts to gather information about your Eggplant Functional mobile systems under test (SUTs).

AppList() Function

Behavior: The AppList() function returns a list of apps installed on an Android SUT connected through Android Gateway or an iOS SUT connected through iOS Gateway.

Parameters: None, Simple, or Full.

Syntax:

AppList()

AppList(listType)

Returns: When you use the function with no parameter, it returns the list of apps that was most recently retrieved from the connected mobile device (possibly not since the connection was established). When called with a parameter, it requests a refreshed list of apps from the device. This updated list reflects any apps that have been installed or uninstalled since connecting to the device.

Using the Simple parameter with AppList() is much the same as using the function with no parameter except it requests an updated list of apps from the device. The returned list might appear something like the following:

(com.sec.android.widgetapp.dualclockdigital,com.blurb.checkout,com.google.android.youtube,com.sec.android.widgetapp.activeapplicationwidget,com.android.chrome,com.sec.android.Kies,com.sec.dsm.system,com.wowwee.mip,com.sec.yosemite.tab,com.sec.esdk.elm)

When you use the Full parameter, the function requests the updated list and returns a list of property lists, where each installed app includes the following properties:

  • appID: An identifier string for the app (i.e., application ID on Android, bundle ID on iOS)
  • appName: The name of the app
  • canUninstall: true or false, whether the app can be uninstalled
  • deviceName: the name of the device where the app is installed

The output when using the Full parameter might look like this:

((appID:"com.samsung.android.app.ledcoverdream", appName:"com.samsung.android.app.ledcoverdream", canUninstall:"False", deviceName:"SM-G950U1"),(appID:"com.android.cts.priv.ctsshim", appName:"com.android.cts.priv.ctsshim", canUninstall:"False", deviceName:"SM-G950U1"),(appID:"com.gd.mobicore.pa", appName:"com.gd.mobicore.pa", canUninstall:"False", deviceName:"SM-G950U1"))

Example:

set myAppList to AppList() // Stores the return of AppList() in a variable.

Example:

if the applist contains "com.android.chrome" // Searches the returned list of installed apps on the device for the string representing a particular package

Log "Continuing with Chrome tests now."

else

LogError "Chrome is not available; exiting test now." // Logs an error and marks the script as a failure if the expected package string is not part of the return

exit handler // Exits the current handler

end if

Example:

put applist(full) into myInstalledApps // Puts the list of apps into a variable

repeat with each item apps of myInstalledApps // Iterates through the list of apps

if apps.canUninstall // For each app, checks to see if it can be uninstalled

log apps.appName

end if

end repeat

GetDeviceOrientation Function

Behavior: This function returns the current rotation of the device screen. The possible values are the same as the parameters for the SetDeviceOrientation command: LandscapeLeft, LandscapeRight, Portrait, PortraitUpsideDown.

Parameters: None.

Syntax:

GetDeviceOrientation()

Returns: The current rotation of the device screen. For example: Portrait.

Example:

put "Device rotated to " & GetDeviceOrientation()

Example:

myDeviceOrientation "LandscapeLeft" // Calls a custom handler named "myDeviceOrientation" as a command, with one parameter value "LandscapeLeft"

to myDeviceOrientation orientation // Declares a custom handler using the generic "to" syntax. A generic handler can be called as a command or function.

if the GetDeviceOrientation is orientation then // Checks whether the current device orientation matches the desired orientation.

Log "Device is in the expected orientation." 

else 

LogWarning "Setting device orientation now." 

SetDeviceOrientation orientation // Uses the SetDeviceOrientation command to put the SUT into the desired orientation.

end if

end myDeviceOrientation 

Related:

SUTInfo() Function

Behavior: This function returns a list of properties about an Android or iOS SUT with the active connection.

Parameters: None.

Syntax:

SUTInfo()

Example:

log the sutInfo's device

Returns: SUT info property list. For example:

iOS: (device:"iPhone7,1", device_os_version:"iOS 10.1.1", os:"OSX", os_version:"10.12.1", type:"iOS Gateway", version:"3.4.1")

Android: (device:"SM-T230NU", device_os:"Android", device_os_version:"4.4.2", EggSensorBuildNumber:"34", EggSensorCompileTime:"Thu Oct 13 16:30:52 MDT 2016", endianess:"little-endian", manufacturer:"samsung", product:"degaswifiue", protocol_version:"2.6", SystemNative2BuildNumber:"http://vncbuild.testplant.com/job/VNC_Android/34/", SystemNative2BuildTime:"2016-10-13, 22:32:05", type:"SystemNative2")

 

This topic was last updated on July 13, 2019, at 11:22:04 AM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2019 Eggplant