This is a migrated thread and some comments may be shown as answers.
verify if FileUpload Dialog open?
5 Answers 38 Views
This is a migrated thread and some comments may be shown as answers.
Radhika
Top achievements
Rank 1
Radhika asked on 03 Dec 2012, 01:05 PM

I have a scenario where the file upload dialog doesn't open after adding a certain number of files.

How do i verify that the file upload dialog has not opened ?


Thanks
Radhika

5 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 04 Dec 2012, 08:25 PM
Hello Radhika,

If you want to verify that the dialog is not showing up, you need to remove all "Handle 'FileUpload' dialog" steps and handle the dialogs with a coded step. Here's what you need to do:
    1. Define a FileUploadDialog in the code behind.
FileUploadDialog dialog;
     
    2. Before the Click step that triggers the dialog, add a new coded step, create a dialog and add it to the DialogMonitor. 
dialog = new FileUploadDialog(ActiveBrowser, String.Empty, DialogButton.CANCEL);
Manager.DialogMonitor.AddDialog(dialog);

    3. After the Click step that triggers the dialog, add a coded step that will handle the dialog if it shows up. If it doesn't, then you'll have 1 dialog in the Dialogs collection. 
[CodedStep(@"New Coded Step")]
public void WebTest1_CodedStep1()
{
    try
    {
        dialog.WaitUntilHandled(5000);
    }
    catch(Exception)
    {
        Log.WriteLine(Manager.DialogMonitor.Dialogs.Count.ToString());
        if (Manager.DialogMonitor.Dialogs.Count > 0)
        {
            Log.WriteLine("This Dialog doesn't show up!");
        }
    }
}

See this video demonstrating the execution. The sample project is also attached. Please give it a try and let me know if you need further assistance.
                                   

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Radhika
Top achievements
Rank 1
answered on 06 Dec 2012, 12:56 PM
Thanks for your response. It worked !
0
Plamen
Telerik team
answered on 06 Dec 2012, 02:50 PM
Hello Radhika,

I am glad to hear it! Please contact us again if you have further problems.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Radhika
Top achievements
Rank 1
answered on 06 Dec 2012, 06:28 PM

I have seen another issue with this. Sometimes the text doesn't get typed into the file name textbox and it just hangs!...so the test freezes and does not return the control back to the next step. This will fail all other tests that are run after this test.

Here are my coded steps, If there is something i can add to take care of the above issue please let me know.


[

 

CodedStep(@"Before clicking the Attach Button for adding Test File 1")]

 

 

 

public void LoginAsAdminAndCreateNewNoteManagementTemplate_CodedStep17()

 

{

dialog =

 

new FileUploadDialog(ActiveBrowser, GetExtractedValue("ExtTestFileName1").ToString(), DialogButton.OPEN);

 

Manager.DialogMonitor.AddDialog(dialog);

}

[

 

CodedStep(@"After clicking the Attach Button for adding Test File 1")]

 

 

 

public void LoginAsAdminAndCreateNewNoteManagementTemplate_CodedStep18()

 

{

 

 

try

 

{

Manager.DialogMonitor.Start();

ActiveBrowser.WaitUntilReady();

Log.WriteLine(

 

"COUNT = " + Manager.DialogMonitor.Dialogs.Count.ToString());

 

 

 

Assert.IsTrue(Manager.DialogMonitor.Dialogs.Count == 1, "The File upload dialog was OPEN");

 

}

 

 

catch (Exception)

 

{

Log.WriteLine(

 

"In Exception COUNT = " + Manager.DialogMonitor.Dialogs.Count.ToString());

 

 

 

Assert.IsTrue(Manager.DialogMonitor.Dialogs.Count == 1, "The File upload dialog was NOT OPEN");

 

}


Thanks
Radhika

0
Plamen
Telerik team
answered on 06 Dec 2012, 07:46 PM
Hello Radhika,

I have tried multiple times, against different sites, but I wasn't able to reproduce the issue with our latest official SP release(2012.2.1204). Please try to upgrade Test Studio to our latest version and see if the problem persists. You can download it from your Telerik account here: Public URL.

If you continue to have difficulty, we'll need to reproduce the issue locally in order to fix it. Please provide us with a copy of your test and access to your application. If it is not possible to grant us access to your application, please take a Fiddler trace using FiddlerCap and send it to us in a zip file. A Jing video demonstrating the issue may also help us to better understand what is happening. If you deem that information too sensitive for this forum, you can create a support ticket and attach it there. Thanks for providing the information we need to best assist you.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Asked by
Radhika
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Radhika
Top achievements
Rank 1
Share this question
or