Hi all, I need to handle a special case in my application in which I have a dialog opened and click on button “Save” which makes a process… so it shows a window message saying “in progress” or something like that… only when the dialog disappears the application is ready to make any other action.
For other tests I waited for a “result image” which appeared once the process was done. However, in this case, there is no result image or change in the UI that could tell me the process is done, except the message window “in progress” disappears.
Then, to solve this problem I wanted to add code that says:
wait until ImageFound(“inprogress”) is false
However, I’ve seen some cases in the application in which it gets hung and the message “in progress” never disappears. In this case, the line of code above will get hung, then both the application and the Eggplant test
case will get hung!
Then, to avoid this infinite loop I wanted to add one more condition like:
wait until ImageFound(“inprogress”) is false and currentTime is less than or equal to timeout
However, I dont know how to make something similar to Time.Now from other languages, to get the initial time and time running?
Is there something like Time.now in Eggplant?
Do you suggest a better solution to add control to these lines of code?
Hi guys, thanks for the answers. I tried the second one and for some reason it did not work for me. I could see “the time” provides you the hour:minutes. Then, I tried with now, which returns timestamp. I tried the following:
put now + timeoutInSeconds into stopTime
wait while imageFound("inProgress") and now is earlier than stopTime
It worked just as expected, thanks for both suggestions
Just a note of clarification on ‘the time’: Date and time values in SenseTalk embody both a value representing an instant in time and also a display format, so there is sometimes “more there than meets the eye”. In fact, ‘the time’ function provides a very precise value just like ‘now’ does. Both values are actually more precise than they appear (to a fraction of a second).
You can see this by running the following command, which will show a very small fraction of a second as the difference in time between when the two expressions are evaluated:
put now - the time
So your code should work just the same using either ‘the time’ or ‘now’.