Home Forum
 
Welcome, Guest
Please Login or Register.    Lost Password?

This is the RIATest discussion forum. Its purpose is to share experiences amongst the ever-expanding RIATest user community. Welcome if you are a newcomer !

Please note that whilst RIATest staff welcome and may occasionally participate in discussions, the forum is not intended to be the recognised channel for obtaining official support. Customers with support contracts are asked always to contact the support desk directly to obtain official, company support.

Go to bottom Favoured: 0
TOPIC:
#2438
Automating statusTextField in a custom panel 2 Months ago  
Hi,

we are using a custom panel StatusTextPanel where the statusTextField is made public.
We then set the htmlText of the public property statusTextField to some href text and use the relatd TextEvent.LINK for controlling the panel status.

statusTextField is of the type IUITextField

Now the question is: how can we automatize this TextEvent.LINK when the user clicks on the statusTextField?

I have spent lots of time to find out about creating a related delegate which makes this event automatable but ended up completely confused. I am unsure how to handle this statusTextField - is it a property, is it an automation child...? Do I need to add a custom event or just instrument an existing one?

Could you quickly outline the way to go to automation here?

Best regards
Matthias
maschatra (User)
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Logged Logged  
 
The administrator has disabled public write access.  
#2446
Re:Automating statusTextField in a custom panel 2 Months ago  
You need to instrument your custom component and add support for a custom event.

For more details see Flex docs: livedocs.adobe.com/flex/3/html/help.html..._components2_13.html

See also RIATest docs: www.riatest.com/onlinedocs/v3/RIATest/Cu...omponentsEvents.html
RIATest (Admin)
Admin
Posts: 1157
graph
User Online Now Click here to see the profile of this user
Logged Logged  
 
RIATest Team.
=====================
Please vote for RIATest and help it to be named the Best automated test tool for Flex here: www.automatedtestinginstitute.com/home/i...id=10&Itemid=183
 
The administrator has disabled public write access.  
#2458
Re:Automating statusTextField in a custom panel 2 Months ago  
RIATest wrote:

You need to instrument your custom component and add support for a custom event.


For more details see Flex docs: livedocs.adobe.com/flex/3/html/help.html..._components2_13.html

See also RIATest docs: www.riatest.com/onlinedocs/v3/RIATest/Cu...omponentsEvents.html


I set up the following delegate for our custom component (the following quote is an excerpt only):

Code:


// listen for the TextEvent.LINK
public function StatusTextPanelDelegate(statusPanel:StatusTextPanel)
{
super(statusPanel);
statusPanel.addEventListener(TextEvent.LINK, TextLinkEventHandler);
statusTextpanel=statusPanel;
}

// record TextEvent.LINK as a custom event
private function TextLinkEventHandler(event:TextEvent):void
{
var eventToRecord:AutomationRecordEvent=new AutomationRecordEvent(AutomationRecordEvent.CUSTOM_RECORD);

eventToRecord.automationObject=statusTextpanel;
// Provide the name of the event: 
eventToRecord.name=TextEvent.LINK;
// no arguments required during recording
Automation.automationManager2.recordCustomAutomationEvent(eventToRecord);
trace("StatusTextPanelDelegate: called TextLinkEventHandler");
}




My classinfo.xml looks like this:

Code:


<ClassInfo Name="StatusTextPanel" Extends="FlexPanel">
<Internal Class="com.icw.cdm.workflow.view.propertyeditor.view.components::StatusTextPanel"/>
<Properties>
<Property Name="automationClassName" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="automationName" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="className" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="automationIndex" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="numAutomationChildren" Verify="true" DefVerify="true">
<PropertyType Type="Integer"/>
</Property>
</Properties>
<Events>  
<Event Name="link">  
<Internal Class="flash.events::TextEvent" Type="LINK"/>  
</Event>  
</Events>
</ClassInfo>


Having this setup, recording the custom event when clicking on the statusTextPanel works fine.
The problem now is replaying the event does not work - when Riatest executes:

Code:

StatusTextPanel("panel_wfPropertyEditor_read")=>link();


there just happens nothing. The approach for replaying should look similar to:

Code:

override public function replayAutomatableEvent(event:Event):Boolean
{
trace("StatusTextPanelDelegate: called replayAutomatableEvent() -  event:" + event.toString());

var textFieldAutoHelper:TextFieldAutomationHelper;
return textFieldAutoHelper.replayAutomatableEvent(event);
}



The reason for this seems to be due to the fact, that the TextFieldAutomationHelper class only replays TypeTextEvents and TypeEvents, yet no TextEvents.LINK.

Is there any workaround for this? Or do we have to wait for Adobe to fix this?

Thanks for your help.
maschatra (User)
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Logged Logged  
 
The administrator has disabled public write access.  
#2486
Re:Automating statusTextField in a custom panel 2 Months ago  
When instrumenting a custom event you need to implement both recording and playback for it. I do not see an implementation of playback for your custom event in the source code of the delegate that you posted.

You may want to have a look at source codes of delegates for built-in Flex components to see how the events are instrumented.
RIATest (Admin)
Admin
Posts: 1157
graph
User Online Now Click here to see the profile of this user
Logged Logged  
 
RIATest Team.
=====================
Please vote for RIATest and help it to be named the Best automated test tool for Flex here: www.automatedtestinginstitute.com/home/i...id=10&Itemid=183
 
The administrator has disabled public write access.  
#2503
Re:Automating statusTextField in a custom panel 1 Month, 4 Weeks ago  
I tried two ways of implementing the replay method:

#1 First way:
Code:

override public function replayAutomatableEvent(event:Event):Boolean
{
trace("PropertyEditorPanelReadDelegate: called replayAutomatableEvent() -  event:" + event.toString());
if (event is TextEvent)
{
return _propertyEditorPanelRead.textField.dispatchEvent(event);
}
return false;
}



This method is called when executing in Riatest:
StatusTextPanel("panel_wfPropertyEditor_read")=>link("Bearbeiten");
yet, nothing happens, i.e. Riatest outputs the corrects traces (replaying...) but no event is triggered on the component.

#2 Second way: listening to the AutomationCustomReplayEvent (see Adobe's doc)

Code:

public function PropertyEditorPanelReadDelegate(propEdRead:PropertyEditorPanelRead)
{
super(propEdRead);
propEdRead.addEventListener(TextEvent.LINK, TextLinkEventHandler);
propEdRead.textField.addEventListener(AutomationCustomReplayEvent.CUSTOM_REPLAY, handleReplay, 
false, EventPriority.DEFAULT+1); 
_propertyEditorPanelRead=propEdRead;
// Automation.automationManager2.addEventListener(AutomationCustomReplayEvent.CUSTOM_REPLAY, 
//handleReplay, false, EventPriority.DEFAULT+1); 
trace("PropertyEditorPanelReadDelegate constructor called...");
}

protected function handleReplay(event:AutomationCustomReplayEvent):void
{
trace("PropertyEditorPanelReadDelegate: called handleReplay - event: " + event.toString());
if (event.automationObject == _propertyEditorPanelRead)
{
// take the name and args: 
var name:String=event.name;
var args:Array=event.args;
var tEvent:TextEvent=new TextEvent(TextEvent.LINK);

_propertyEditorPanelRead.dispatchEvent(tEvent);

// Use the above do the required replay: 
event.preventDefault(); // prevent the default replay 
}
}



Yet, this event is never fired or at least the event handler (handleReplay is never called).

Now my questions:
  1. Why is the replayAutomatableEvent called - there is no recording method for the TextEvent.LINK?

  2. Since I record a custom event, I presume that I also must implement a method for custum replay. Is that correct?

  3. If so, what must be done to have the AutomationCustomReplayEvent triggered?

  4. For implementation of the custom replay event handler: how is the actual replay being triggered? I am currently trying to manually dispatch a TextEvent.LINK on the statustextfield in our custom panel? Is that the correct way to go?


Best regards and thanks for help.
maschatra (User)
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Logged Logged  
 
Last Edit: 2010/07/13 12:19 By RIATest. Reason: formatting
 
The administrator has disabled public write access.  
#2507
Re:Automating statusTextField in a custom panel 1 Month, 4 Weeks ago  
Why is the replayAutomatableEvent called - there is no recording method for the TextEvent.LINK?

replayAutomatableEvent is called by Flex automation framework when it receives a playback command from RIATest. It does not matter that there is no corresponding recording method.

Since I record a custom event, I presume that I also must implement a method for custum replay. Is that correct?
Yes, that is correct.

If so, what must be done to have the AutomationCustomReplayEvent triggered?
Describe it in classinfo XML file and call it from RIATest script.

For implementation of the custom replay event handler: how is the actual replay being triggered? I am currently trying to manually dispatch a TextEvent.LINK on the statustextfield in our custom panel? Is that the correct way to go?
It is up to you to implement the replaying in the way that makes your custom component happy. RIATest will simply call corresponding replayAutomatableEvent function. From that point on it is your job to emulate the action on your component.

If you have not yet looked at automation delegate source codes for built-in Flex components, I highly recommend you to do so. There are tons of examples of event instrumenting in Flex automation source codes.
RIATest (Admin)
Admin
Posts: 1157
graph
User Online Now Click here to see the profile of this user
Logged Logged  
 
RIATest Team.
=====================
Please vote for RIATest and help it to be named the Best automated test tool for Flex here: www.automatedtestinginstitute.com/home/i...id=10&Itemid=183
 
The administrator has disabled public write access.  
#2508
Re:Automating statusTextField in a custom panel 1 Month, 4 Weeks ago  
Ok, so we focus on processing the AutomationRecordEvent.CUSTOM_RECORD / AutomationCustomReplayEvent method pair.

If so, what must be done to have the AutomationCustomReplayEvent triggered?
Describe it in classinfo XML file and call it from RIATest script.

Do I understand correctly, we need to include the AutomationCustomReplayEvent in the classinfo - like this??

Code:

<ClassInfo Name="PropertyEditorPanelRead" Extends="FlexPanel">
<Internal Class="com.icw.cdm.workflow.view.propertyeditor.view.components::PropertyEditorPanelRead"/>
<Properties>
<Property Name="automationClassName" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="automationName" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="className" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="automationIndex" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="automationIDPart" Describes="true">
<PropertyType Type="String"/>
</Property>
<Property Name="numAutomationChildren" Verify="true" DefVerify="true">
<PropertyType Type="Integer"/>
</Property>
</Properties>
<Events>  
<Event Name="TextLink">  
<Internal Class="flash.events::TextEvent" Type="LINK"/>  
</Event>  
<Property Name="linkText">  
<PropertyType Type="String" Codec="automationObject"/>
</Property>
<Event Name="AutoReplay">  
<Internal Class="mx.automation.events.AutomationCustomReplayEvent" Type="CUSTOM_REPLAY"/>  
</Event>  
</Events>
</ClassInfo>



These events should already be known to Riatest, shouldn't they?

Anyways, even when doing so, there is still no event being triggered/the handler is not called.
Do I miss any details on defining the event/the event listener or anything?

If you have not yet looked at automation delegate source codes for built-in Flex components, I highly recommend you to do so. There are tons of examples of event instrumenting in Flex automation source codes.

You are certainly right here, yet from what I found these delegates (of course) do not contain handling of custom events.
But, this problem will most probably solvable once the AutomationCustomReplayEvent is properly triggered.
Any help on that?
maschatra (User)
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Logged Logged  
 
The administrator has disabled public write access.  
#2512
Re:Automating statusTextField in a custom panel 1 Month, 3 Weeks ago  
I am not sure why is it not working. Can you supply full source codes that we can import into Flex Builder, compile and debug? If you can do it then we will be happy to look into it.

For custom event automation see RandomWalk sample from Adobe: www.adobe.com/devnet/flex/samples/randomwalk/
RIATest (Admin)
Admin
Posts: 1157
graph
User Online Now Click here to see the profile of this user
Logged Logged  
 
RIATest Team.
=====================
Please vote for RIATest and help it to be named the Best automated test tool for Flex here: www.automatedtestinginstitute.com/home/i...id=10&Itemid=183
 
The administrator has disabled public write access.  
#2538
Re:Automating statusTextField in a custom panel 1 Month, 3 Weeks ago  
I am not sure why is it not working. Can you supply full source codes that we can import into Flex Builder, compile and debug? If you can do it then we will be happy to look into it.

We modified our component to using LinkButtons now instead of the StatusText with TextLink Events. Now it is working seamlessly.

For custom event automation see RandomWalk sample from Adobe: www.adobe.com/devnet/flex/samples/randomwalk/
I looked at this example, yet in my understanding it differs in two important points from our application:

  1. First it is designed for qtp, hence there are is TEAFlexCustom.xml instead of the classinfo.xml

  2. It does not rely on the AutomationCustomReplayEvent which seems to be essential in our case.



One thing strikes me here: the AutomationCustomReplayEvent is defined in the qtp.swc library.
Why is it required to use this library when automating tests with RiaTest?

Also, the Adobe documentation is referring to this event only (see AutomationCustomReplayEvent ).
It would be helpful for working with RiaTest, if the documentation made this issues clear specifically for RiaTest.
maschatra (User)
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Logged Logged  
 
The administrator has disabled public write access.  
#2542
Re:Automating statusTextField in a custom panel 1 Month, 3 Weeks ago  
maschatra wrote:
First it is designed for qtp, hence there are is TEAFlexCustom.xml instead of the classinfo.xml

RandomWalk works fine with RIATest. Appropriate RandomWalkClassInfo.xml is supplied in RIATest installation so that you can try and see how it works.

It does not rely on the AutomationCustomReplayEvent which seems to be essential in our case.

No, it does not. It has custom delegate in RandomWalkDelegate.as that does instrumenting. See functions itemClickHandler() and replayAutomatableEvent().

RandomWalk does everything correct. Try doing the same for your custom component.

To get used to instrumenting it may help to first try and make sure everything works on RandomWalk sample and then proceed to your application.

Do not use AutomationCustomReplayEvent. This is not supported in RIATest. Sorry, it is my mistake that I initially failed to mention this. I was under the impression that you are using recordAutomatableEvent/replayAutomatableEvent pair of functions.
RIATest (Admin)
Admin
Posts: 1157
graph
User Online Now Click here to see the profile of this user
Logged Logged  
 
RIATest Team.
=====================
Please vote for RIATest and help it to be named the Best automated test tool for Flex here: www.automatedtestinginstitute.com/home/i...id=10&Itemid=183
 
The administrator has disabled public write access.  
Go to top