Steer mobile controls
You can steer mobile controls with Mobile Engine 3.0 xOS Modules that you created via Tosca XScan or Image-based test automation.
With xOS Modules you can automate native, hybrid, and mobile web applications on iOS and Android devices. You can scan xOS Modules on one platform and then use them to automate controls on the other platform. For example, you scan an xOS Module on an Android device and then use it in a TestCase to automate controls on an iOS device.
This chapter describes how to:
Prerequisites
-
For all native iOS controls, you have to set the Accessibility properties in Xcode.
-
If you want to steer mobile web controls on iOS 12, you have to prepare your mobile web application.
Steer controls in native applications
To automate native applications, you can steer the following mobile controls:
-
Snackbar on Android
In Android native applications, the Mobile Engine 3.0 automatically scrolls to find the controls. You can disable automatic scrolling with the steering parameter ScrollingBehavior. To do so, follow the steps below:
|
You can only use native controls without user simulations or the SendKeys keyboard command. |
Steer Buttons in native Android and iOS applications as described in chapter "Button".
A ButtonSelector consists of a number of RadioButtons:
-
RadioGroup on Android
-
UISegmentedControl on iOS
Tosca XScan creates a ModuleAttribute for the ButtonSelector.
Steer ButtonSelectors in native Android and iOS applications as described in chapter "RadioButton" and chapter "Control groups".
To use the ButtonSelector control as an xOS Module, you have to set its accessibilityLabel in the code of an iOS application. |
Steer CheckBoxes in native Android and iOS applications as described in chapter "CheckBox".
With the DatePicker control you can select dates.
If you use DataType String, the correct date format is DD.MM.YYYY. If you use the dynamic date expressions {DATE} or DataType Date, your input format depends on your Tricentis Tosca settings.
Possible ActionModes are Input, Verify, and Buffer.
Example of various types of uses for the mobile DatePicker
Steer Images in native Android and iOS applications as described in chapter "Image".
For native iOS images, the Property enabled value is always True.
An ItemSelector refers to:
-
Spinner on Android devices
-
UIPickerView on iOS devices
Steer ItemSelectors in native Android and iOS applications with the Name or the Index property.
Examples of various types of uses for the ItemSelector on iOS
A Label refers to:
-
TextView on Android devices
-
UILabel on iOS devices
Steer Labels as described in chapter "Label".
A ListView refers to:
-
ListView on Android devices
-
UITableView on iOS devices
For the single-line view, steer ListViews in native Android and iOS applications as described in chapter "ComboBox". However, there is no ActionMode to verify, if an entry is selected.
To use the ListView control as an xOS Module, you have to set its accessibilityLabel in the code of an iOS application. |
A PickerWheel refers to DatePicker's wheel and is used for date selections on iOS devices.
You can steer the following elements of the PickerWheel control:
-
Hour
-
Minute
-
Day
-
Month
-
Year
Possible ActionModes are Input, Buffer, and Verify.
In the example below, you have set the time on the PickerWheel to 11:15 and date to 23 October 1988.
PickerWheel control on iOS |
Steer RadioButtons in native Android applications as described in chapter "RadioButton".
A SearchBar in iOS applications consists of the following elements:
-
Search box area which is displayed in Tosca XScan as a SearchBar. Steer this control as described in chapter "TextBox".
-
A button which you can steer as described in chapter "Button".
A SearchBar in Android applications consists of the following elements:
-
Search box area which is displayed in Tosca XScan as a TextBox. Steer this control as described in chapter "TextBox".
-
A button which is displayed in Tosca XScan as a Button or an Image. Steer it as described in chapter "Button" or chapter "Image".
A Slider refers to:
-
SeekBar on Android devices
-
UISlider on iOS devices
You can automate Sliders in native Android and iOS applications. Only standard Sliders are supported.
In the Value column, you have to enter an integer between 0 and 100. This value is a percentage of the Slider range. For example, if a Slider has values that range from 0 to 1000, setting the Value to 50 in Tosca Commander means that you set the Slider value to 500.
On some devices or in some applications, the full Slider might not be visible due to the screen resolution of the device or the implementation of the application. In this case, the value selected by Tricentis Tosca may differ slightly from the value on the Slider. Adapt the value of your input to what is visible on the screen of your device. |
In the example below, you have set the Slider value to 88. In the next TestStep, Tricentis Tosca verifies this value with the ActionMode Verify and then waits until the Slider is Enabled.
Slider value set to 88 |
A Switch refers to Switch on Android devices.
Steer Switches in native Android applications as described in chapter "CheckBox".
A TabBar refers to:
-
TabHost on Android devices
-
UITabBar on iOS devices
Steer TabBars in native Android and iOS applications as described in chapter "TabControl".
A TextBox refers to:
-
EditText on Android devices
-
UITextFieldor UISecureTextFieldon iOS devices
Steer TextBoxes in native Android and iOS applications as described in chapter "TextBox".
Steer controls in mobile web applications
In mobile web applications, you can steer:
-
Standard controls with xOS Modules you created via Tosca XScan or Image-based test automation.
-
Standard controls with HTML XModules you created via the XBrowser Engine 3.0.
To automate mobile web applications, you can steer the following standard HTML controls as described in chapter "Steering Controls":
You can use the steering parameter ScrollingBehavior to define a position for an HTML control on the screen by adjusting the scrolling area. For detailed information on setting the scrolling behavior, see chapter "ScrollingBehavior". |