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

Some problems with Alert and Download dialogs

9 Answers 139 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Justin
Top achievements
Rank 1
Justin asked on 15 Jun 2010, 08:59 PM
Hello,

I am trying to find out if the dialogs on my site are displaying at the right times, and ran into a problem. When a dialog is supposed to appear, I place a "Handle 'Alert' Dialog" into the step window. I have about 5 of these. Once I run my test, everything visually appears fine; the Alert dialogs appear and then are closed as I would expect. However, the log of the test reads the following error for nearly every handle step:

Timed out waiting '5000' msec. for dialog to be handled '1'
InnerException:
System.TimeoutException: Timed out waiting '5000' msec. for dialog to be handled '1'
   at ArtOfTest.WebAii.Win32.Dialogs.BaseDialog.WaitUntilHandled(Int32 handleCount, Int32 timeout, Boolean resetHandleCount)
   at ArtOfTest.WebAii.Win32.Dialogs.BaseDialog.WaitUntilHandled(Int32 timeout)
   at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.DialogHandlerDescriptor.Execute(Browser browser)
   at ArtOfTest.WebAii.Design.IntrinsicTranslators.Descriptors.DialogHandlerDescriptor.Execute(IAutomationHost browser)
   at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep()

There seems to be a very high chance of this happening, but it does not happen for every Alert. A very similair error is also displayed for Download dialogs, but only if they are set to 'Cancel', they work fine if set to 'Save.' Unlike the Alert dialogs, the Download-Cancel dialogs seem to happen every time. Has anyone else had this problem, and if so do you know how to fix it?

9 Answers, 1 is accepted

Sort by
0
Missing User
answered on 16 Jun 2010, 12:25 AM
Hi Justin,

Thanks for the post and description. Unfortunately, the dialog handlers do not stack like the way you mentioned if they are of the same type.

So please only have one Alert or Download handler per test as one should be able to handle any dialog that is thrown by the test run.

But please let us know if the above does not resolve the problem, along with a description of the test scenario and dialogs launched as I would like to reproduce this on this end.

Sincerely,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Justin
Top achievements
Rank 1
answered on 16 Jun 2010, 02:11 PM
Hi Nelson,

Thanks for the help. Just to make sure I am clear here, the problem is with having multiple dialog handlers in the same test, correct? The test I am currently running is for invalid input, so the steps look something like this:

//Steps to get to the right page
Set 'Textbox' text in 'Some invalid input'
Press 'Enter' (1) time
Handle 'Alert' dialog
Set 'Textbox' text to 'Some other invalid input'
Press 'Enter' (1) time
Handle 'Alert' dialog
//Repeat for multiple inputs

As you might imagine, it would be convenient to handle these inputs in a single test, instead of creating a new test for each one. Can such a thing be done, or would it be easiest to just create them as separate tests to avoid dialog errors?

Thanks,
- Justin
0
Missing User
answered on 16 Jun 2010, 04:45 PM
Hello Justin,

Thanks for the extra description. So I rechecked this scenario and it looks like the multiple dialog handlers
is also supported like you mentioned. Sorry about that, I should have rechecked and not assumed the old implementation

I did run into the problem you mentioned. Can you try inserting a delay step after the test step the will throw the error dialog?

So from what I can tell of the sequence, after the Enter Key press, the error message will be thrown. Please insert the delay step after the Enter step with the 250 ms default value to see if that will stabilize the test.

All the best,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Justin
Top achievements
Rank 1
answered on 16 Jun 2010, 05:16 PM
Hello again,

I attempted to add the delays like you suggested, but it didn't seem to help. I also tried some longer ones (500 and 1000), but also without any luck. The problem does appear slightly less frequently, but doesn't disappear.

I would also like to mention that alot of these steps do involve javascript calls. For some of the boxes, rather then the Enter step, an "Invoke 'OnChange" event..." is used. I'm not sure if this makes a large difference or not, but thought I would mention it.

Thanks for the help so far,
- Justin
0
Missing User
answered on 16 Jun 2010, 05:45 PM
Hello again Justin,

Thanks for trying that, I'll log a bug for this as it seems this scenario is still not working reliably for me either.

So are you handling each dialog thrown the same way? And you wanted to count the number of dialogs thrown to make sure the number of dialogs thrown is correct?

As a possible work around, please disable all the dialog hander steps except for the last one. Then, please insert the following custom code step before the last dialog hander step.

[CodedStep("Custom Alert Dialog Log Message")]
public void MyCustomStep()
{
Log.WriteLine("Number of Alert Dialogs Handled: " + Manager.DialogMonitor.Dialogs[0].HandleCount.ToString());
}

The above code should write to the Test Log results the number of times the Dialog Hander handled an Alert message. Alternatively, you can Assert on Manager.DialogMonitor.Dialogs[0].HandleCount equals some expected value.

Best wishes,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Justin
Top achievements
Rank 1
answered on 16 Jun 2010, 07:14 PM
Hello again,

I am afraid that the coded step you supplied did not solve the problem. While the dialogs still appear to be handled just fine, the logged number is typically always lower then the actual handled alerts and not consistent.

One advantage of using this code however is that the delays while the system waiting on the alert timeout have dissappeared.

- Justin
0
Missing User
answered on 16 Jun 2010, 07:37 PM
Hi again Justin,

That sounds strange, sorry that the code did not work for you. But I understand correctly, the error:

System.TimeoutException: Timed out waiting '5000' msec. for dialog to be handled '1'

is now gone after adding the code and the multiple alert handler steps are now working?

If so and if you don't mind, please try this as the work around and perhaps work with less code then what I sent or even see if no code works. It maybe just having to call the custom code behind file resolves the problem

Kind regards,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Justin
Top achievements
Rank 1
answered on 16 Jun 2010, 08:52 PM
Hello,

What I have right now is a single event handler after the last dialog is expected to be seen. This will handle all dialogs with no error messages, While this isn't exactly the functionality I was hoping for, it will work for what I am trying to achieve. Thanks for you time, and I hope you are able to figure out what the problem with multiple dialog handlers is.

- Justin
0
Missing User
answered on 16 Jun 2010, 10:49 PM
Hi again Justin,

It is indeed useful to test that each of the dialogs are being launched and handled. I'll definitely log a bug for this and we'll look into what maybe the problem. Thanks for the post and we'll look to have this fixed.

Greetings,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Justin
Top achievements
Rank 1
Answers by
Missing User
Justin
Top achievements
Rank 1
Share this question
or