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

Invoke OnChange event hangs if Alert appears

1 Answer 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Denis
Top achievements
Rank 1
Denis asked on 20 Aug 2014, 08:31 PM
Hi Telerik Support Team,

In our application we have the following scenario which need to be verified: 
User enter a value into some input text box and change focus to another control. After verification JavaScript alert appears on the screen.

In code it looks like:

01 var alertDialog = AlertDialog.CreateAlertDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
02 Manager.Current.DialogMonitor.AddDialog(alertDialog);
03 Manager.Current.DialogMonitor.Start();
04 DateInputBox.Focus();
05 DateInputBox.Value = "01/01/20014";
06 DateInputBox.InvokeEvent(ScriptEventType.OnChange);
07 DateInputBox.InvokeEvent(ScriptEventType.OnBlur);
08 alertDialog.WaitUntilHandled(15000);

During line 06 execution JavaAcript Alert appers and script hangs on the 06 line for a long time. The only one solution is to stop test execution. 

Do you have any suggestion how to implement the scenario?

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 25 Aug 2014, 06:41 PM
Hello Denis,

The only solution I can think of is multi-threading. Put lines 4 - 7 into a worker thread that is spawned by the main thread. The main thread can also pass it a parameter pointing to the DateInputBox object so the worker thread doesn't have to look this up, it simply operates on the object passed into the thread as a parameter. Keep the WaitUntilHandled in the main thread which will execute concurrently with the worker thread that's setting the value and invoking the events.

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