asp:UpdatePanel help needed

4 posts, 0 answers
  1. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 21 Sep 2010 Link to this post

    I have a page the displays a panel this an updatepanel inside it.

    this panel has a link called check status where the user will click this link to check on the cuurent status of the file conversion to pdf, then the conversion is complete the user will be redirected to the preview screen.

    so basicly I need the tester to wait on this panel till the coversion is complete before preceding

    any help would be appreciated
  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 22 Sep 2010 Link to this post

    Hello Andrew,

    Let me see if I understand correctly... you have a want to craft a test in which:

    1) A file is uploaded intended to be converted to PDF
    2) After the upload is complete nothing is updated on the screen to indicate the progress or completion of the conversion. The display remains static.
    3) A link must be clicked to get the status of the conversion. If not done, some sort of "in progress message" is returned.
    4) When the conversion is done the preview of the conversion is displayed instead of the "in progress message".
    5) The WebAii test must repeatedly perform step 3 until step 4 is returned.

    Do I have that sequence correct?

    Implementing a looped wait for like this must be implemented in code. I would tackle this by
    1. Recording clicking on the link.
    2. Record a verification of the "In progress" message.
    3. Convert steps 1 & 2 to code.
    4. Merge the two coded steps into one and wrap them in a loop.
    5. Make the loop simply exist when the verification step fails... don't let it throw an exception which will cause the test to abort.
    Do you need assistance coding this up? If so, send me a WebAii test (place the .aii and .resx file into one .zip file) attached to a new support ticket with steps 1 and 2 recorded. I'll do the conversion to code and wrap it into a loop for you.
    Best wishes,
    Cody
    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
  3. Andrew
    Andrew avatar
    125 posts
    Member since:
    Sep 2008

    Posted 23 Sep 2010 Link to this post

    I actually got it to work, I did a do while loop untill I got a 'completed' status it the conversion status label,

    I had to make a call th the thread sleep method to slow the loop down but it all worked in the end.

    here is my code:

    HtmlSpan lblConversionStatus = Find.ById<HtmlSpan>("ctl00_ContentPlaceHolder1_ElectronicSubmission1_emCheckPDFStatus_lblConversionStatus");
                lblConversionStatus.Wait.ForVisible(1200000); //120 sec

                do
                {

                    System.Threading.Thread.Sleep(new TimeSpan(0, 0, 5));

                    Pages.EZoneResumePack.ContentPlaceHolder1ElectronicSubmission1EmCheckPDFStatusLinkButton1Link.Click(false);
                    lblConversionStatus = Find.ById<HtmlSpan>("ctl00_ContentPlaceHolder1_ElectronicSubmission1_emCheckPDFStatus_lblConversionStatus");

                }
                while (lblConversionStatus.TextContent.ToUpper() != "COMPLETE");



    if you have any suggestions I would love to hear them
  4. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 23 Sep 2010 Link to this post

    Hello Andrew,

    That actually looks pretty good! I'll offer some suggestions for you to optimize it a bit more.

    HtmlSpan lblConversionStatus = Find.ById<HtmlSpan>("ctl00_ContentPlaceHolder1_ElectronicSubmission1_emCheckPDFStatus_lblConversionStatus");
    lblConversionStatus.Wait.ForVisible(1200000); //120 sec

    These two lines of code can be easily replaced by a standard Wait.ForVisible step. You can add such a step via the DOM explorer. See this training video on how to do this. Once you do that you'll have a new Pages.EZoneResumePack.<something> to use in place of lblConversionStatus in the rest of the code.

    Next I would add a timeout using a StopWatch and a check for timeout like this:

    Stopwatch sw = new Stopwatch();
    sw.Start();
    do
    {
     
        System.Threading.Thread.Sleep(5 * 1000);    // Sleep for 5 seconds
     
        Pages.EZoneResumePack.ContentPlaceHolder1ElectronicSubmission1EmCheckPDFStatusLinkButton1Link.Click(false);
        lblConversionStatus = Find.ById<HtmlSpan>("ctl00_ContentPlaceHolder1_ElectronicSubmission1_emCheckPDFStatus_lblConversionStatus");
     
    }
    while (!lblConversionStatus.TextContent.Equals("complete", StringComparison.InvariantCultureIgnoreCase) &&
        sw.ElapsedMilliseconds < 5 * 60 * 1000);    // Wait 5 minutes for conversion complete
     
    Assert.IsTrue(lblConversionStatus.TextContent.Equals("complete", StringComparison.InvariantCultureIgnoreCase),
        "Time out occurred waiting for conversion to complete");

    I made a couple of other very minor code tweaks you'll probably pick up on.

    Greetings,
    Cody
    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
Back to Top