I wrote user code in C# which wait for a progress dialog to pop up and then watches its progress bar until the dialog closes, and throws an exception if the progress doesn't change over a period of time. The first few lines of this function are as follows:
Code: Select all
public static bool WatchProgress(RepoItemInfo progressInfo, ..., Duration initialTimeout, ...)
{
var dlgInfo = new RepoItemInfo(progressInfo.ParentFolder, "Progress Dialog", ".", initialTimeout, false);
Report.Info("Progress", string.Format(@"Watching progress dialog ""{0}""", progressInfo.ParentFolder.ToString()));
var dlgAdapter = dlgInfo.CreateAdapter<Unknown>(false, initialTimeout);
if (dlgAdapter == null)
{
Report.Info("Progress", "The progress dialog was removed before it could be found (or it has never existed)");
return false;
}
...
}
The problem is that this occasionally runs into the 'return false;' even though, in my opinion, it shouldn't. In the report I see those lines:
Code: Select all
19:11:57 Info Progress Watching progress dialog "DBMCommonRepo.DBM_Dialogs.Copying_Dialog"
19:12:02 Info Progress The progress dialog was removed before it could be found (or it has never existed)
I assume this occurs when the dialog pops up a moment (a few millisecs maybe) after the call to 'CreateAdapter'. Since these events occur asynchronously to each other, there is a chance that it works or that it fails. I should mention that I recently upgraded from Ranorex 10.1.3 to 10.5.4 and that these failures have become much more frequent.
Is it my misunderstanding of 'CreateAdapter' or is it a bug in Ranorex (or neither)? What can I do to make this test more stable?
Thank you
Hans