I have an application that I'm testing. I have TC click a button on the main window to open a new window that has an text input box and a button that when clicked creates a new design. At this point, the cursor turns to an hour glass. After the design is created, this design window goes away and I'm back to the main window. If there was an error with the text input, the design window stays up with the box highlited and the cursor back to a pointer. I repeat this process for different inputs to the text box. Now, the time it takes to create a design varies, so I can't just delay the test script 10 seconds, it has to be smarter.
I thought TC would wait for an application to stop being busy before continuing on with the test, but it doesn't. It waits for a little bit, but then just continues even though the application is in a busy state. So I tried to force TC to wait.
Log["Message"]("Waiting for design to be created...");
// Done trying to create design, but design window is still up so there must be an error.
The problem is that TC doesn't wait for the application to not be busy anymore. If the design creates within a couple of seconds, it works fine. But if it takes longer, I see in the playback info TC is waiting for "WinFormsObject NewDesign", then goes to waiting for "Application" object, then goes to waiting for "WinFormsObject MainWnd", then goes to trying to click DesignButton on the MainWnd. But I can see that the application is still busy and the NewDesign window is still up.
How do I get TC to wait while the application is busy?
RE: Can't get TC to wait for app to become un-busy...
The mouse pointer is defined by the window under the pointer. However, if the corresponding application does not respond, TestComplete cannot retrieve the cursor state. In this case, you can use the script used by Brandon to make TestComplete pause the script execution until the tested application responds again:
var p1 = Sys.Process("MyProcess");
var dotNetProcess = dotNET.System_Diagnostics.Process.GetProcessById_2(p1.ProcessID);
... // Perform further actions
To make the script work, please follow the instructions below:
In project properties, go to 'CLR Bridge' and add System.dll (either version 1.0 or 2.0) by using either the 'Browse Files' button or the 'Browse GAC' button (see the Calling Functions From .NET Assemblies help topic for more information). This will allow you to use .NET methods and properties.
I hope this helps.
-- Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️