Posts in Category "FLEX AUTOMATION"

How make MX DataGrid Cell components i.e. ItemRenderers Automation Friendly

Issue :

How make MX DataGrid Cell components i.e. Custom ItemRenderers Automation Friendly

Solution :

Developers tend to modify the components that usually make up the default cell [ ItemRenderer=cell ] of a Data Grid, to fullfill there business requirements.
A Default cell of a DataGrid is made up of a ‘UITextField’ which is nothing but Text and no other component associated with it and shows up as ‘FlexListLabel’ when recognized with QTP,


modifications may include adding buttons, link buttons, more text, Text Area etc
but if you don’t add them correctly, the components under the Data Grid which are inside the custom item renderer would not be exposed to Automation.

One of the ways to ensure that all components inside your DataGrid cell remain exposed to automation is as follows,

Please find the sample application below “DataGridLinkedButton.mxml”

Your developers need to define inline or External Item renderers for your Data Grid,

based on a Flex container [in the example we have used “HBox”] which exposes its children automatically to automation [you can use HBox or VBox ].

 

For Inline Item renderer :

<mx:DataGridColumn headerText="Inline Renderer" width="150">
<mx:itemRenderer>
<fx:Component>
<mx:HBox horizontalAlign="center">
<mx:LinkButton label="TestLinkButton" color="haloblue" rollOverColor="haloSilver"/>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

 

For External Item Renderer [ refer : “myExternalItemRenderer.mxml “]

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
focusEnabled="true" horizontalAlign="center">
<mx:LinkButton label="LinkButton from External Renderer" color="haloblue" rollOverColor="haloSilver"/>
</mx:HBox>

 

Please refer the Image :

Click operations on

1st ,2nd ,3rd ,

4th column [contains External Item Renderer with LinkButton]

and 5th column [contains Inline Item Renderer with LinkButton]

Would record Automation scripts like so.

 

Automation Scripts :

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).Select “*Christina Coenraets* | 555-219-2270 | ccoenraets@fictitious.com | LinkButton from External Renderer | TestLinkButton”

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).Select “Christina Coenraets | *555-219-2270* | ccoenraets@fictitious.com | LinkButton from External Renderer | TestLinkButton”

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).Select “Christina Coenraets | 555-219-2270 | *ccoenraets@fictitious.com* | LinkButton from External Renderer | TestLinkButton”

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).FlexButton(“LinkButton from External”).Click

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).FlexButton(“TestLinkButton”).Click

Additional Information :

Input Operation on FlexAdvancedDataGrid Cell using QTP

 

FLEX CODE

DataGridLinkedButton.mxml

<?xml version="1.0" encoding="utf-8"?>
<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">

        <fx:Declarations>
            <fx:XMLList id="employees">
                <employee>
                    <name>Christina Coenraets</name>
                    <phone>555-219-2270</phone>
                    <email>ccoenraets@fictitious.com</email>
                    <active>true</active>
                    <image>images/arrow_icon_sm.png</image>
                </employee>
                <employee>
                    <name>Joanne Wall</name>
                    <phone>555-219-2012</phone>
                    <email>jwall@fictitious.com</email>
                    <active>true</active>
                </employee>
                <employee>
                    <name>Maurice Smith</name>
                    <phone>555-219-2012</phone>
                    <email>maurice@fictitious.com</email>
                    <active>false</active>
                </employee>
                <employee>
                    <name>Mary Jones</name>
                    <phone>555-219-2000</phone>
                    <email>mjones@fictitious.com</email>
                    <active>true</active>
                </employee>
            </fx:XMLList>
        </fx:Declarations>

        <s:layout>
            <s:HorizontalLayout horizontalAlign="center" />
        </s:layout>

        <s:Panel title="DataGrid Control"
                 color="0x000000"
                 borderAlpha="0.15">

            <s:layout>
                <s:VerticalLayout paddingLeft="10" paddingRight="10" paddingTop="10" paddingBottom="10"/>
            </s:layout>

            <s:Label width="100%" color="0x323232"
                     text="Select a row in the DataGrid control."/>

            <mx:DataGrid id="dg" color="0x323232" width="100%" rowCount="3" dataProvider="{employees}">
                <mx:columns>
                    <mx:DataGridColumn dataField="name" headerText="Name"/>
                    <mx:DataGridColumn dataField="phone" headerText="Phone"/>
                    <mx:DataGridColumn dataField="email" headerText="Email"/>
                    <mx:DataGridColumn headerText="External Renderer" itemRenderer="myExternalItemRenderer" width="250"/>
                    <mx:DataGridColumn headerText="Inline Renderer" width="150">
                        <mx:itemRenderer>
                            <fx:Component>
                                <mx:HBox horizontalAlign="center">
                                    <mx:LinkButton label="TestLinkButton" color="haloblue" rollOverColor="haloSilver"/>
                                </mx:HBox>
                            </fx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                </mx:columns>
            </mx:DataGrid>

            <mx:Form color="0x323232" width="100%" height="100%" paddingTop="0" paddingBottom="0"  >

                <mx:FormItem label="Name" paddingTop="0" paddingBottom="0">
                    <s:Label text="{dg.selectedItem.name}"/>
                </mx:FormItem>
                <mx:FormItem label="Email" paddingTop="0" paddingBottom="0">
                    <s:Label text="{dg.selectedItem.email}"/>
                </mx:FormItem>
                <mx:FormItem label="Phone" paddingTop="0" paddingBottom="0">
                    <s:Label text="{dg.selectedItem.phone}"/>
                </mx:FormItem>

            </mx:Form>

        </s:Panel>

</s:Application>

 

myExternalItemRenderer.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:fx="http://ns.adobe.com/mxml/2009"
                          xmlns:s="library://ns.adobe.com/flex/spark"
                          xmlns:mx="library://ns.adobe.com/flex/mx"
                          focusEnabled="true" horizontalAlign="center">
    <mx:LinkButton label="LinkButton from External Renderer" color="haloblue" rollOverColor="haloSilver"/>
</mx:HBox>

Flex applications show up as Macromedia Flash objects on QTP Object Spy

Issue :

Flex applications show up as Macromedia Flash objects on QTP Object Spy

Potential Causes :

Ensure the your environment works on Automation enabled build from Adobe, Please refer : http://www.adobe.com/devnet/flex/samples/flex_store_v2.html

  • If the app does not work,the possible causes are

-Issues with compatibility of QTP-Browser-Flex Plugin/Addin
-The Communication between ActiveX Plugin in the browser for Flex-QTP Automaiton Plugin and QTP is interrupted due to Browser Security settings.

  • If the app works then the issue in your environment but your application, the possible causes are

-Application is not compiled with automation swc files i.e. Flex Automation libraries.

Solution :

Issues with compatibility of QTP-Browser-Flex Plugin/Addin

Please refer : http://blogs.adobe.com/vikaschandran/2010/07/10/compatibility-matrix-for-flex-qtp-plugin-3-0-0-and-4-0-0-for-qtp-and-ie-combinations/

 

Application is compiled with automation swc files i.e. Flex Automation libraries.

Please refer :

Compiling Flex 3 Applications to enable automation

http://blogs.adobe.com/vikaschandran/2010/07/11/compiling-flex-3-applications-to-enable-automaiton/

Compiling Flex 4 Applications to enable automation

http://blogs.adobe.com/vikaschandran/2010/07/15/compiling-flex-4-applications-to-enable-automaiton/

 

The Communication between ActiveX Plugin in the browser for Flex-QTP Automation Plugin and QTP is interrupted due to Browser Security settings

This can be avoided by ensuring the following

-the TEAPluginIE.dll which is used by IE ActiveX for the Flex-QTP plug-in loads in Internet explorer when QTP is recording

Because if it’s not loaded in IE nothing would work, Process Explorer should help you check the same.

-the behavior of the Object Spy changes [win objects start showing up] if you change i.e. increase the security properties on the browser for internet and intranet

-if you keep both internet and intranet security to medium or low

i.e. basically allowing the Flex-QTP ActiveX component to do its job without hindrance. Everything would work fine.

Debugging checking and tracking variables in QTP with Flex-QTP Addin

ISSUE

Debugging and tracking variables in QTP

SOLUTION

Have a look at QTP  break point options in the image below

the red dots you see in QTP in the image below are the Break points

 

-right click on the Breakpoint to see the options,

-Use “Run from Step” and “Run to step”

 

Or Use “Debug from Step”

To add the variables to debug viewer you need to add watch on them use “Add to watch”

and check the “Debug viewer” panel to have look at the variables,

 

And once the playback starts use “F10” and “F11” to step through the Automation Scripts line by line

keep an eye on the “Object Repository

To check on the values,

You may also use the following code

myvariable=Browser(“Browser”).SparkApplication(“ADGFidelity182547968Nikhil”).SparkPanel(“AdvancedDataGrid Control”).FlexAdvancedDataGrid(“myADG”).GetROProperty(“automationname”)

print myvariable               //myADG that you see on the image below is the print output

myvariable2=Browser(“Browser”).SparkApplication(“ADGFidelity182547968Nikhil”).SparkPanel(“AdvancedDataGrid Control”).FlexAdvancedDataGrid(“myADG”).GetROProperty(“automationindex”)

msgbox  myvariable2     //index:0 is the msgbox output


Traversing Spark Dropdown list with large number of items Flex SDK 4.x using QTP

ISSUE

Traversing Spark Dropdown list with large number of items Flex SDK 4.x using QTP

SOLUTION

The solution consists of two parts

PART 1

Change the Dropdown code [Application code] to include a property

useVirtualLayout=”false”

[for more details please refer : Using virtualization with list-based controls]


<s:DropDownList id=”DropDownTest” dataProvider=”{arrElementsDdl}” useVirtualLayout=”false” selectedIndex=”0″/>

as in the sample application provided Please refer code below : SparkDropDownFidelity182460106CODE

PART 2

Consists of using the automation Scripts as described below,

‘Get the number of  children under the Drop Down

Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).Open
Num=Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).GetItemsCount
Print “‘GetItemsCount’ value for Spark Drop Down: “&Num

‘Loop through the items inside Drop Down using SelectIndex
For i=0 to Num-1
Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).SelectIndex i

‘Always open the list before checking for the items
Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).Open
temp=Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).SparkListLabel(“automationindex:=index:”&i).Exist
print “Object Exists ? : ” &temp
set SparkGetItem=Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).SparkListLabel(“automationindex:=index:”&i)

‘Access the properties of the item
ItemAutomationname=SparkGetItem.GetROProperty(“automationname”)
ItemAutomationindex=SparkGetItem.GetROProperty(“automationindex”)
print “Spark Automationname : ” & ItemAutomationname&” Automationindex : ” &ItemAutomationindex
Next

ADDITIONAL INFORMATION

SparkDropDownFidelity182460106CODE

<?xml version=”1.0″ encoding=”utf-8″?>
<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” minWidth=”955″ minHeight=”600″>

<fx:Declarations>
<!– Place non-visual elements (e.g., services, value objects) here –>

</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;

[Bindable]
public var arrElementsDdl:ArrayCollection = new ArrayCollection([
{label:"Item 1", data:1},
{label:"Item 2", data:2},
{label:"Item 3", data:3},
{label:"Item 4", data:4},
{label:"Item 5", data:5},
{label:"Item 6", data:6},
{label:"Item 7", data:7},
{label:"Item 8", data:8},
{label:"Item 9", data:9},
{label:"Item 10", data:10},
{label:"Item 11", data:11},
{label:"Item 12", data:12},
{label:"Item 13", data:13},
{label:"Item 14", data:14},
{label:"Item 15", data:15}]);
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>

<s:ComboBox id=”cboxTest” dataProvider=”{arrElementsDdl}” selectedIndex=”0″ />
<s:DropDownList id=”DropDownTest” dataProvider=”{arrElementsDdl}” useVirtualLayout=”false” selectedIndex=”0″/>
<mx:Text id=”testText” text=”SDK 4.0 test 2 with useVirtualLayout=false”/>
</s:Application>

Using a Servlet to render a HTML wrapper to call a flex application for automation

ISSUE

Using a servlet to render a HTML wrapper to call a flex application for automation.

SOLUTION

Please find the sample servlet code which is based on the default HTML wrapper generated by Flash Builder.

as long as you have mentioned the right SWF name and compiled the SWF to be automation enabled.

you should be able to record and playback automation scripts.

[ NOTE : Also ensure that you have the related files in place

[ history folder, AC_OETags.js, playerProductInstall.swf, automation enabled application SWF file]

you may find them in any project created from Flash builder (can be found in “Bin-Debug” folder or any release build exported from Flash builder) ]

after adding the files your directory structure would look like this.

 

SERVLET CODE :

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
*
* @author chandran
*/
@WebServlet(name = “QtpServlet”, urlPatterns = {“/QtpServlet”})
public class QtpServlet extends HttpServlet {

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(“text/html;charset=UTF-8″);
PrintWriter out = response.getWriter();
try {
/*
out.println(“<html>”);
out.println(“<head>”);
out.println(“<title>Servlet QtpServlet</title>”);
out.println(“</head>”);
out.println(“<body>”);
out.println(“<h1>Servlet QtpServlet at ” + request.getContextPath () + “</h1>”);
out.println(“</body>”);
out.println(“</html>”);
*/

out.println(“<html lang=\”en\”>”);

out.println(“<head>”);
out.println(“<meta http-equiv=\”Content-Type\” content=\”text/html; charset=utf-8\” />”);

/*  BEGIN Browser History required section */
out.println(“<link rel=\”stylesheet\” type=\”text/css\” href=\”history/history.css\” />”);
/*  END Browser History required section */

out.println(“<title></title>”);
out.println(“<script src=\”AC_OETags.js\” language=\”javascript\”></script>”);

/*  BEGIN Browser History required section */
out.println(“<script src=\”history/history.js\” language=\”javascript\”></script>”);
/*  END Browser History required section */

out.println(“<style>”);
out.println(“body { margin: 0px; overflow:hidden }”);
out.println(“</style>”);
out.println(“<script language=\”JavaScript\” type=\”text/javascript\”>”);
/*
// —————————————————————————–
// Globals
// Major version of Flash required*/
out.println(“var requiredMajorVersion = 9;”);
// Minor version of Flash required
out.println(“var requiredMinorVersion = 0;”);
// Minor version of Flash required
out.println(“var requiredRevision = 124;”);
// —————————————————————————–
// */
out.println(“</script>”);
out.println(“</head>”);

out.println(“<body scroll=\”no\”>”);
out.println(“<script language=\”JavaScript\” type=\”text/javascript\”>”);
/*
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)*/
out.println(“var hasProductInstall = DetectFlashVer(6, 0, 65);”);

// Version check based upon the values defined in globals
out.println(“var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);”);

out.println(“if ( hasProductInstall && !hasRequestedVersion ) {“);

// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
out.println(“var MMPlayerType = (isIE == true) ? \”ActiveX\” : \”PlugIn\”;”);
out.println(“var MMredirectURL = window.location;”);

out.println(“document.title = document.title.slice(0, 47) + \” – Flash Player Installation\”;”);
out.println(“var MMdoctitle = document.title;”);

out.println(“AC_FL_RunContent(“);
out.println(“\”src\”, \”playerProductInstall\”,”);
out.println(“\”FlashVars\”, \”MMredirectURL=\”+MMredirectURL+\’&MMplayerType=\’+MMPlayerType+\’&MMdoctitle=\’+MMdoctitle+\”\”,”);
out.println(“\”width\”, \”100%\”,”);
out.println(“\”height\”, \”100%\”,”);
out.println(“\”align\”, \”middle\”,”);
out.println(“\”id\”, \”AccordianHeader182345208\”,”);
out.println(“\”quality\”, \”high\”,”);
out.println(“\”bgcolor\”, \”#ffffff\”,”);
out.println(“\”name\”, \”AccordianHeader182345208\”,”);
out.println(“\”allowScriptAccess\”,\”sameDomain\”,”);
out.println(“\”type\”, \”application/x-shockwave-flash\”,”);
out.println(“\”pluginspage\”, \”http://www.adobe.com/go/getflashplayer\”");
out.println(“);”);
out.println(“} else if (hasRequestedVersion) {“);
// if we\”ve detected an acceptable version
// embed the Flash Content SWF when all tests are passed
out.println(“AC_FL_RunContent(\”src\”, \”AccordianHeader182345208\”,\”width\”, \”100%\”,\”height\”, \”100%\”,\”align\”, \”middle\”,\”id\”, \”AccordianHeader182345208\”,\”quality\”, \”high\”,\”bgcolor\”, \”#ffffff\”,\”name\”, \”AccordianHeader182345208\”,\”allowScriptAccess\”,\”sameDomain\”,\”type\”, \”application/x-shockwave-flash\”,\”pluginspage\”, \”http://www.adobe.com/go/getflashplayer\”);”);
out.println(“} else {  // flash is too old or we can’t detect the plugin”);
out.println(“var alternateContent = \’Alternate HTML content should be placed here. \’+ \’This content requires the Adobe Flash Player. \’+ \’<a href=http://www.adobe.com/go/getflash/>Get Flash</a>\’;document.write(alternateContent);”);
// insert non-flash content
out.println(“}”);
// */
out.println(“</script>”);
out.println(“<noscript>”);
out.println(“<object classid=\”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\”");
out.println(“id=\”AccordianHeader182345208\” width=\”100%\” height=\”100%\”");
out.println(“codebase=\”http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab\”>”);
out.println(“<param name=\”movie\” value=\”AccordianHeader182345208.swf\” />”);
out.println(“<param name=\”quality\” value=\”high />”);
out.println(“<param name=\”bgcolor\” value=\”#ffffff />”);
out.println(“<param name=\”allowScriptAccess\” value=\”sameDomain\” />”);
out.println(“<embed src=\”AccordianHeader182345208.swf\” quality=\”high\” bgcolor=\”#ffffff\”");
out.println(“width=\”100%\” height=\”100%\” name=\”AccordianHeader182345208\” align=\”middle\”");
out.println(“play=\”true\”");
out.println(“loop=\”false\”");
out.println(“quality=\”high\”");
out.println(“allowScriptAccess=\”sameDomain\”");
out.println(“type=\”application/x-shockwave-flash\”");
out.println(“pluginspage=\”http://www.adobe.com/go/getflashplayer\”>”);
out.println(“</embed>”);
out.println(“</object>”);
out.println(“</noscript>”);
out.println(“</body>”);
out.println(“</html>”);

} finally {
out.close();
}
}

// <editor-fold defaultstate=”collapsed” desc=”HttpServlet methods. Click on the + sign on the left to edit the code.”>
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return “Short description”;
}// </editor-fold>
}

QTP Visibility issue with Flex objects ? [visible=false or .exist does not work as expected]

ISSUE

QTP Visibility issue with Flex objects ? [visible=false or .exist does not work as expected]

SOLUTION

While working with a client on a bug logged : http://bugs.adobe.com/jira/browse/FLEXENT-1283

we came across the following,

With SDK 3.2 and 3.5

 

if we toggle the visibility of a container, you would not get the desired result for automation for children within the container.

-we will get an .exist or getROProperty(“Visible”) to work

only if, not just the container holding the components is set to visible=false but the components inside [children] are set to visible=false explicitly

-we will be able to highlight the components once they are invisible.

Reason being that setting the visibility to false does not remove the component form the display tree hence it would still exist and get highlighted using QTP.

 

This sample application and automation scripts can repro the issue

Please refer “TestVisibility” Code and automation scripts.

 

Kindly try the approach used in the “testFormITemRemoval” application as another work around

which uses Flex States to remove items, this will give you the right results.

i.e.

-we get an .exist or getROProperty(“Visible”) set to False i.e. to work once the items inside the Form item are invisible [Department Form Item is removed using states]

-we cannot highlight the components once they are invisible [ if we try we get the error as seen in the bottom right hand corner of the image below]

the Flex application and code and automation scripts are mentioned below.

Refer :

“testFormITemRemoval” Code and automation scripts

 


“testFormITemRemoval” image


“TestVisibility” image


ADDITIONAL INFORMATION

“testFormITemRemoval” Automation Scripts :

 

test2=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexRadioButton(“Department:it”).Exist

print “Department IT radio button Exists : “&test2

DepItVisible=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexRadioButton(“Department:it”).GetROProperty(“visible”)

print “Department IT visible : ” &DepItVisible

 

test3=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexRadioButton(“Department:accounts”).Exist

print “Department Accounts Radio button Exists : ” &test3

DepAccountVisible=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexRadioButton(“Department:accounts”).GetROProperty(“visible”)

print “Department Accounts Visible :”&DepAccountVisible

 

test4=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexTextArea(“Department:departmentid”).Exist

print “Department id TextInput Exists : ” &test4

DepIdTextBoxVisible=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexTextArea(“Department:departmentid”).GetROProperty(“visible”)

print “Department Accounts Visible :”&DepIdTextBoxVisible

Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexButton(“employeesOnlyButton”).Click

 

Print “AFTER FORM ITEM DEPARTMENT REMOVAL”

 

test2=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexRadioButton(“Department:it”).Exist(5)

print “Department IT radio button Exists : “&test2

DepItVisible=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexRadioButton(“Department:it”).GetROProperty(“visible”)

print “Department IT visible : ” &DepItVisible

 

test3=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexRadioButton(“Department:accounts”).Exist(5)

print “Department Accounts Radio button Exists : ” &test3

DepAccountVisible=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexRadioButton(“Department:accounts”).GetROProperty(“visible”)

print “Department Accounts Visible :”&DepAccountVisible

 

test4=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexTextArea(“Department:departmentid”).Exist

print “Department id TextInput Exists : ” &test4

DepIdTextBoxVisible=Browser(“Browser”).FlexApplication(“VisibilityIssueWachovia1819841″).FlexForm(“loginForm”).FlexTextArea(“Department:departmentid”).GetROProperty(“visible”)

print “Department Accounts Visible :”&DepIdTextBoxVisible

 

“testFormITemRemoval” Application Code :

 

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”vertical” minWidth=”955″ minHeight=”600″>

<mx:states>

<mx:State name=”hideFormItem”>

<mx:RemoveChild target=”{department}”/>

<mx:RemoveChild target=”{employeesOnlyButton}”/>

</mx:State>

</mx:states>

 

<mx:Form id=”loginForm” automationName=”loginForm”>

<mx:FormItem id=”username” automationName=”username” label=”Username” direction=”horizontal”>

<mx:TextInput id=”usernameInput” automationName=”usernameInput”/>

</mx:FormItem>

<mx:FormItem id=”password” automationName=”password” label=”Password” direction=”horizontal”>

<mx:TextInput id=”passwordInput” automationName=”passwordInput”/>

</mx:FormItem>

<mx:FormItem id=”department” automationName=”department” label=”Department” direction=”vertical”>

<mx:RadioButton id=”it” automationName=”it” label=”IT”/>

<mx:RadioButton id=”accounts” automationName=”accounts” label=”Accounts”/>

<mx:TextInput id=”departmentid” automationName=”departmentid” text=”Enter Department ID”/>

</mx:FormItem>

<mx:FormItem direction=”horizontal”>

<mx:Button id=”loginButton” automationName=”loginButton” label=”Login”/>

<mx:Button id=”employeesOnlyButton” automationName=”employeesOnlyButton” label=”Employees Only” click=”currentState=‘hideFormItem’“/>

</mx:FormItem>

</mx:Form>

</mx:Application>

 

“TestVisibility” Automation Scripts :

 

test2=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexRadioButton(“Department:it”).Exist

print “Department IT radio button Exists : “&test2

DepItVisible=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexRadioButton(“Department:it”).GetROProperty(“visible”)

print “Department IT visible : ” &DepItVisible

 

test3=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexRadioButton(“Department:accounts”).Exist

print “Department Accounts Radio button Exists : ” &test3

DepAccountVisible=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexRadioButton(“Department:accounts”).GetROProperty(“visible”)

print “Department Accounts Visible :”&DepAccountVisible

 

test4=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexTextArea(“Department:departmentid”).Exist

print “Department id TextInput Exists : ” &test4

DepIdTextBoxVisible=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexTextArea(“Department:departmentid”).GetROProperty(“visible”)

print “Department Accounts Visible :”&DepIdTextBoxVisible

 

Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexButton(“employeesOnlyButton”).Click

 

Print “AFTER FORM ITEM DEPARTMENT REMOVAL”

 

test2=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexRadioButton(“Department:it”).Exist(5)

print “Department IT radio button Exists : “&test2

DepItVisible=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexRadioButton(“Department:it”).GetROProperty(“visible”)

print “Department IT visible : ” &DepItVisible

 

test3=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexRadioButton(“Department:accounts”).Exist(5)

print “Department Accounts Radio button Exists : ” &test3

DepAccountVisible=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexRadioButton(“Department:accounts”).GetROProperty(“visible”)

print “Department Accounts Visible :”&DepAccountVisible

 

test4=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexTextArea(“Department:departmentid”).Exist

print “Department id TextInput Exists : ” &test4

DepIdTextBoxVisible=Browser(“Browser”).FlexApplication(“testVisibility”).FlexForm(“loginForm”).FlexTextArea(“Department:departmentid”).GetROProperty(“visible”)

print “Department Accounts Visible :”&DepIdTextBoxVisible

 

“TestVisibility” Application Code :

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”vertical” minWidth=”955″ minHeight=”600″>

 

<mx:Form id=”loginForm” automationName=”loginForm”>

<mx:FormItem id=”username” automationName=”username” label=”Username” direction=”horizontal”>

<mx:TextInput id=”usernameInput” automationName=”usernameInput”/>

</mx:FormItem>

<mx:FormItem id=”password” automationName=”password” label=”Password” direction=”horizontal”>

<mx:TextInput id=”passwordInput” automationName=”passwordInput”/>

</mx:FormItem>

<mx:FormItem id=”department” automationName=”department” label=”Department” direction=”vertical”>

<mx:RadioButton id=”it” automationName=”it” label=”IT”/>

<mx:RadioButton id=”accounts” automationName=”accounts” label=”Accounts”/>

<mx:TextInput id=”departmentid” automationName=”departmentid” text=”Enter Department ID”/>

</mx:FormItem>

<mx:FormItem direction=”horizontal”>

<mx:Button id=”loginButton” automationName=”loginButton” label=”Login”/>

<mx:Button id=”employeesOnlyButton” automationName=”employeesOnlyButton” label=”Employees Only” click=”{department.visible=false;}”/>

</mx:FormItem>

</mx:Form>

</mx:Application>

Traversing items in a Flex 4 Spark Combobox using QTP

ISSUE

Traversing items in a Flex 4 Spark Combobox using QTP

SOLUTION :

Use the following Automation scripts :

‘Get the number of automation children

Browser(“Browser”).SparkApplication(“Ananada182244668SparkComboboxT”).SparkPanel(“Spark Combobox”).SparkComboBox(“testSparkCombobox”).Open
Num=Browser(“Browser”).SparkApplication(“Ananada182244668SparkComboboxT”).SparkPanel(“Spark Combobox”).SparkComboBox(“testSparkCombobox”).GetROProperty(“numautomationchildren”)
Print “‘numautomationchildren’ value for Spark Combobox : “&Num

‘Loop through them

For i=0 to Num-1

‘Select the node inside the combobox by using GetAutomationChildAt method
set SparkGetChild=Browser(“Browser”).SparkApplication(“Ananada182244668SparkComboboxT”).SparkPanel(“Spark Combobox”).SparkComboBox(“testSparkCombobox”).GetAutomationChildAt(i)

‘Access the properties of the node specified above using GetROProperty
SparkAutomationname=SparkGetChild.GetROProperty(“automationname”)
SparkAutomationindex=SparkGetChild.GetROProperty(“automationindex”)
print “Spark Automationname : ” & SparkAutomationname &” Automationindex : ” &SparkAutomationindex

Next

Additional Information :

Traversing items in a Flex 3 [Halo] Combobox using QTP

Traversing through a Flex 3 or 4 Advanced Data grid using QTP

Input Operation on FlexAdvancedDataGrid Cell using QTP

http://bugs.adobe.com/jira/browse/FLEXENT-1347

Enabling Automation for Air Applications

ISSUE :

Enabling Automation for Air Applications

 

SOLUTION :

Support for AIR automation has been added in Flex-QTP Plugin 4.0.0

the automation swcs [libraries] required for AIR automation are only available in Flex SDK 4.0 onwards for AIR.

All Air Versions shipped SDK 4.0 onwards are supported by the Flex-QTP Plugin 4.0.0

 

Environment Requirements for Using the QTP Plug-in 4.0.0

 

    1. Make sure the environment conforms to,https://www.adobe.com/devnet/flex/pdfs/flex4_plug-in_hp_quicktest_professional.pdf
    2. The QTP plug-in is installed and appears in the plugin section when QTP is started.[Flex-QTP Plugin 4.0.0 Download]

Note : Do not Delete the Folder containing the .bat file after Installation of the Plug-in,

as the QTP refers to the contents of the folder every time it launches to gather information regarding the plugin.

On the Application End i.e. the AIR Application Build under test [AUT]
You would need to make sure that
1. The AIR application is compiled with Automation SWCs

To compile your applications with static automation support:

1.    Start Flash Builder.
2.    Create a new Flex Project.
3.    Select your new Flex project in the Navigator.
4.    Select Project > Properties > Flex Compiler.
5.    In the “Additional compiler arguments” field, enter the following:
-include-libraries

“Flash_Builder_4_dir\sdks\4.0.0\frameworks\libs\automation\automation.swc”
“Flash_Builder_4_dir\sdks\4.0.0\frameworks\libs\automation\automation_air.swc”
“Flash_Builder_4_dir\sdks\4.0.0\frameworks\libs\automation\automation_airspark.swc”
“Flash_Builder_4_dir\sdks\4.0.0\frameworks\libs\automation\automation_agent.swc”
“Flash_Builder_4_dir\sdks\4.0.0\frameworks\libs\automation\qtp_air.swc”
“Flash_Builder_4_dir\sdks\4.0.0\frameworks\libs\automation\automation_dmv.swc”
“Flash_Builder_4_dir\sdks\4.0.0\frameworks\libs\automation\automation_spark.swc”
“Flash_Builder_4_dir\sdks\4.0.0\frameworks\libs\automation\automation_flashflexkit.swc”

The -include-libraries compiler option is relative to the Flex Builder installation directory; the default on Windows is ” C:\Program Files\Adobe\Adobe Flash Builder 4”

2.  Application is compiled with a valid Flash builder Premium license.

Or else your test scripts would be limited to 30 actions.
If you exceed 30 actions in a test without the Premium license, you will receive a warning that your license is not present.

As long as the this criteria is met,
and the Flex QTP plugin is installed.
You should be able to record QTP scripts against Flex Applications.

Additional information :

 

“Unable to find AutomationClass” Error solution for SDK 4.1 Flex-QTP

ISSUE

Flex Applications once compiled with automation SWC files from SDK 4.1 to enable automation for testing with QTP plugin.

throws RTE [Runtime Exception] with DataGrids, Combobox, DropDownList etc…

like so,

Every click on the Data Grid cells throws RTE

Error: Unable to find AutomationClass for ‘mx.controls.DataGrid’ ‘Insight_DataGrid0.Panel4.dg’.
at mx.automation.qtp::QTPEnvironment/getAutomationClassByInstance()[C:\work\flex\dmv_automation\projects\qtp\src\mx\automation\qtp\QTPEnvironment.as:204]
at mx.automation.delegates.controls::ListBaseAutomationImpl/recordListItemSelectEvent()[C:\work\flex\dmv_automation\projects\automation\src\mx\automation\delegates\controls\ListBaseAutomationImpl.as:175]
at mx.automation.delegates.controls::ListBaseAutomationImpl/mouseClickHandler()[C:\work\flex\dmv_automation\projects\automation\src\mx\automation\delegates\controls\ListBaseAutomationImpl.as:586]
Every Selection of item on the DropDownList throws RTE

Error: Unable to find AutomationClass for ‘spark.components.DataGroup’ ‘dropDown.scroller.ScrollerSkin91.dataGroup’.
at mx.automation.qtp::QTPEnvironment/getAutomationClassByInstance()[C:\work\flex\dmv_automation\projects\qtp\src\mx\automation\qtp\QTPEnvironment.as:203]
at spark.automation.delegates.components::SparkDataGroupAutomationImpl/recordDataGroupItemClickEvent()[E:\dev\4.x\frameworks\projects\automation_spark\src\spark\automation\delegates\components\SparkDataGroupAutomationImpl.as:229]
at spark.automation.delegates.components::SparkDataGroupAutomationImpl/mouseDownHandler()[E:\dev\4.x\frameworks\projects\automation_spark\src\spark\automation\delegates\components\SparkDataGroupAutomationImpl.as:208]

SOLUTION

All these issues have been resolved in SDK 4.5

which can be downloaded from refer:http://opensource.adobe.com/wiki/display/flexsdk/Hero

ADDITIONAL INFORMATION

BUGS LOGGED :

Click on DropDownList in SDK 4.1 errors with RTE Unable to find AutomationClass for ‘spark.components.DataGroup’ ‘dropDown.scroller.ScrollerSkin91.dataGroup’.

https://bugs.adobe.com/jira/browse/FLEXENT-1397

Error: Unable to find AutomationClass for ‘mx.controls.DataGrid’ on click on datagrid cell compiled with SDK 3.5 and automation swcs

https://bugs.adobe.com/jira/browse/FLEXENT-1319

Traversing items in a Flex 3 [Halo] Combobox using QTP

ISSUE

Traversing items in a Flex 3 [Halo] Combobox using QTP

SOLUTION :

Use the following Automation scripts :

‘Get the number of automation children

num=Browser(“Browser”).FlexApplication(“ComboboxNomura181990708″).FlexPanel(“testComboBox”).FlexComboBox(“ComboBox1″).GetROProperty (“numautomationchildren”)
print “Number of Automation Children :”&num

‘Loop through them

For i=0 to num-1

‘Select the node inside the combobox by using GetAutomationChildAt method
set getNode=Browser(“Browser”).FlexApplication(“ComboboxNomura181990708″).FlexPanel(“testComboBox”).FlexComboBox(“ComboBox1″).GetAutomationChildAt(i)

‘Access the properties of the node specified above using GetROProperty
getautomationname=getNode.GetROProperty(“automationname”)
getautomationindex=getNode.GetROProperty(“automationindex”)
print “AutomationIndex : “&getautomationindex  &”  AutomationName : “&getautomationname
Next

Additional Information :

Traversing items in a Flex 4 Spark Combobox using QTP

Traversing through a Flex 3 or 4 Advanced Data grid using QTP

Input Operation on FlexAdvancedDataGrid Cell using QTP