Forum Discussion

PeterMitcham's avatar
PeterMitcham
Occasional Contributor
9 years ago

Dialog appears that halts continuation of test code

Hi

 

I have a syncfusion grid where i am exporting its contents via using the export internal method. When calling this method a seperate modal dialog appears with a few options.

 

At this point the test hangs and will not continue until it times out, and an error is generated.

 

Is there a way around the method hanging testcomplete like a /nowait option?

 

Many thanks

 

Peter Mitcham

  • Colin_McCrae's avatar
    Colin_McCrae
    9 years ago

    A drag and drop isn't ideal. But it shouldn't be too bad to implement?

     

    But at least you have a few options which all sound better than it hanging completely.

     

    I knw what you mean about the grids. I think I've found 3 or 4 different versions of DB grid in use in the Delphi app I'm working on. Mostly pretty standard, but they have added a few extras here and there. Same with the TreeView objects. They seem to like messing about with those as well.

     

    Keeps life interesting I guess!

13 Replies

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    hi,

    you should use an application of  WaitAliasChild() that is in the samples of TestComplete.

    it waits the child of an object for a specific time, 

    could you tell me what kind of script did you choose and could you paste the mapped name of any child of the window (button,...)

    • PeterMitcham's avatar
      PeterMitcham
      Occasional Contributor

      Hi

       

      That suggestion would work if the line of code that called the internal method had been executed and testcomplete moved onto the next line.

       

      The line I am running is "Call Aliases.gridData.export"

       

      The problem here is that the once line is run a dialog appears and testcomplete hangs. TestComplete will not execute any further lines of code until the dialog has been closed. I tried to stop the script with the dialog open and testcomplete would not stop it until i manually closed the dialog.

       

      Many thanks

       

      Peter Mitcham

       

       

      • m_essaid's avatar
        m_essaid
        Valued Contributor

        try to do the following :

        - run your tested app as normaly and make the dialog appears.

        - use the Object Spy to get the name of the "ok" button (or "close" or any button similar)

        - map the name of this button

        - then use the mapped name : wait to the child object "button" to wait the dialog for ten ou more seconds and then click to the close button.

         

        type in the help "WaitAliasChild"

         

        I used the example in this help to create a function that need the following parameters :

         

        WaitAliasChildFunction(Object: AliasObj, Child: string, Time: integer)

    • rrivest's avatar
      rrivest
      Contributor

      I had a similar issue with script completly freezing because of a Browser security dialog that was modal...

       

      The Runner method helped me catch that dialog and dispose of it properly so script could continue...

       


      // Checks whether the specified URL is valid

      function VerifyWebObject(link, expectedObjectData)

      {

      var myProcess = Sys["FindChild"]('ProcessName','TestExecute',1);

      if (!myProcess["Exists"])

      var myProcess = Sys["FindChild"]('ProcessName','TestComplete',1);

      var ellapsed = HISUtils["StopWatch"];

      ellapsed["Start"]();

       

      try {

      // Do something

      var httpObj = Sys["OleObject"]("MSXML2.XMLHTTP.3.0");

      httpObj["open"]("GET", link, false);

      var w = Runner["CallObjectMethodAsync"](httpObj,"send");

      //httpObj["send"]();

      }

      catch (e) {

      // Posts an exception message to the test log

      Log["Error"](e["description"]);

      return false;

      }

      finally

      {

      while (httpObj["readyState"] != 4) {

      var thisWindow = myProcess["WaitWindow"]("#32770", "*", 1,100);

      if (thisWindow["Exists"]) {

      Log["AppendFolder"]("Capture de popup");

      var thisImage = thisWindow["Picture"]();

      Log["Picture"](thisImage,"Screen capture", "Ready State = 1");

      var thisBtn = thisWindow["FindChild"]('Name','["Window"]("Button", "*Oui", 2)',5);

      if (thisBtn["Exists"] == false) // Environnement anglais

      var thisBtn = thisWindow["FindChild"]('Name','["Window"]("Button", "*Yes", 2)',5);

      thisBtn["Click"]();

      Delay(500); // Pour donner le temps de poursuivre le chargement après la fermeture du popup.

      Log["PopLogFolder"]();

      }

      }

      }

      ellapsed["Stop"]();

      try {

      // Do something

      var content = httpObj["responseText"];

      }

      catch (e) {

      // Posts an exception message to the test log

      Log["Error"](e["description"]);

      return false;

      }

       

      switch (httpObj["status"])

      {

      case 200:

      if ( content != expectedObjectData)

      {

      Log["Message"]("Temps réponse : "+ellapsed["ToString"]());

      Log["Message"]("Le lien " + link + " est valide", aqString["SubString"](httpObj["responseText"],1,200));

      return true;

      }

      break;

      case 302:

      if (content != expectedObjectData)

      {

      Log["Message"]("Temps réponse : "+ellapsed["ToString"]());

      Log["Message"]("Le lien " + link + " est valide", aqString["SubString"](httpObj["responseText"],1,200));

      return true;

      }

      break;

      default:

      Log["Message"]("Temps réponse : "+ellapsed["ToString"]());

      Log["Warning"]("Le lien " + link + " est invalide et retourne un status: " + httpObj["status"], httpObj["responseText"]);

      return false;

      }

      return true;

      }