Reputation: 173
<li ng-repeat="menu in menulist" ng-class="isActive(menu.type, menu.complete)" ng-click="setTopNav(menu.type, menu.complete)">{{menu.label}}</li>
Is the code for our menu. I'm trying to detect an array of the label names with
this.menuNav = element.all(by.repeater('menu in menulist').column('label'));
I bring that page object in a test and try to use the assertion
expect(navHeader.menuNav[1].getText()).toEqual('Label 2');
And I get this error
TypeError: Cannot call method 'getText' of undefined
What am I doing wrong?
Upvotes: 2
Views: 923
Reputation: 1570
Protractor returns a promise, you need to change your code into
element.all(by.repeater('menu in menulist').column('label')).then(function(elems) {
expect(elems[1].getText()).toEqual('Label 2');
});
Upvotes: 4