I am using the latest version of Angular and the latest version of Protractor, and I am wondering how to work with the ngFor loop in my tests.
In the past, it was easy in my AngularJS application. I just used something like by.repeater, and the magic was done behind.
However, now in Angular 4 APP I was out of luck. Based on this ticket , it is not yet supported. On the other hand, I saw a ticket overflow https://stackoverflow.com/a/1675023/ ... when someone is already working with him.
Anyway, my HTML:
<div *ngFor="let org of userOrgList; count as count">
<button class="btn btn-default btn-lg col-xs-12" type="submit" (click)="selectOrg(org.id)">{{org.name}}</button>
</div>
And my test looks like this:
var organizations = element.all(by.repeater('org of userOrgList'));
it('should have an org with specific name', function() {
expect(organizations.get(0).getText()).toEqual('myOrgName');
});
And I get the error message:
: . : 0, 0 , by.rep eater ( "let org of userOrgList; " )
:
ngFor