This is a migrated thread and some comments may be shown as answers.

Timing issues testing WPF app

1 Answer 30 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Danielle
Top achievements
Rank 1
Danielle asked on 28 Oct 2014, 06:46 PM
Hi,

I am using Test Studio to write tests for a WPF client app that communicates with a server.  There is a lot of delay between steps due to server communication, so I'm trying to get rid of all arbitrary sleeps and key off other UI elements to synchronize my test steps.  I'm running into a lot of issues with context menus.  Here is my current approach:

1) Find the element by XamlFindExpression that I want to right-click for a context menu.
2) hover over the element with User.HoverOver()
3) Sleep 200 ms
4) issue a User.Click(MouseClickType.RightClick)
5) refresh the visual trees of my window with win.RefreshVisualTrees()
6) try to find the context menu item by name: win.Find.ByExpression(new XamlFindExpression("XamlTag=MenuItem", "Name=menuItemName");

This works "some" of the time.  However, I have my find strategy set to AlwaysWaitForElementsVisible and timeout set to 30000 ms.  However, when this fails, it returns failure right away, it doesn't wait for the menu item to show up.

Is there a better way to do this?  What am I doing wrong?

Thanks!
Danielle

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 31 Oct 2014, 07:02 PM
Hi Danielle,

The approach you describe sounds reasonable. Without knowing exactly what the error is when "it returns failure right away" it's impossible to say why it isn't working as expected. Can you give us the error log when it does fail?

Having an actual copy of your code would help a little bit. It would help even more if it would be possible to get a copy of your WPF application, allow us to run it on our machines then run your test and diagnose why it's not working as expected. Then we can come up with a solution for you.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Danielle
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or