protractor: by.repeater('item of items') not working with angular2 *ngFor
Need to use by.repeater() with Angular2 repeater *ngFor
, but seems its not working as working with angular 1.x ng-repeat
.
Any suggestion please.
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 18
- Comments: 21 (2 by maintainers)
by.css
is powerful but brittle.by.model
and friends are superior in many cases – is there any intent to implement this someday, or has the protractor team decided to drop support for these features for Angular 2+? Since this issue has been sitting untouched for 12 months, it would be nice to hear the team’s current thoughts.bump
This is still on the list - we’re working with Angular to design the best way to create these angular specific locators going forward. It’s difficult because the angular compiler does not export all the information we need (for important performance reasons), so this needs to be done carefully.
The recommendation continues to be using
by.css
, which I find to be versatile and concise in most situations 😃Is Protractor just dead now? Without the Angular integration, it’s just Web Driver and might as well use Selenium at that point. With all the headaches that comes with. 😦
With just 2 small releases since February, Protractor doesn’t seem to be getting the attention that angular is getting.
@nithinkrishnan I think we need to continue using the .css as they do not have anything yet to support for ngFor like they have for repeater.
It seems to me that protractor gives us a lot in the waiting/timing area that we would have to sleep() us through without.
As long as I have control over the source code for the stuff I’m testing, I can always insert id’s, names or css classes to hopefully uniquely identify fields.
But support for binding and model would sure be appreciated.
Any further updates regarding use of by.repeater() with Angular2 repeater *ngFor, or still we need to follow by.css?
Is protractor good only for angular 1? I’m kinda not sure, there’s no good documentation about how to use it effectively for angular 2+
As a reason even I do not prefer using protractor anymore.
@jquerygeek - current workaround for me is to use CSS locator:
// let dashboardItems = element.all(by.repeater(‘exchange in exchanges’)); let dashboardItems = element.all(by.css(‘bx-dashboard-item’)); expect(dashboardItems.count()).toBe(8);