Creates an instance of an UITest.
In the background, the class UITest uses the Greensock TimelineMax class. The opts object is passed directly to the TimelineMax class, so it can use any key that uses the TimelineMax class.
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object |
optional
An options object to specify the behaviour of the test case.
|
- See:
Example
// Create the UITest object
const test = new UITest({
timeScale: 2
})
// Add an action to the test case
test.tap(button, {eventType: 'click'})
// Start the test case
test.start()
Members
-
Gets the Greensock TimelineMax object, used in the background of UITest.
Methods
-
clear ()UITest
-
Clears all instructions of the test case.
Returns:
Type Description UITest A reference to the UITest for chaining. -
Executes a pan event (pointerdown, pointermove, pointerup) on a specific element.
Name Type Default Description elementHTMLElement | string The HTML element on which the event is to be executed, e.g. button, document, h2, canvas, etc. or an selector string. If a selector has been specified, it is evaluated immediately before the event is called using the querySelector method.
positionArray.<number> | object | PIXI.DisplayObject The center of the element. optional The local position of the event in the context of the specified HTML element. If no position is specified, the center of the HTML element is used. The position can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object.
timelinePositionnumber One second after the last action. optional The position in seconds when the event should be triggered, see shttps://greensock.com/docs/TimelineMax/addCallback().
optsobject optional An options object to specify the behaviour of the action.
Name Type Default Description onStartfunction optional A function that runs after the first event is fired. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
onUpdatefunction optional A function that runs after each execution of the second event. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
onCompletefunction optional A function that runs after the third event is fired. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
toArray.<number> | object | PIXI.DisplayObject {x: 0, y: 0} optional The target of the pan process. The position can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object.
durationnumber 1 optional The duration of the pan animation in seconds, see https://greensock.com/docs/TweenLite/duration().
easeEase Power0.easeNone optional The easing of the pan animation, see https://greensock.com/docs/Easing.
eventTypesArray.<string> ['pointerdown', 'pointermove', 'pointerup'] optional The event types to use. If no types are specified, the event types specified in the UITest constructor are used (or auto if not specified).
contextWindow | Frame window optional The context within which the optionally specified element selector should be executed.
bubblesboolean true optional The Event property bubbles indicates whether the event bubbles up through the DOM or not.
cancelableboolean true optional Events' cancelable property indicates if the event can be canceled, and therefore prevented as if the event never happened. If the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring.
-
Executes a pinch event (pointerdown, pointermove, pointerup) on a specific element with two "fingers" simultaneously.
Name Type Default Description elementHTMLElement | string The HTML element on which the event is to be executed, e.g. button, document, h2, canvas, etc. or an selector string. If a selector has been specified, it is evaluated immediately before the event is called using the querySelector method.
positionArray.<number> | object | PIXI.DisplayObject The center of the element. optional The local position of the event in the context of the specified HTML element. If no position is specified, the center of the HTML element is used. The position can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object.
timelinePositionnumber One second after the last action. optional The position in seconds when the event should be triggered, see shttps://greensock.com/docs/TimelineMax/addCallback().
optsobject optional An options object to specify the behaviour of the action.
Name Type Default Description onStartfunction optional A function that runs after the first events are fired. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
onUpdatefunction optional A function that runs after each execution of the second events. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
onCompletefunction optional A function that runs after the third events are fired. Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
doubleCallbacksboolean false optional The callbacks onStart, onUpdate and onComplete will be fired only for one finger. If set to true, the events will be fired for both fingers.
distancenumber 100 optional The distance in pixels, how far the two "fingers" should move apart. If to or bezier specified, distance is ignored.
toArray.<Array.<number>> | Array.<object> | Array.<PIXI.DisplayObject> optional The targets of the pinch process. The position must be an array with two entries. An entry can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object. If bezier is specified, to is ignored.
bezierArray.<Array.<number>> | Array.<object> | Array.<PIXI.DisplayObject> optional The targets of the pinch process. The position must be an array with two entries. An entry may be an array of positions or a bezier object (https://greensock.com/docs/Plugins/BezierPlugin). A position in the array or the values array of the bezier object can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object. If bezier is specified, to is ignored.
durationnumber 1 optional The duration of the pan animation in seconds, see https://greensock.com/docs/TweenLite/duration().
easeEase Power0.easeNone optional The easing of the pan animation, see https://greensock.com/docs/Easing.
eventTypesArray.<string> ['pointerdown', 'pointermove', 'pointerup'] optional The event types to use. If no types are specified, the event types specified in the UITest constructor are used (or auto if not specified).
contextWindow | Frame window optional The context within which the optionally specified element selector should be executed.
bubblesboolean true optional The Event property bubbles indicates whether the event bubbles up through the DOM or not.
cancelableboolean true optional Events' cancelable property indicates if the event can be canceled, and therefore prevented as if the event never happened. If the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring.
-
restart ()UITest
-
Restarts the test case.
Returns:
Type Description UITest A reference to the UITest for chaining. -
start ()UITest
-
Starts the test case and executes the corresponding statements in the specified order.
Returns:
Type Description UITest A reference to the UITest for chaining. -
stop ()UITest
-
Stops the test case and stops executing any further instructions.
Returns:
Type Description UITest A reference to the UITest for chaining. -
Executes a tap event (pointerdown, pointerup) on a specific element.
Name Type Default Description elementHTMLElement | string The HTML element on which the event is to be executed, e.g. button, document, h2, canvas, etc. or an selector string. If a selector has been specified, it is evaluated immediately before the event is called using the querySelector method.
positionArray.<number> | object | PIXI.DisplayObject The center of the element. optional The local position of the event in the context of the specified HTML element. If no position is specified, the center of the HTML element is used. The position can be specified as an array of numbers, as an object with the two properties x and y, or as a PIXI.Display object.
timelinePositionnumber One second after the last action. optional The position in seconds when the event should be triggered, see shttps://greensock.com/docs/TimelineMax/addCallback().
optsobject optional An options object to specify the behaviour of the action.
Name Type Default Description onStartfunction optional A function that runs after the first event is fired. Will not be fired if only one event is running (for example, a click event). Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
onCompletefunction optional A function that runs after the second event is fired. Always fired, even if only one event is running (for example, a click event). Receives the fired event object as the first parameter. The test case (UITest) is bound to this.
eventTypesArray.<string> ['pointerdown', 'pointerup'] optional The event types to use. If no types are specified, the event types specified in the UITest constructor are used (or auto if not specified).
eventTypestring optional If you want the tap method to fire only one event (for example, a click event), you can specify the opts.eventType parameter. If eventType is not null, the parameter opts.eventTypes is ignored.
contextWindow | Frame window optional The context within which the optionally specified element selector should be executed.
bubblesboolean true optional The Event property bubbles indicates whether the event bubbles up through the DOM or not.
cancelableboolean true optional Events' cancelable property indicates if the event can be canceled, and therefore prevented as if the event never happened. If the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring.