Forum Discussion

hannecroonen's avatar
hannecroonen
Contributor
2 years ago
Solved

Object lookup is acting strange

Hi all,

 

I have a question regarding object lookups;

I am using this in my tests since I have to check if certain windows are showing or not at the right time.
To reduce my code duplication I did this using object lookups as following;

var windowPaths = {
    "vat rates": AddonHost.VATRatesWindow,"adjust dimensions": function () {
      return logiComWrapper.confirmationWindow.message.Caption.includes(
        "ventilation"
      )
        ? logiComWrapper.confirmationWindow
        : Log.Error("The window caption is not correct");
    },
    "project management import": function () {
      return AddonHost.projectImportWindow.selectBtn.Caption.includes("Project")
        ? AddonHost.projectImportWindow
        : Log.Error("The window caption is not correct");
    },
    "position management import": function () {
      return AddonHost.projectImportWindow.selectBtn.Caption.includes(
        "Position"
      )
        ? AddonHost.projectImportWindow
        : Log.Error("The window caption is not correct");
    },
    "project estimation data": function () {
      while (reynaPro.progressWindow.ProgressDialog.Exists) {}
      return logiComWrapper.estimationOptionsWindow;
    },
    "free cost": AddonHost.addWindow
}

windowPaths[windowName.toLowerCase()]

This is only part of the object lookup, it is much bigger and it seems that whenever I use this it is still running through the complete lookup and searching for all these items whilst many of them are not existing at that point in the program. This make my test fail even though everything is going right.

 

Somebody that has an idea why this is happening?

Looks like it is only at certain values that he gets stuck and others he just ignores...

 

I would think the program only tries to read the 'right' part when the 'left' part is the one you are calling?

 

Thanks in advance,

kind regards.

  • Hi Marsha,

     

    I know how the wait functions work, I use them a lot throughout my testing framework!

    Problem is this function has maybe 200 windows that I need to check and if I would use the wait functions this would delay the program by minutes if not hours so that is not feasible...

    I do think this object lookup functionality is not what I was searching for so I went back to using switch cases instead and this works perfectly, I just tried to find a shorter way to implement this.

5 Replies