Forum Discussion

AssiaDerias's avatar
AssiaDerias
Occasional Contributor
9 years ago

How can I apply chekpoint on the popup message in testcomplete

Hi;

I'm testing a web application realised with .net and Angular Js,  whith Testcomplete V12.

In my test i would apply a chekpoint   on the pop up message that appear for few second (2-3 second) in the web page,  that  confirm  add or delete  record. and desappear after that (its a Dynamic object)

Please are there a built in or operation that  perform this check point in testcomplete v12, since it support Angular js.

 

Thank you in advance

 

PS: you have the screen shot of my  Pop up message in attachements bellow.

thanks

10 Replies

  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 1 rankChampion Level 1

    Hi,

     

    Something to add to what was said by Robert:

    Exact solution on how to do a verification depends on the actual design and behaviour of your tested application. You may need to spend some time to figure this out or/and talk with developers and work-out an approach that will work for you and them.

    Verification of dynamic objects on the web page is one of the most complex and unstable activities. The case is that in order to do a validation, TestComplete must: a) find the object (this requires some time) and b) process the found object as needed (and this also requires some time). The above two actions must be done within the life span of the tested object, otherwise the object either will not be found or there will be an error if the object is destroyed while TestComplete tries to access some of its properties.

    Don't forget, that all the above happens in the concurrent environment and that Windows is not a realtime OS. This means that the less your test machine is loaded with the processes that are not required for the actual test, the higher the chances that the browser will have enough time to create and display required object and that TestComplete will have time to find and process this object.

     

    As for the possible implementation:

    If the popup message always exists on the page but is just made hidden or visible, then your task is easier. You may get a reference to the popup beforehand and than use a call to the WaitProperty() method (see help for more details) to wait for the message to become visible within some time interval. (Note, you need to investigate or ask developers about what must be checked to guarantee that the message is visible because different (inconsistent) methods may be used by developers to hide and display the element on the web page.)

    If the popup message does not exist all the time on the page but is created dynamically at some moment of time, then the task is more prone to false results. In this case you must wait for the object existence for some time (via FindChildEx() or WaitAliasChild() methods) and proceed correspondingly.

    Much better option for both cases is to talk to developers and ask them to implement some hidden property on the page and set this property to, say, false on page load and switch it to true after the message was shown. In this case, as the property exists on the page all the time, you will just need to check its value from your test code. The only disadvantage of this approach is that it is not guaranteed that the message was actually displayed on the screen. Your best action in this case is to wait for the property value change in the loop and within this loop check if the message is displayed on the screen. If the message was displayed, then everything is fine. If the value of the property was changed from false to true but test code did not detect message on the screen, you may post a warning to test log to draw your attention to this fact and later manual investigation.

    • AssiaDerias's avatar
      AssiaDerias
      Occasional Contributor

      Thank you  Alex;

      As Robert advice me in his last message to record action and click on the pop up message, it does'nt work for me that give the same name mapping (The webpage object).

      I try your idea to use FindChildEx and i perform the script  bellow

       

      function ConfirmerSuppProfile(){

      var page = Sys.Browser().WaitPage("*");

      var prop=["ObjectType","contentText","VisibleOnScreen","Enabled"];

      var values = ["Panel","Profile 'CONSULTATION' supprimé","True","True"];

      var depth = 5;

      var popupmsg = page.FindChildEx(prop,values,depth,true,1000);

      if(popupmsg.Exists)

      Log.Message("Profile consultation supprimé");

      else

      Log.Error("The object was not found");

      }

       

      when i chage the page it give me the same result!! :(

       

      Is it possible to use the generated source of the web page,  and how i can process, because i don't find any think related to the pop  up message

       

      Thanks 

       

       

       

       

       

       

      • AlexKaras's avatar
        AlexKaras
        Icon for Champion Level 1 rankChampion Level 1

        Hi,

         

        > when i chage the page it give me the same result!!

        Not sure what is 'the same result' and what actual result is, but a quick note about this line of code:

        > var values = ["Panel","Profile 'CONSULTATION' supprimé","True","True"];

        The last two values relate to the "VisibleOnScreen" and "Enabled" properties both of which are boolean while your code provides strings.

        I would change the line to

        var values = ["Panel","Profile 'CONSULTATION' supprimé",True,True];

        and check whether it will help.

         

         

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    If you can map the object, we can check it. :)

    So, essentially, here are your steps.

    1) Using NameMapping and Aliases, make sure you map and capture the pop-up with all the appropriate identification details

    2) Rather than recording, you will need to create an Object checkpoint to detect, after a certain activity, if the pop-up "exists" or is "visible" depending upon how things are implemented.

    3) You might want to detect that "Dynamic" factor of the pop-up going away so, after you verify that it exists, insert some sort of delay or while loop or something to wait until the object no longer exists or is visible. This is your check, then, that the object has been re-hidden.

    • AssiaDerias's avatar
      AssiaDerias
      Occasional Contributor

      Thank you for your answer

      But when i map the  pop up  message and  check it in  name mapping  i realise that it is all the eb page page .

      I have developpes a script that  ensure tne chek of the pop up message can you verify  it for  me

       

      function CheckProfile(){

      if(Aliases.browser.pageIdzadmintcProfil.pageCreerProfil.panelModalContent.WaitProperty("VisibleOnScreen",true,20000))

      {

      Log.Picture (Aliases.browser.pageIdzadmintcProfil.pageCreerProfil.panelCreerProfil.panelModalContent," Profile CONSULTATION supprimé ");

      }

      }

       

      I have attached a screen shot of may name mapping on the pop up message

       

      Thank you for answer

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        That looks good from the best I can understand for the object.  You check it's visibility then you log it and you're done.  That SHOULD do what you're looking for.

        As for your mapping, that's hard to say exactly what is better to do. This is something you may need to tweak but, if the code below is performing the task you want, than that's usually the best indicator of a well written test.