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

WPF Aplication - handling dialog

6 Answers 193 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Maylad
Top achievements
Rank 1
Maylad asked on 04 Feb 2019, 02:48 PM

Hi, 

My problem concerns handling OpenFileDialog. I have a TestMethod that consists of 3 separate methods (e.g. A,B and C) which are doing next steps of whole process. Step C should handle OpenFileDialog and it does this when acts as a separate test but when I run everything in one test, the step C can't handle OpenFileDialog. Sometimes it happens that it will catch and handle this window, but in most cases it throws a exception (System.TimeoutException:...). I tried to use in different combinations Thread.Sleep but it doesn't work. Can it depend on the duration of the test? When I run each test individually, everything is fine all works as it should. 

var dialog = OpenFileDialog.CreateOpenFileDialog(Manager.Current.ActiveApplication, button, path, windowTitle);

Manager.Current.DialogMonitor.AddDialog(dialog);
Manager.Current.DialogMonitor.Start();
ClickAndWait(buttonClickName);
dialog.WaitUntilHandled();
Manager.Current.DialogMonitor.Stop();

 

I would like to emphasize once again that everything works when it performs as a single test
Best Regards

6 Answers, 1 is accepted

Sort by
0
Maylad
Top achievements
Rank 1
answered on 05 Feb 2019, 08:12 AM
I also noticed similar behavior performing C test in loop. It's work correctly two times, but for the third time it can't handle the dialog. What could be the reason?
0
Elena
Telerik team
answered on 07 Feb 2019, 04:04 PM
Hi Maylad,

Thank you for the shared details on the encountered issue. 

Since the dialog is being handled successfully in some occasions, the issue doesn't seem to be related to the dialog itself. Therefore I suspect this could be some kind of synchronization issue - probably the application responds a bit slower when there are more tests executed in sequence. And although this is an assumption only, you could try the following and verify if it will be helpful: 
1. Please increase the initialization time for the dialog to 5000 ms, for example. 
2. To do that, you can include the following piece of code in your current dialog handling code as listed below: 

var dialog = OpenFileDialog.CreateOpenFileDialog(Manager.Current.ActiveApplication, button, path, windowTitle);
 
// add the following timeout
dialog.InitializationTime = 5000;
 
Manager.Current.DialogMonitor.AddDialog(dialog);
Manager.Current.DialogMonitor.Start();
ClickAndWait(buttonClickName);
dialog.WaitUntilHandled();
Manager.Current.DialogMonitor.Stop();


In case this is still not changing the behavior, can you please generate the application log file during the faulty execution. Please clear it before you start the run, so that the log contains records, relative to the particular issue. It could be attached to the current thread zipped. 

In case there is any possibility to provide us the application under test along with the tests in question, we will be able to test this on our end and possibly locate the root cause of the misbehavior. Please be informed that we could convert the current public forum thread to a private one to avoid exposing any confidential information. 

Thanks in advance for your cooperation. 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Maylad
Top achievements
Rank 1
answered on 12 Feb 2019, 08:15 AM

Thank you Elena!

Unfortunately, this solution doesn't work for me. I have tried to set different values in dialog.InitializationTime, but still nothing. At the beginning it worked a few times - maybe 3, but later behavior is the same like without this property. I'm beginning to suspect that problem is located in bartender application (QR generator) which call dialog. This is not a typical Windows dialog, but a dialog hosted by bartender and printing to PDF. I will try maybe to solve this in a different way. Anyway, thank you again!

 

Regards!

0
Elena
Telerik team
answered on 14 Feb 2019, 04:49 PM
Hello Maylad,

I am sorry to hear the proposed solution did not help you solve the misbehavior you have observed. 

In case you decide to get back to this, I will be glad to assist further. And since I also suspect this could be specific for the particular application under test, I will appreciate if you can share this or a sample one with me. That way I will be able to explore the specifics of the dialog and continue the investigation. 

Anyways, it will be also beneficial, if you manage to find a proper workaround on your own. In both cases, if you have any questions in regards Test Studio and the Testing Framework, please let me know. 

Thanks in advance for your understanding. 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Mahesh
Top achievements
Rank 1
answered on 10 May 2019, 03:21 PM

Hi Elena,

 I am trying Telerik Testing Framework for Automating WPF application's functional tests. Do you have any samples to start with which follows Page Object model / pattern for WPF application.

 

Thanks.

0
Plamen Mitrev
Telerik team
answered on 13 May 2019, 02:01 PM
Hello Mahesh,

I created a sample WPF application and a test project against it. It contains a simple test method that clicks on a button. Please find the mentioned projects attached to my reply.

For more details, we have provided the necessary resources and guidelines in the Getting Started article. More specifically, please check the WPF UI Automation guide and examples.

I hope that the above information and examples will help you start using Telerik Testing Framework for your automation. In case you need further assistance, do not hesitate to write back.

Regards,
Plamen Mitrev
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Maylad
Top achievements
Rank 1
Answers by
Maylad
Top achievements
Rank 1
Elena
Telerik team
Mahesh
Top achievements
Rank 1
Plamen Mitrev
Telerik team
Share this question
or