Class sap.ui.test.OpaPluginModule: sap/ui/test/OpaPlugin
A Plugin to search UI5 controls.
Since: 1.22.
Constructor Summary
new sap.ui.test.OpaPlugin()
Method Summary
sap.ui.test.OpaPlugin.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.test.OpaPlugin with name
sClassName
and enriches it with the information contained in oClassInfo
.getAllControls(fnConstructorType?)Gets all the controls of a certain type that are currently instantiated.
getControlByGlobalId(oOptions)Returns a control by its id accepts an object with an ID property the ID can be will check a control type also, if defined
- a single string - function will return the control instance or undefined
- an array of strings - function will return an array of found controls or an empty array
- a regexp - function will return an array of found controls or an empty array
getControlInView(oOptions)Gets a control inside of the view (same as calling oView.byId) If no ID is provided, it will return all the controls inside of a view (also nested views and their children).
getView(sViewName)Returns the view with a specific name - if there are multiple views with that name only the first one is returned.
Method Detail
sap.ui.test.OpaPlugin.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.test.OpaPlugin with name
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in Object.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
sap.ui.test.OpaPlugin.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.test.OpaPlugin.
Returns:
{sap.ui.base.Metadata} | Metadata object describing this class |
getAllControls(fnConstructorType?): Array
Gets all the controls of a certain type that are currently instantiated. If the control type is omitted, nothing is returned.
Parameters:
{function} | fnConstructorType? | the control type, e.g: sap.m.CheckBox |
Returns:
{Array} | an array of the found controls (can be empty) |
getControlByGlobalId(oOptions): sap.ui.core.Element[]
Returns a control by its id accepts an object with an ID property the ID can be will check a control type also, if defined
- a single string - function will return the control instance or undefined
- an array of strings - function will return an array of found controls or an empty array
- a regexp - function will return an array of found controls or an empty array
Parameters:
oOptions | should contain an ID property. It can be of the type string or regex. If contains controlType property, will check it as well |
Returns:
{sap.ui.core.Element[]} | all controls matched by the regex or the control matched by the string or null |
getControlConstructor(sControlType): null|function
Gets the constructor function of a certain controlType
Parameters:
{string} | sControlType | the name of the type eg: "sap.m.Button" |
Returns:
{null|function} | When the type is loaded, the contstructor is returned, if it is a lazy stub or not yet loaded, null will be returned and there will be a log entry. |
getControlInView(oOptions): sap.ui.core.Element|sap.ui.core.Element[]
Gets a control inside of the view (same as calling oView.byId) If no ID is provided, it will return all the controls inside of a view (also nested views and their children).
eg : { id : "foo" } will search globally for a control with the ID foo
eg : { id : "foo" , viewName : "bar" } will search for a control with the ID foo inside the view with the name bar
eg : { viewName : "bar" } will return all the controls inside the view with the name bar
eg : { viewName : "bar", controlType : sap.m.Button } will return all the Buttons inside a view with the name bar
eg : { viewName : "bar", viewNamespace : "baz." } will return all the Controls in the view with the name baz.bar
eg : { id : "foo" } will search globally for a control with the ID foo
eg : { id : "foo" , viewName : "bar" } will search for a control with the ID foo inside the view with the name bar
eg : { viewName : "bar" } will return all the controls inside the view with the name bar
eg : { viewName : "bar", controlType : sap.m.Button } will return all the Buttons inside a view with the name bar
eg : { viewName : "bar", viewNamespace : "baz." } will return all the Controls in the view with the name baz.bar
Parameters:
{object} | oOptions | that may contain a viewName, id, viewNamespace and controlType properties. |
Returns:
{sap.ui.core.Element|sap.ui.core.Element[]} | the found control, an array of matching controls, undefined or null |
getMatchingControls(oOptions): sap.ui.core.Element|sap.ui.core.Element[]|undefined|null
Tries to find a control depending on the options provided.
Parameters:
{object} | oOptions | a map of options used to describe the control you are looking for. |
{string} | oOptions.viewName? | Controls will only be searched inside of the view. Inside means, if you are giving an ID - the control will be found by using the byId function of the view. If you are specifying other options than the id, the view has to be an ancestor of the control - when you call myControl.getParent, you have to reach the view at some point. |
{string|string[]} | oOptions.id? | The ID if one or multiple controls. This can be a global ID or an ID used together with viewName. See the documentation of this parameter. |
{boolean} | oOptions.visible?, Default: true | States if a control need to have a visible domref (jQUery's :visible will be used to determine this). |
{boolean} | oOptions.interactable? | @since 1.34 States if a control has to match the interactable matcher sap.ui.test.matchers.Interactable. |
{boolean} | oOptions.searchOpenDialogs? | Only controls in the static UI area of UI5 are searched. |
Returns:
{sap.ui.core.Element|sap.ui.core.Element[]|undefined|null} | the found control/element, an array of found Controls, an empty array and null or undefined are possible depending of the parameters you specify |
getView(sViewName): sap.ui.core.mvc.View
Returns the view with a specific name - if there are multiple views with that name only the first one is returned.
Parameters:
{string} | sViewName | the name of the view |
Returns:
{sap.ui.core.mvc.View} | or undefined |