I am testing a WPF App with Telerik Test Studio. My App is started from a ClickOnce shortcut. Here are the steps that i did:
1 - Start Test Studio and create a WPF test
2 - Add a Code Step in my WPF test
3 - Using the snippets in http://docs.telerik.com/teststudio/user-guide/code-samples/wpf/connect-to-running-wpf-app.aspx to connet to my running WPF App:
// close the mock app
ActiveApplication.Quit();
string appPath = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), @"\MyWPFApp\DEVELOPMENT\MyWPFApp.appref-ms");
System.Diagnostics.Process.Start(appPath);
var runningApp = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName == "MyAPP");
while (runningApp.Count() == 0)
{
runningApp = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName == "MyAPP");
}
Manager.ConnectToApplication(runningApp.FirstOrDefault());
while(!Manager.ActiveApplication.Process.WaitForInputIdle())
Manager.ActiveApplication.MainWindow.RefreshVisualTrees();
ActiveApplication.WaitForWindow("My App");
All these steps work fine!
I'm trying to figure out how to attach the recorder to the running Wpf-App Window after the code step.
Thanks