I know that ElementFinder
s are promises but I'm not sure how the promise behaves if we define the ElementFinder
s in the beginning of the Page Object. Looking at an example:
var EventHeader = function (context) {
this.eventName = this.moduleRoot.element(by.css('.event-name'));
this.venueName = this.moduleRoot.element(by.css('.venue-name'));
this.eventTime = this.moduleRoot.element(by.css('.event-time'));
this.eventDate = this.moduleRoot.element(by.css('.event-date'));
this.marketName = this.moduleRoot.element(by.css('.market-name'));
};
Will protractor try to resolve all the promises when the page objects is initialised?
I guess the other option would be to define the locators in the beginning and then create methods to return the ElementFinder
itself.