Contributions
Re: How to export class methods and properties from one module to another?
Thanks for your quick response. a) >There is a request for the feature you are talking about but I am not sure how easy to implement That's quite a shame that this really impressive app can't afford simple IntelliSense:( b) >This is Selenium way and it is not the best one for TestComplete world. PageObject is not theSelenium way,PageObject is the common test automation design pattern. c) >TestComplete already provides you with (a kind of) Page Object (PO)model implemented via NameMapping and Aliasing. In TestComplete I use NameMapping or Aliases to initialize page properties. e.g. : this.someTextField= new TextField(nameMapping); d) >The major problem with PO (please correct me if I am completely wrong here) is that it works well for the 'static' objects that are present on the page upon its load. Not really. It is normal way to use accessors rather than constructor for all (not only dynamic) controls. Inside get property method you can .Wait(), .Find(), and then initialize and return required prorerty: get someTextField() { if(! this._someTextField) { let propArr = new Array(prop1Name, prop2Name, prop3Name); let valuesArr = new Array(prop1Value,prop2Value,prop3Value); let aliase = this._aliase.FindChild(propArr,valuesArr,5); this._someTextField = new TextField(aliase); } return this._someTextField; }1.9KViews0likes1CommentHow to export class methods and properties from one module to another?
Hello All, As TestCompleteis using JS in ES6, I can use classes to create PageObjects and specify properties and methods in my PageObject class, so it will look like follows: "use strict"; module.exports = class PageObjectScreen { constructor() { this.property1 = a; this.property2 = b; this.property3 = c; } method1() { return this.property1; } method2() { return this.property2; } method3() { return this.property3; } } In my test I cancreate an instance of class and use properties and methods: "use strict"; letPageObjectScreen = reguire('pageObjectScreen'); function testFunction() { let myPage = new PageObjectScreen(); Log.Event(myPage.method2()); } When I typemyPage. I expect the pop-uplist withPageObjectScreenproperties and methods, but nothing pops up. It is quite hard and unreasonable to memorize all properties and methods of all classes so, is there a way to add them in TestComplete intellisence (Auto pop-up)?Solved2KViews0likes3Comments