verify if FileUpload Dialog open?

6 posts, 0 answers
  1. Radhika
    Radhika avatar
    12 posts
    Member since:
    Feb 2011

    Posted 03 Dec 2012 Link to this post


    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
  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 04 Dec 2012 Link to this post

    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
  3. Radhika
    Radhika avatar
    12 posts
    Member since:
    Feb 2011

    Posted 06 Dec 2012 Link to this post

    Thanks for your response. It worked !
  4. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 06 Dec 2012 Link to this post

    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
  5. Radhika
    Radhika avatar
    12 posts
    Member since:
    Feb 2011

    Posted 06 Dec 2012 Link to this post


    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

  6. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 06 Dec 2012 Link to this post

    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
Back to Top