Class sap.ui.test.actions.PressModule: sap/ui/test/actions/Press

extends Action


Since: 1.34.
Constructor Summary
new sap.ui.test.actions.Press()The Press action is used to simulate a press interaction on a Control's dom ref.
Field Summary
controlAdaptersA map that contains the id suffixes for certain controls of the library.
Method Summary
sap.ui.test.actions.Press.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.test.actions.Press with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.test.actions.Press.getMetadata()Returns a metadata object for class sap.ui.test.actions.Press.
executeOn(oControl)Sets focus on given control and triggers a 'tap' event on it (which is internally translated into a 'press' event).
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.test.actions.Press()
The Press action is used to simulate a press interaction on a Control's dom ref. This will work out of the box for most of the controls (even custom controls).

Here is a List of supported controls (some controls will trigger the press on a specific region):

  • sap.m.Button
  • sap.m.Link
  • sap.m.StandardListItem
  • sap.m.IconTabFilter
  • sap.m.SearchField - Search Button
  • sap.m.Page - Back Button
  • sap.m.semantic.FullscreenPage - Back Button
  • sap.m.semantic.DetailPage - Back Button
  • sap.m.List - More Button
  • sap.m.Table - More Button
  • sap.m.StandardTile
Field Detail
controlAdapters: map
A map that contains the id suffixes for certain controls of the library. When you extended a UI5 controls the adapter of the control will be taken. If you need an adapter for your own control you can add it here. For example: You wrote a control with the namespace my.Control it renders two buttons and you want the press action to press the second one by default.


    new my.Control("myId");

It contains two button tags in its dom. When you render your control it creates the following dom:


    

Then you may add a control adapter like this


    Press.controlAdapters["my.control"] = "secondButton" //This can be used by setting the Target Property of an action

    // Example usage
    new Press(); // executes on second Button since it is set as default
    new Press({ idSuffix: "firstButton"}); // executes on the first button has to be the same as the last part of the id in the dom

Method Detail
sap.ui.test.actions.Press.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.test.actions.Press 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.test.actions.Action.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.actions.Press.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.test.actions.Press.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
executeOn(oControl)
Sets focus on given control and triggers a 'tap' event on it (which is internally translated into a 'press' event). Logs an error if control is not visible (i.e. has no dom representation)
Parameters:
{sap.ui.core.Control}oControl the control on which the 'press' event is triggered