class sap.ui.test.OpaPlugin

Control sample: sap.ui.test.OpaPlugin
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/test/OpaPlugin
Application Component: CA-UI5-TA

A Plugin to search UI5 controls.


Constructor

new sap.ui.test.OpaPlugin()

Methods Overview

Method Description
sap.ui.test.OpaPlugin.extend

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 sap.ui.base.Object.extend.

getAllControls

Gets all the controls or elements of a certain type that are currently instantiated. If the type is omitted, all controls and elements are returned.

getControlByGlobalId

Find a control by its global ID.

getControlConstructor

Gets the constructor function of a certain controlType

getControlInView

Gets a control inside the view (same as calling oView.byId) Returns all matching controls inside a view (also nested views and their children).
The view can be specified by viewName, viewNamespace, viewId, and any combination of three. 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 : { viewId : "viewBar" } will return all the controls inside the view with the ID viewBar

getMatchingControls

Find a control matching the provided options

sap.ui.test.OpaPlugin.getMetadata

Returns a metadata object for class sap.ui.test.OpaPlugin.

getView

Returns the view with a specific name. The result should be a unique view. If there are multiple visible views with that name, none will be returned.

sap.ui.test.OpaPlugin.extend

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 sap.ui.base.Object.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getAllControls

Gets all the controls or elements of a certain type that are currently instantiated. If the type is omitted, all controls and elements are returned.

Param Type DefaultValue Description
fnConstructorType function

the control type, e.g: sap.m.CheckBox

sControlType string

optional control type name, e.g: "sap.m.CheckBox"

getControlByGlobalId

Find a control by its global ID.

Param Type DefaultValue Description
oOptions object

a map of match conditions. Must contain an id property

id string string[]

required - ID to match. Can be string, regex or array

controlType string function

optional - control type to match

getControlConstructor

Gets the constructor function of a certain controlType

Param Type DefaultValue Description
sControlType string

the name of the type eg: "sap.m.Button"

getControlInView

Gets a control inside the view (same as calling oView.byId) Returns all matching controls inside a view (also nested views and their children).
The view can be specified by viewName, viewNamespace, viewId, and any combination of three. 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 : { viewId : "viewBar" } will return all the controls inside the view with the ID viewBar

Param Type DefaultValue Description
oOptions object

can contain a viewName, viewNamespace, viewId, fragmentId, id and controlType properties. oOptions.id can be string, array or regular expression

getMatchingControls

Find a control matching the provided options

Param Type DefaultValue Description
oOptions object

a map of options used to describe the control you are looking for.

viewName string

Controls will only be searched inside this view (ie: the view (as a control) has to be an ancestor of the control) If a control ID is given, the control will be found using the byId function of the view.

viewId string

@since 1.62 Controls will only be searched inside this view (ie: the view (as a control) has to be an ancestor of the control) If a control ID is given, the control will be found using the byId function of the view.

id string string[]

The ID of one or multiple controls. This can be a global ID or an ID used together with viewName. See the documentation of this parameter.

visible boolean true

should the control have a visible DOM reference

interactable boolean false

@since 1.34 should the control be interactable and enabled. When true, only interactable and enabled controls will be matched. For details, see the sap.ui.test.matchers.Interactable matcher.

enabled boolean false

@since 1.66 should the control be enabled. If interactable is true, enabled will also be true, unless declared otherwise.

editable boolean false

@since 1.80 should the control be editable.

searchOpenDialogs boolean

Only controls in the static UI area of UI5 are searched.

controlType string function

@since 1.40 match all controls of a certain type It is usually combined with viewName or searchOpenDialogs. If no control matches the type, an empty array will be returned. Examples:

        // will return an array of all visible buttons
        new OpaPlugin().getMatchingControls({
            controlType: "sap.m.Button"
        });

        // control type will also return controls that extend the control type
        // this will return an array of visible sap.m.List and sap.m.Table since both extend List base
        new OpaPlugin().getMatchingControls({
            controlType: "sap.m.ListBase"
        });

        // control type is often combined with viewName - only controls that are inside of the view
        // and have the correct type will be returned
        // here all sap.m.Inputs inside of a view called 'my.View' will be returned
        new OpaPlugin().getMatchingControls({
            viewName: "my.View"
            controlType: "sap.m.Input"
        });

sap.ui.test.OpaPlugin.getMetadata

Returns a metadata object for class sap.ui.test.OpaPlugin.

getView

Returns the view with a specific name. The result should be a unique view. If there are multiple visible views with that name, none will be returned.

Param Type DefaultValue Description
sViewName string

the name of the view