Skip to content
devenr23 edited this page Mar 5, 2012 · 23 revisions

To utilize the following you will need Flash testing enabled in your application: Flash Testing Setup

Locators

Usage

  • Each of these are passed as properties on a params object that is passed to the flex-pilot API calls.

These can be arbitrary properties on the DisplayObject you are looking up:

locator example
*attr (automationName etc) *value
id howdyButton
name testTextArea
chain name:testTextArea/name:UITextField18
child name:container/child:[2]

Link

Part of the API is there to help you click on htmlText links, you can do so with:
link=my link text here

However, a colon is part of the parsing syntax, so if you text has a colon in it, please replace it with “%3A” in order for it to work.

Chain

The chain is a similar conceptual implementation to XPath, iterating recursively through the display list building a path back to a specific DisplayObject. If you have a reliable attribute like ID or automationName your tests will run faster and the Windmill Bootstrapper will use fewer resources.

Child

This accesses the child object of a container based on integer index. It is also probably the best solution when you have multiple dynamic components of the same kind inside a container and are unable to use wild cards to reliably access the one you want.

Wild Cards

Each of the above also accept wildcards and can be used in the following way:
name:testTextArea/name:UITextField18
Could be represented by:
name:testText*rea/name:U*TextField*

The way this works is by creating a regular expression of (.*) for each occurrence of * in the locator string. Then a ^ is prepended and a $ is appended creating a strict RegEx that may look something like the following:
/^UITextField(.*)$/

Flash Controller API

All method take their required params as an object:

document.getElementById('devMovie').fp_click({name:'testTextArea'})
or
document.getElementById('devMovie').fp_type({name:'testTextArea', text:'WHATEVER'})

method params description
fp_check locator Checks the display object (Equivalent to fp_click).
fp_click locator (optional label, for accordions etc) Clicks display object.
fp_date locator Triggers the calendar layout date change on the display object.
fp_dragDropToCoords locator, coords Drags a display object ‘locator’ to a specified x,y.
fp_dragDropElemToElem locator, opt locator (meaning prepend opt to the second locator), ie. optchain, or optid (optionally an offsetx and offsety to ‘nudge’ the destination if needed) Drags a display object to the coordinates of the display object ‘opt’.
fp_doubleClick locator Double clicks display object.
fp_dump locator Dumps the child structure of display object for test building purposes.
fp_getObjectCoords locator Gets the coordinates of the display object.
fp_getPropertyValue locator (attrName) Gets the value of the property ‘attrName’ on the display object.
fp_getTextValue locator Gets the text value of the display object (either the htmlText or label).
fp_getVersion Returns the version of FlexPilot currently running.
fp_lookupFlash locator Looks up a display object in the display list.
fp_mouseOut locator Mouses out of display object.
fp_mouseOver locator Mouses over display object.
fp_radio locator Selects the radio button display object (Equivalent to fp_click).
fp_select locator Selects specified combo box display object. You can use the following properties in the locator for finding the item in the combo box: index, label, text, data, value, or toString.
fp_type locator, text Types ‘text’ into the display object found by the locator lookup.

Asserts

method params description
fp_assertDisplayObject locator assert a display object exists, ‘locator’
fp_assertProperty locator, validator assert a display object ‘locator’, contains a specified property ‘validator’ (property pipe value)
fp_assertText locator, validator assert a specified input field ‘locator’ equals text ‘validator’
fp_assertTextIn locator, validator assert a specified input field ‘locator’ contains text ‘validator’
  • Example fp_assertProperty: chain=automationName:test, validator=style.color:blue

Waiting

(These methods are actually part of the flex-pilot extension to Selenium IDE and RC)

method params description
waitForFlexReady target, timeout Wait for a flash/flex object’s testing API to be available
waitForFlexObject target, locator Wait for an object inside the flex or flash object to be ready to interact with
  • target: identifies a DOM node on the page representing a flash/flex object
  • locator: a chain/flex-pilot locator helping access a displayObject inside of flash/flex

Example

(The following assumes your flex/flash object has an ID of testApp, and a flex button with an ID of howdyButton)

<tr>
	<td>open</td>
	<td>/flexpilot/</td>
	<td></td>
</tr>
<tr>
	<td>waitForFlexReady</td>
	<td>id=testApp</td>
	<td>20000</td>
</tr>
<tr>
	<td>waitForFlexObject</td>
	<td>id=testApp</td>
	<td>chain=id:howdyButton</td>
</tr>
<tr>
	<td>flexClick</td>
	<td>id=testApp</td>
	<td>chain=id:howdyButton</td>
</tr>

Utilities

method params description
fp_explorerStart none enable the explorer
fp_explorerStop none stop the explorer
fp_recorderStart none enable the recorder
fp_recorderStop none disable the recorder

Call Outs

method params description
fp_explorerStopped none called on the flash obj parent page when the explorer is stopped
fp_explorerSelect locator for selected item receives a selected item from the flash movie
fp_recorderAction action to record receives a recorded action from the flash movie