Payday Loans Online Payday Loans Online

Todd Rothe : UI/UX Developer

it's pronounced rowth-ee

By 2g1c2 girls 1 cup

FlexPilot, Ruby, Selenium WebDriver, Jenkins and Windows Part 1

Recently I have been tasked with running automated tests against an html/javascript/flex app as part of the automated build using Flexpilot to interface with the flex app, ruby to write/run the tests and a Jenkins master to a windows slave build machine.

This will be a series of posts detailing the flexpilot install, writing ruby tests, and configuring the jenkins targets and windows box to run the automated tests.

Part 1 – Installing FlexPilot

Download FPBootstrap.zip from the download site. Unpacking this will give you org.flex_pilot.FPBootstrap.as which you can place in your project.

Download FlexPilot-4-stable.swf from the download site. Rename the swf to FlexPilot.swf and place it in your apps root directory.

In your application mxml you need to set the value of FPBootstrap.flex_pilotLibPath in response to applicationComplete or addedToStage.

<.s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" addedToStage="addedToStageHandler(event)"/>
private function addedToStageHandler(event:Event):void
{
FPBootstrap.flex_pilotLibPath = "FlexPilot.swf";
FPBootstrap.init(stage);
}

Run your app, open dev tools in the browser window running your app and enter the following in the javascript console, where ‘MyApp’ is the name of your app as referenced in the embed code on your html page:
document.MyApp.fp_explorerStart()

Now mouse over your app and see the blue squares appear around the ui elements under your cursor. *Don’t see cool blue squares?

You will also see a bunch of great stuff fill your javascript console.

These are locator chains and you will use them to ensure that your target ui elements have the id or automationName you are expecting in your test.

Locator chain: id:MyApp/name:ApplicationSkin271/id:_ApplicationSkin_Group1/id:contentGroup/id:mainScreen/
automationName:Screen/name:ScreenSkin547/id:contentGroup/id:contentHolderGroup/name:Selection138/
name:VGroup140/name:Group141/automationName:LoginButton/name:BorderContainerSkin619

The locator chain consists of the locator (id, name, or automationName) / value for the parents of the ui element that you interact with. When writing tests you will use these locators:values to target and interact with ui elements.

For example, if you want to click the login button referenced in the locator chain above you would use something like this
document.MyApp.fp_click({automationName:’LoginButton’})

*If you don’t see the cool blue squares and locator chains and instead you get this in the js console:
document.MyApp.fp_explorerStart()
TypeError: Result of expression ‘document.MyApp.fp_explorerStart’ [undefined] is not a function.
Then flex pilot is not in place.
Double check the install steps detailed above.
One of the issues I ran accross was the old security sandbox issue. Since my app and supporting files are Akamai’ed MyApp.swf and FlexPilot.swf were served from different locations, therefore unable to communicate.
To resolve this I added some url params and logic, allowing me to load un-Akamai’ed version of my app and all its supporting files.

Good luck!

 

No Responses to “FlexPilot, Ruby, Selenium WebDriver, Jenkins and Windows Part 1” (post new)

 

Leave a Reply

You must be logged in to post a comment.