Skip to content

voltmx.automation Namespace

voltmx.automation Namespace

The voltmx.automation Namespace consists of the following API groups.

Widget APIs

Widget Path

Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array. It is applicable for almost all widget APIs.

Note: When you build an app in Test Mode, if the app contains components (with contract), the programmatic names of the properties must be unique. Ensure that the properties do not have the same name as that of any child widgets in the component or the parent FlexContainer widget. If a property and a widget (child or parent) have the same name, the property will not be honored.


Note: Whenever a Segment row is a part of Widget path, it refers to the top level flex. This flex ID should not be provided in the subsequent path.

Syntax


<widgetpath> [array of strings];

Mandatory/Optional

Mandatory

Example

  • Each string denotes the widget ID in the hierarchy.
voltmx.automation.button.click(["frmHomeLogin", "btnLogin"]);

//Here, ["frmHomeLogin","btnLogin"]is the widget path.

  • The widget path string can consist of an array indexer for SegmentedUI widget to denote the corresponding row.
voltmx.automation.button.click(["frmHomeLogin", "segUi1[0,2]", "btnLogin"]);
voltmx.automation.button.click(["frmHomeLogin", "segUi1[2]", "btnLogin"]);
  • The widget path string can be a date for a Calendar cell template.
voltmx.automation.button.click(["frmHomeLogin", "calendar11[05,05,2016]", "btnLogin"]);
  • The widget path string can be the friendly name of a form.
voltmx.automation.button.click(["Login Page", "userwidget1", "btnLogin"]);

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

The voltmx.automation Namespace comprises the following Widget APIs.

voltmx.automation.actionSheet.click


Triggers the click event on the provided action item, if it is visible. If the action item is not available, this API returns the No matching actionItem found message.

Syntax


voltmx.automation.actionSheet.click("actionItemTitle");

Input Parameters

Parameters Description
actionItemTitle [string] [Mandatory] The name of the actionSheet item.

Example

voltmx.automation.actionSheet.click("actionItemTitle");

Return Values

None

Remarks

Support for the record and playback features for this API is available from the V9 Service Pack 2 Fixpack 16 version of Volt MX Iris.

Platform Availability

  • iOS

voltmx.automation.alert.click


Clicks the provided button, if visible, for the Alert. If multiple alerts are simultaneously shown, this API clicks the most recent alert displayed on the screen.

Syntax


voltmx.automation.alert.click(<buttonIndex>);

Input Parameters

Parameters Description
buttonIndex [0 or 1] [Optional] Alert widget supports two buttons. This APIs triggers the click on the YES label if the index is 0, and it triggers the click on the NO label if the index is 1. If the alert type is information, this API triggers the click on the OK label if the index is 0. If you do not pass any buttonIndex, the API triggers the click on the NO label for confirmation alerts and the OK label for information alerts.

Example

voltmx.automation.alert.click(0);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows

Remarks

While using Jasmine Test Automation on the Adaptive Web or Responsive Web platforms, you can use the spyon API that is provided by Jasmine to gain more control over the alerts.

For Example, you can use the var spy = spyOn(window, '<method>').and.returnValue(<value>); code snippet to always return the value that you specify.

The value of and depend on the type of alert.

  • For information and error alerts, replace <method> with alert, and replace the <value> parameter with true.

  • For confirmation alerts, replace <method> with confirm, and replace the <value> parameter with either true or false.

Example

if("testcase", async function() { var spy = spyOn(window, 'confirm').and.returnValue(true); voltmx.automation.button.click(["Form", "btn"]); expect(spy).toBe(true); });


voltmx.automation.box.click


Triggers the Box click event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.box.click (<widgetpath>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example

voltmx.automation.box.click(["frmHomeLogin","boxId"]);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and Responsive Web

voltmx.automation.button.click


Triggers the Button click event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.button.click (<widgetpath>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example


voltmx.automation.button.click(["frmHomeLogin","btnLogin"]);
voltmx.automation.button.click(["frmHomeLogin","segUi1[0,2]", "btnLogin"]);
voltmx.automation.button.click(["frmHomeLogin","segUi1[2]", "btnLogin"]);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.calendar.selectDate


Triggers the Calendar click event on the specified widget, if it is visible and enabled.

Note: Supported view type is pop-up grid

Syntax


voltmx.automation.calendar.selectDate (<widgetpath>, <newDate>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
newDate [array] [Mandatory] Array representation of a date in mm/dd/yyyy format as [mm, dd, yyyy] co-ordinate. This format is irrespective of the calendar format.

Example


voltmx.automation.calendar.selectDate(["frmHomeLogin","calenderId"], [12,15,2017]);

Return Values

None

Note: Automation is supported only for the Calendar default view.

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.checkboxgroup.click


Triggers the CheckBoxGroup click event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.checkboxgroup.click (<widgetpath>, <chkBoxKey>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
chkBoxKey [array/integer] [Mandatory] CheckBoxGroup item that is to be clicked. > Note: The value of the chkBoxKey must be an Integer for the Table viewType. For all other viewTypes, the value of the chkBoxKey must be an array.

Example


voltmx.automation.checkboxgroup.click(["frmHomeLogin","checkboxgroupId"], "checkBoxKey");

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.flexcontainer.click


Triggers the FlexContainer click event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.flexcontainer.click (<widgetpath>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example

voltmx.automation.flexcontainer.click(["frmHomeLogin","flexContainerId"]);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.listbox.selectItem


Triggers the ListBox click event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.listbox.selectItem(<widgetpath>, <key>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
key [string/integer] [Mandatory] Indicates the key in the ListBox for which item is to be clicked. > Note: The value of the key must be an Integer for the Table viewType. For all other viewTypes, the value of the key must be a string.

Return Values

None

Example


voltmx.automation.listbox.selectItem(["frmHomeLogin","listbox"], "key1");

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.navigationBar.click


Triggers the click event on the barButton item of the navigation bar, if it is visible and enabled.

Syntax


voltmx.automation.navigationBar.click("barButtonId");

Input Parameters

Parameters Description
barButtonId [string] [Mandatory] The ID of the BarButtonItem.

Return Values

None

Example


voltmx.automation.navigationBar.click("barButtonId");

Remarks

Support for the record and playback features for this API is available from the V9 Service Pack 2 Fixpack 16 version of Volt MX Iris.

Platform Availability

  • iOS

voltmx.automation.radiobuttongroup.click


Triggers the RadioButtonGroup click event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.radiobuttongroup.click(<widgetpath>, <key>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
key [string/integer] [Mandatory] Radiobutton key that needs to be clicked. > Note: The value of the key must be an Integer for the Table viewType. For all other viewTypes, the value of the key must be a string.

Example

voltmx.automation.radiobuttongroup.click(["frmHomeLogin","rdBtnId"], "rdBtnkey");

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.segmentedui.click


Triggers the SegmentedUI click event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.segmentedui.click(<widgetpath>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example

voltmx.automation.segmentedui.click(["frmHomeLogin","segmentedUIId[0,2]"]);

Return Values

None

Note: Automation is supported only for the Segment table view.

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.segmentedui.pull


Triggers the onPull event on the SegmentedUI, if it is set.

Syntax


voltmx.automation.segmentedui.pull(<widgetpath>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example

voltmx.automation.segmentedui.pull(["frmHomeLogin","segmentedUIId"]);

Return Values

None

Note: Automation is supported only for the Segment table view.

Platform Availability

  • Android
  • iOS
  • ResponsiveWeb

voltmx.automation.segmentedui.push


Triggers the onPush event on the SegmentedUI, if it is set.

Syntax


voltmx.automation.segmentedui.push(<widgetpath>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example

voltmx.automation.segmentedui.push(["frmHomeLogin"," segmentedUIId "]);

Return Values

None

Note: Automation is supported only for the Segment table view.

Platform Availability

  • Android
  • iOS
  • ResponsiveWeb

voltmx.automation.segmentedui.scrollToRow


Triggers the segment to scroll to the row specified by the index of the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.segmentedui.scrollToRow(<widgetpath>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example

voltmx.automation.segmentedui.scrollToRow(["frmHomeLogin"," segmentedUIId[12]"]);
voltmx.automation.segmentedui.scrollToRow(["frmHomeLogin"," segmentedUIId[1,3]"]);

Return Values

None

Note: Automation is supported only for the Segment table view.

Remarks

The voltmx.automation.segmentedui.scrollToRow API does not work on the section header of the Segment.

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.scrollToWidget


Scrolls to ensure that the widget appears in view. It is an awaitable API.

Syntax


voltmx.automation.scrollToWidget(<widgetpath>);

Input Parameters

Parameter Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example

await voltmx.automation.scrollToWidget(["frmHomeLogin","btnLogin"]);

Return Values

None

Note: If segment is a part of widgetpath, then it scrolls only to the segment.

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.slider.slide


Triggers the Slider slide event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.slider.slide(<widgetpath>, <newValue>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
newValue [number] [Mandatory] New slider value within a minimum and maximum range.

Example

voltmx.automation.slider.slide(["frmHomeLogin","sliderId"], 25);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.switch.toggle


Toggles the Switch between ON/OFF on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.switch.toggle(<widgetpath>);

Input Parameters

Parameter Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.

Example

voltmx.automation.switch.toggle(["frmHomeLogin","switchId"]);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.tabpane.click


Clicks the tab with the specified tabID on the TabPane widget, if it is visible and enabled.

Syntax


voltmx.automation.tabpane.click(<widgetpath>, <tabID>);

Input Parameter

Parameter Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
tabID [string] [Mandatory] The tabID name.

Example

voltmx.automation.tabpane.click(["frmHomeLogin","tabpaneId"], ”tabId”);

Note: Automation is supported only for the TabPane default view.

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.textbox.enterText


Enters the specified text into the TextBox, if it is visible and enabled.

Syntax


voltmx.automation.textbox.enterText(<widgetpath>, <newText>, <Array of objects with options to raise an event>);

Input Parameters

Parameter Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
newText [string] [Mandatory] New text to be set to the TextBox. Specify null to clear the text.
Array of Objects [array of objects] [Optional] An array of JSON Objects where each object contains options that can be specified as part of the KeyboardEvent Object, such as key, keyCode, Event Modifier Initializers. > Note: This parameter is only available on the Responsive Web platform.

Example

voltmx.automation.textbox.enterText(["frmHomeLogin","textbox"], “sampleText”, [{ modifierCapsLock: true,
        key: 'A'
    }, {
        modifierCapsLock: true,
        key: 'B'
    }, {
        modifierCapsLock: false,
        key: 'c'
    }, {
        modifierCapsLock: false,
        key: 'f'
    }, {
        modifierCapsLock: false,
        key: 'd'
    }, {
        modifierCapsLock: true,
        key: 'E'
    }, {
        modifierCapsLock: false,
        keyCode: 13
    } // For enter key
]);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA
  • Responsive Web

voltmx.automation.textarea.enterText


Enters the specified text into the TextArea, if it is visible and enabled.

Syntax


voltmx.automation.textarea.enterText(<widgetpath>, <newText>, <Array of objects with options to raise an event>);

Input Parameters

Parameter Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
newText [string] [Mandatory] New text to be set to the TextArea. Specify null to clear the text.
Array of Objects [array of objects] [Optional] An array of JSON Objects where each object contains options that can be specified as part of the KeyboardEvent Object, such as key, keyCode, Event Modifier Initializers. > Note: This parameter is only available on the Responsive Web platform.

Example

voltmx.automation.textarea.enterText(["frmHomeLogin","textAreaId"], "sample", [{
        modifierCapsLock: true,
        key: 'A'
    }, {
        modifierCapsLock: true,
        key: 'B'
    }, {
        modifierCapsLock: false,
        key: 'c'
    }, {
        modifierCapsLock: false,
        key: 'f'
    }, {
        modifierCapsLock: false,
        key: 'd'
    }, {
        modifierCapsLock: true,
        key: 'E'
    }, {
        modifierCapsLock: false,
        keyCode: 13
 } // For enter key
]);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA
  • Responsive Web

Low-level Touch and Gesture APIs

The voltmx.automation Namespace comprises of the following Low-level Touch and Gesture APIs.

voltmx.automation.widget.touch


Triggers the touch event on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.widget.touch(<widgetpath>, <startPoint>, <movePoints>, <endpoint>, <Object with options for raising an event>);

Input Parameters

Parameter Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
startPoint [array] [Mandatory] Represents the start point as [x, y] co-ordinates. Alternatively, this can be assigned a null value.
movePoints [array] [Mandatory] Represents an array of interim points such as [[x1, y1], [x2, y2]…[xn, yn]]. Alternatively, this can be assigned a null value.
endpoint [array] [Mandatory] Represents the end point as [x, y] co-ordinates. Alternatively, this can be assigned a null value.
Array of Objects [array of objects] [Optional] An array of JSON Objects where each object contains options that can be specified as part of the KeyboardEvent Object, such as Event Modifier Initializers. > Note: This parameter is only available on the Responsive Web platform.

Example

voltmx.automation.widget.touch(["Home Page", "appMenuOption2"], [1, 1], [
    [30, 1],
    [50, 1],
    [60, 1],
] 
  [100,1]
  {modifierCapsLock: true}
  );

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA
  • Responsive Web

voltmx.automation.gesture.swipe


Use this API to automate the Swipe gesture on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.gesture.swipe([<widgetpath>], <gestureInfo>);

Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (such as form, master, etc.). It is an array of comma-separated strings from root to widget.
gestureInfo [object] [Mandatory]

A JSON object that contains the following key-value pairs:

  • point [X co-ordinate, Y co-ordinate]: The coordinates at which the gesture must be applied.
  • swipeDirection [Integer]: The direction in which the swipe gesture must be applied. You can provide the following values for the swipeDirection key:
    • 1 → Right to left
    • 2 → Left to right
    • 3 → Bottom to top
    • 4 → Top to bottom
  • fingers [Number]: The number of fingers to be used for the gesture.

Return Values

None  

Example

voltmx.automation.gesture.swipe(["Home Page", "appMenuOption2"], {
   “point”:[30,1],
  “swipeDirection”: 2, 
  “fingers”:1
});

Platform Availability

  • Android
  • iOS

voltmx.automation.gesture.tap


Use this API to automate the Tap gesture on the specified widget, if it is visible and enabled.

Syntax


voltmx.automation.gesture.tap([<widgetpath>], <gestureInfo>);

Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (such as form, master, etc.). It is an array of comma-separated strings from root to widget.
gestureInfo [object] [Mandatory]

A JSON object that contains the following key-value pairs:

  • point [X co-ordinate, Y co-ordinate]: The coordinates at which the gesture must be applied.
  • taps [Number]: The number of taps for the gesture to be applied.
  • fingers [Number]: The number of fingers to be used for the gesture.

Return Values

None  

Example

voltmx.automation.gesture.tap(["Home Page", "appMenuOption2"], {
“point”:[30,1],
“taps”: 2,
“fingers”:1
});

Platform Availability

  • Android
  • iOS

Miscellaneous Automation APIs

The voltmx.automation Namespace comprises of the following miscellaneous Automation APIs.

voltmx.automation.getCurrentForm


Returns the name of the current Form.

Syntax


voltmx.automation.getCurrentForm();

Input Parameters

None

Example

voltmx.automation.getCurrentForm();

Return Values

String - Returns the Form ID of the current Form.

Platform Availability

  • Android
  • iOS
  • SPA
  • Responsive Web

voltmx.automation.getWidgetsByFilter


Retrieves the paths of the child widgets of the container widget, based on the filters applied.

Syntax


voltmx.automation.getWidgetsByFilter(ContainerWidgetPath, Filters, SearchableWidgets);

Input Parameters

Parameters Description
containerWidgetPath[Array] This is a mandatory parameter. This parameter specifies the path of the container widget for which the search and filter criteria must be applied. The ContainerWidgetPath parameter only accepts the paths of container widgets such as Form and FlexContainer and FlexScrollContainer widgets. > Note: Volt MX Iris does not provide support to apply search filters for the child widgets of group widgets (such as Segment, ListBox, TabPane, and Components). However, you can search for the properties of the group widgets.
filters [Array] This is a mandatory parameter. This parameter contains an array of search conditions. If you provide multiple filters, only the widget paths that satisfy all the filters are returned. The array for the Filters parameter must contain the following information: property [String]: Specifies the widget property for which the search criteria applies. value [Object]: Specifies the value of the widget property for which the search criteria applies. The JSON Object can have a String, Number, or Boolean value. caseSensitive [Boolean]: Specifies if the search criteria for the property parameter must consider the case of the string. The default value for this key is true. This is an optional parameter and is only applicable if the type of the value parameter is String. searchCriteria [Constant]: Specifies the criteria for searching the value of a property. This is an optional parameter and can have the following constant values for supported criteria:voltmx.automation.SEARCH_CRITERIA_EQUALvoltmx.automation.SEARCH_CRITERIA_CONTAINSvoltmx.automation.SEARCH_CRITERIA_STARTSWITHvoltmx.automation.SEARCH_CRITERIA_ENDSWITHvoltmx.automation.SEARCH_CRITERIA_GREATERvoltmx.automation.SEARCH_CRITERIA_GREATER_EQUALvoltmx.automation.SEARCH_CRITERIA_LESSERvoltmx.automation.SEARCH_CRITERIA_LESSER_EQUAL> Note: The default value for this parameter is voltmx.automation.SEARCH_CRITERIA_EQUAL.
searchableWidgets [Array of Constants] This is an optional parameter. This parameter contains an array of constants that specify the widgets to be searched. The array for the searchableWidgets parameter can contain the following widget constants: voltmx.automation.widget.BUTTON voltmx.automation.widget.CALENDAR voltmx.automation.widget.CHECKBOXGROUP voltmx.automation.widget.FLEXCONTAINER voltmx.automation.widget.FLEXSCROLLCONTAINER voltmx.automation.widget.LABEL voltmx.automation.widget.LISTBOX voltmx.automation.widget.RADIOBUTTONGROUP voltmx.automation.widget.SEGMENTEDUI voltmx.automation.widget.SLIDER voltmx.automation.widget.SWITCH voltmx.automation.widget.TABPANE voltmx.automation.widget.TEXTAREA voltmx.automation.widget.TEXTBOX

Example 1

widgetList= voltmx.automation.getWidgetsByFilter(
  [“form1”],
  [
    {
      property: “text”,
      value: “Buttontext”,
      caseSensitive: false,
      searchCriteria: voltmx.automation.SEARCH_CRITERIA_CONTAINS
    }
  ],
  [voltmx.automation.widget.BUTTON]
  );

voltmx.automation.button.click(widgetList[0]);

Example 2

widgetList= voltmx.automation.getWidgetsByFilter(
  [“form1”, “flex1”],
  [
    {
      property: “text”,
      value: “Buttontext”, 
      caseSensitive: false, 
      searchCriteria: voltmx.automation.SEARCH_CRITERIA_STARTSWITH
    },
    {
      property: “isVisible”, 
      value: true, 
      searchCriteria: voltmx.automation.SEARCH_CRITERIA_EQUAL
    },
    {
      property : "zIndex",
      value : 2, 
      searchCriteria :voltmx.automation.SEARCH_CRITERIA_GREATER_EQUAL
    }
  ],
  [
    voltmx.automation.widget.BUTTON,
    voltmx.automation.widget.LABEL,
    voltmx.automation.widget.TEXTBOX
  ]
);

voltmx.automation.waitFor(widgetList[0]);

Return Values

Array of widget paths (in an array format) that satisfy the search criteria.

For Example, [ [“Form1”, “bnt1”], [“Form2”, “btn2”] ]

Platform Availability

  • Android
  • iOS
  • SPA
  • Responsive Web

voltmx.automation.playback.isLoadingScreenVisible


Returns the status of visibility of the loading screen.

Syntax


voltmx.automation.playback.isLoadingScreenVisible();

Input Parameters

None

Example

await voltmx.automation.playback.isLoadingScreenVisible();

Return Values

Boolean

Returns true if the loading screen is visible on the screen.

Returns false if the loading screen is not visible on the screen.

Platform Availability

  • Android
  • iOS
  • SPA and ResponsiveWeb

voltmx.automation.playback.wait


Introduces a delay time in the playback as specified. It is an awaitable API.

Syntax


voltmx.automation.playback.wait(<delayTime>);

Input Parameters

Parameter Description
delayTime [number] [Mandatory] Time delay in millisecond.

Example

await voltmx.automation.playback.wait(2000);

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.playback.waitFor


Waits for the widget to load completely. It is an awaitable API.

Syntax


voltmx.automation.playback.waitFor(<widgetpath> , <timeout in ms>);

Input Parameters

Parameters Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
timeout [number] It is an optional parameter. The timeout parameter must be specified in milliseconds. If the timeout is not specified, the API waits until the widget appears.

Example

await voltmx.automation.playback.waitFor(["Home Page", "amountSpentLabel"]);

Return Values

Boolean

Returns true if the widget is found within the timeout period.

Returns false if the wdget is not found within the timeout period.

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.playback.waitForLoadingScreenToDismiss


This API blocks user action until the loading screen is dismissed (or disappears). This is an awaitable API.

Syntax

voltmx.automation.playback.waitForLoadingScreenToDismiss(<timeout in ms>);

Input Parameters

Parameters Description
timeout [number] It is an optional parameter. The timeout parameter must be specified in milliseconds. If the timeout is not specified, the API waits until the loading screen disappears.

Example

await voltmx.automation.playback.waitForLoadingScreenToDismiss("amountSpentLabel");

Return Values

Boolean

Returns true if the loading screen has disappeared or the loading screen has not been rendered.

Returns false when the timeout is reached.

Platform Availability

  • Android
  • iOS
  • SPA
  • ResponsiveWeb

voltmx.automation.widget.getWidgetProperty


Returns the particular Volt MX-defined property on the specified widget.

Syntax


voltmx.automation.widget.getWidgetProperty(<widgetpath>, <propertyName>);

Input Parameters

Parameter Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array.
propertyName [string] [Mandatory] Widget property name.

Example

var labelText = voltmx.automation.widget.getWidgetProperty (["Home Page", "amountSpentLabel"], "text");

Return Values

The value of the property specified for the widget

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.device.deviceBack


Invokes the back action of the device. It is an awaitable API.

Syntax


voltmx.automation.device.deviceBack();

Input Parameters

None

Example

await voltmx.automation.device.deviceBack();

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows
  • SPA and ResponsiveWeb

voltmx.automation.capture


The api takes a screenshot of the widget passed. If the widget does not pass, the screenshot captures the entire screen.

Syntax


voltmx.automation.capture(<widgetpath>);

Input Parameters

Parameter Description
widgetpath [array of strings] [Mandatory] Widget ID from root element (form, and master, etc.). Comma-separated strings from root to widget represented in an array. If you do not specify this parameter, the screenshot of the entire current screen is taken.

Example

voltmx.automation.capture(["frmHomeLogin","btnLogin"]);
voltmx.automation.capture();

Return Values

None

Platform Availability

  • Android
  • iOS
  • Windows

voltmx.automation.takeScreenshotAndCompare


This API allows the framework to capture a screenshot and send it to the Volt MX Automator tool along with a filename for the screenshot. The API then waits for the Automator tool to compare the screenshot with the baseline image and returns the result. This is an awaitable API.

Syntax


voltmx.automation.takeScreenshotAndCompare(screenshotFilename, options);

Input Parameters

Parameter Description
screenshotFilename [String] [Mandatory] The file name for the screenshot. Volt MX Iris saves the screenshot for a particular platform (and channel) in the respective folder with this file name.
options [JSON Object] [Mandatory]

The configuration details used to capture and compare the screenshot. A JSON Object that contains the following key-value pairs:

  • threshold[Number]: The threshold value used to compare the images. The value must be a number between 0 and 100 in percentage (for example, if you provide the value as 20, the threshold is 20%). The default value of this parameter is 0.
  • screenshotType: The type of screenshot to be captured. The supported values for this parameter are fullscreen and widget.
  • widgetpath[array of strings]: The path of the widget (Widget ID) from the root element (for example, form or master) represented in an array of comma-separated strings. You must provide the value for this parameter in case of widget-level screenshots. If you do not specify this parameter, Volt MX Iris captures the screenshot of the entire current screen.

Example

var options = {
    threshold = 1000,
    screenshotType = widget,
    widgetpath = ["frmHomeLogin", "btnLogin"]
}
voltmx.automation.takeScreenshotAndCompare("TestScreen", options);

Return Values

Boolean

  • Returns true if both the images match.
  • Returns false if the images do not match or if the images are not available.

Platform Availability

  • Android
  • iOS
  • Responsive Web

Cross App Testing APIs

From the V9 Service Pack 2 Fixpack 16 release, Volt MX Iris introduces support for the following APIs for cross-app testing:

voltmx.automation.getParentInfo


This API returns a JSON Object (dictionary) that contains the details of the application that launched the current app.

Syntax


voltmx.automation.getParentInfo();

Return Values

A JSON Object that contains the following keys:

Parameters Description
appName [String] The name of the parent application.
windowRef [Object] A window reference object of the parent application.
queryParams [JSON Object] A JSON Object that contains all the queryParams that are passed while launching the current application. The return value is null if no params are passed.

Platform Availability

  • Responsive Web

voltmx.automation.launchApp


This API is used to launch a new app from the current app .Each time you invoke this API with a proper URL, a new window is launched with the specified URL.

This API retrieves the following keys from the IntegrationTests.json file:

The Application URL to be launched is derived from the URL key.

The testresources URL is derived from protocol and ScriptURL keys.

These keys are associated with the appName and are appended to the query parameters as the parentApp parameter, which is the name of the current application.

Syntax


voltmx.automation.launchApp(options);

Input Parameters

A JSON Object that contains the following keys:

Parameters Description
appName [String] - Mandatory The name of the application to be launched.
queryParams [JSON Object] - Optional A JSON Object that contains a list of all the parameters to be sent in the queryParams that are passed to the application being launched. The JSON Object contains the following key that can be passed along with other custom keys:
. testPlan [Optional]: The Test Plan that is to be used by the app after it is launched. If this parameter is not specified, the API uses the testPlan.js file for execution.

Example

var options = {
    "appName": "AppTwo",
    "queryParams": {
        "testPlan": "signUpPlan"
    }
}
var targetWindow = voltmx.automation.launchApp(options);

Return Values

A WindowProxy (window reference) object which is a reference to the newly opened window.

If the specified window is not opened, the API returns a Null value.

Platform Availability

  • Responsive Web

voltmx.automation.sendEvent


This API is used to send a message to another app that is associated with the current app. By using this API, you can resume the second application from the first and vice versa.

Syntax


voltmx.automation.sendEvent(options);

Input Parameters

options - A JSON Object that contains the following keys:

Parameters Description
windowRef [Object] A window reference object returned from the launchApp API.
eventName [String] The name of the event for which the API must wait. The event name can be any user-defined string.
appName [String] The name of the app to which the event must be sent.
data The data that needs to be sent to the other app. The data can be of any datatype.

Example

var options = {
    "windowRef": targetWindow,
    "eventName": 'emailid',
    "appName": "AppTwo",
    "data": {
        "email": "test@test.com"
    }
}
voltmx.automation.sendEvent(options);

Return Values

Boolean

Returns true if the app is already launched and the message is posted.

Returns false if the recipient app is not launched and open.

Platform Availability

  • Responsive Web

voltmx.automation.sendEventToParent


This API is used to send a message to the parent app that is associated with the current app. By using this API, you can resume the application that launched the current application.

Syntax


voltmx.automation.sendEventToParent(options);;

Input Parameters

options - A JSON Object that contains the following keys:

Parameters Description
eventName [String] The name of the event for which the API must wait. The event name can be any user-defined string.
data The data that needs to be sent to the other app. The data can be of any datatype.

Example

var options = {     
  "eventName": 'emailid',
    "data": {
        "email": "test@test.com"
    }
}
voltmx.automation.sendEventToParent(options);

Return Values

Boolean

Returns true if the app is already launched and the message is posted.

Returns false if the recipient app is not launched and open.

Platform Availability

  • Responsive Web

voltmx.automation.waitForEvent


This API waits for the instructions from the other app that this API is used for. This API waits indefinitely to receive the instruction (with the same eventName) from the other app to resume execution.

Syntax


voltmx.automation.waitForEvent(options);

Input Parameters

options - A JSON Object that contains the following keys:

Parameters Description
maxWait[number] It is an optional parameter. The maximum time in milliseconds for which the API must wait for the specified event to occur.
eventName [String] The name of the event for which the API must wait. The event name can be any user-defined string.

Example

var options = {
maxWait : 2000,
eventName : "resume"
}
voltmx.automation.waitForEvent(options);

Return Values

A JSON Object with the following key-value pairs:

  • eventReceived: A boolean value that indicates if the event is received in time or not.
  • data: A data object that is sent from the second app.

Platform Availability

  • Responsive Web

voltmx.automation.webSocket.sendMessage


This API is used to send messages to other client apps that are connected to the same WebSocket Server.

Syntax


voltmx.automation.webSocket.sendMessage(options);

Input Parameters

options - A JSON Object that contains the following keys:

Parameters Description
eventName [String] The name of the event that must be executed in App Factory.
data [String/Number/Object] Additional data that must be passed in the message.
to [String] - Optional The Selenium client receiver of the non-voltmx app that uses the same WebSocket for communication.
The default value of this parameter is the clientID of the app from App Factory.
To send a message to a client app that is not on App Factory, set the value of this parameter as the clientID of the app.

Example

voltmx.automation.webSocket.sendMessage ({
  "eventName": "<authenticate>",
 "data":string/number/object,
 "to": "<seleniumClientId/AppiumClientId>"
 }
);

Platform Availability

  • Android
  • iOS
  • Responsive Web

voltmx.automation.webSocket.waitForMessage


This API waits until the specified event is received. This is an awaitable API.

Syntax


voltmx.automation.webSocket.waitForMessage(options);

Input Parameters

options - A JSON Object that contains the following keys:

Parameters Description
eventName [String] - Mandatory The event that needs to be executed.
The API internally waits until it receives a message from the Selenium client with the same eventName.
maxWait [Number] - Optional The maximum amount of time (in milliseconds) that the API must wait for the event to be received.

Example

await voltmx.automation.webSocket.waitForMessage(
{
 "eventName" : "executionDone"
 }
);

Platform Availability

  • Android
  • iOS
  • Responsive Web

Page Object Model APIs

From the V9 Service Pack 5 release, Volt MX Iris introduces support for the following APIs to support the Page Object Model approach in Jasmine Test Automation:

voltmx.automation.pageObjectModel.getPageObjects


Use this API to retrieve and return the Page Objects for a specified Page.

Syntax

voltmx.automation.pageObjectModel.getPageObjects();

Input Parameters

An array of JavaScript Objects that contains the following keys:

Parameters Description
appName [String] [Mandatory] The name of the app or project that the Page Object Model belongs to.
id [String] [Mandatory] The name of the Form, Template, or Component for which the Page Object Model is to be retrieved.
type [Constant] [Optional] It is an optional parameter. The type of Page for which the Page Objects are to be retrieved.
The type parameter can have the following values:
. voltmx.automation.pageObjectModel.TYPE_FORM [Constant]: Retrieve Page Objects for Forms.
. voltmx.automation.pageObjectModel.TYPE_COMPONENT [Constant]: Retrieve Page Objects for Components.
. voltmx.automation.pageObjectModel.TYPE_TEMPLATE [Constant]: Retrieve Page Objects for Templates.

Example 1

var pageobjects = voltmx.automation.pageObjectModel.getPageObjects([
    {"appName" : "App1",  "id": "Form1", "type" : voltmx.automation.pageObjectModel.TYPE_FORM},
    {"appName" : "App1", "id": "comp.jasmineComp.comp1.comp1", "type" : voltmx.automation.pageObjectModel.TYPE_COMPONENT},
    {"appName" : "App1",  "id": "segRowTemplate1", "type" : voltmx.automation.pageObjectModel.TYPE_TEMPLATE}
]);

Example 2

var [form1_pom, form2_pom] = voltmx.automation.pageObjectModel.getPageObjects([
    {"appName" : "App1",  "id": "Form1"},
    {"appName" : "App1",  "id": "Form2"}
]);

Return Values

An array of Page Objects for the specified Pages in the JavaScript Object format. The order of the Page Objects returned and the size of the array returned is the same as the input array.

The API returns a Null value if a Page Object is not found for the specified Page.

Remarks

Use this API in a Test Case that uses Page Objects.

Here is a sample Test Case that uses the voltmx.automation.pageObjectModel.getPageObjects API to retrieve Page Object Models:

it("testCase1", async function () {
    var _pageobjects = voltmx.automation.pageObjectModel.getPageObjects([

        { "appName": "App1", "id": "Form1", "type": voltmx.automation.pageObjectModel.TYPE_FORM },

        { "appName": "App1", "id": "comp.jasmineComp.comp1.comp1", "type": voltmx.automation.pageObjectModel.TYPE_COMPONENT },

        { "appName": "App1", "id": "segRowTemplate1", "type": voltmx.automation.pageObjectModel.TYPE_TEMPLATE }
    ]);
    var Form1_pom = _pageobjects[0];
    var comp1_pom = _pageobjects[1];
    var template1_pom = _pageobjects[2];

    await voltmx.automation.playback.waitFor([Form1_pom._path, Form1_pom.Button1]);
    voltmx.automation.button.click([Form1_pom._path, Form1_pom.Button1]); //Form

    voltmx.automation.button.click([Form1_pom._path, Form1_pom.comp1Id, comp1_pom.BtnInComponent]); //Component

    voltmx.automation.button.click([Form1_pom._path, template1_pom.BtnInTemplate]); //Template  
});
]);

Platform Availability

  • Android
  • iOS
  • Responsive Web

Existing Volt MX Iris APIs

You can use the following existing Volt MX Iris APIs for Automation. The respective Syntax and usage remain the same.