| Cogitek RIATest 3 Documentation | Copyright © Cogitek Inc. |
To expose an event of a custom component, define an <Events> tag in the class information file (see Automating custom components for more details on preparing the class information file). The <Events> tag has the following format:
<Events>
<Event Name="Select">
<Internal Class="randomWalkClasses::RandomWalkEvent" Type="itemClick"/>
<Property Name="itemRenderer">
<PropertyType Type="String" Codec="automationObject"/>
</Property>
</Event>
</Events>
The tags and attributes are:
| Event | Describes an event. Name attribute defines the name of the event. |
| Internal | Defines internal class name (attribute Class) and the type name (attribute Type) of the event. |
| Property | Defines the parameters of the event. Attributes are - Name, DefaultValue. |
| PropertyType | Describes the type of the parameter. Attributes are: Type - one of Boolean, Number, int, String. Codec - optional attribute used for describing the exact type of the value. One of keyCode, keyModifier, object, object[], color, color[], automationObject, automationObject[], asset, asset[], listDataObject, listDataObject[], dateRange, dateRange[], dateObject, event, tab, scrollDetail, dateScrollDetail, scrollDirection, adgCell[]. |
If the property of the event is an InteractiveObject you need to to specify Codec="automationObject". In the script these properties can be referenced by automationName (passing a string), by full locator (passing a Locator object), by property/value pair set (passing an anonymous object) or by a regular expression pattern (passing a RegExp object). For example:
// Using automationName as string
MyClass("mc1")=>Select("*js* | John | Smith");
// Use regular expression
MyClass("mc1")=>select(/.*John.*/);
// Select using 'data' property, passing anonymous object to match property/value pairs
MyClass("mc1")=>select({data:{first:"Arthur"}});
// Using full locator to specify item to select
MyClass("mc1")=>select(FlexListLabel("*js* | John | Smith"));
// Using new Locator to specify item to select
MyClass("mc1")=>select(new Locator({automationValue:"aw"}));
Important: The automationObject codec searches only for children of the component on which the event is being recorded/played back. For example the "select" event of DataGrid will only try to match anything that is below the grid (i.e. item renderers) for the "itemRenderer" property of the event.
Next: Exposing methods of custom components.