protractor icon indicating copy to clipboard operation
protractor copied to clipboard

by.repeater('item of items') not working with angular2 *ngFor

Open jquerygeek opened this issue 10 years ago • 21 comments

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.

jquerygeek avatar May 08 '16 12:05 jquerygeek

This is not yet expected to work - custom locators aren't yet supported for angular 2.

juliemr avatar May 10 '16 07:05 juliemr

@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);

gazbert avatar Dec 18 '16 19:12 gazbert

Hello,

When are you willing to implement these features ? Unfortunately, Protactor is losing its charm when we get elements with "by.css" ...

Thanks,

mahmoudmahdi24 avatar Dec 19 '16 14:12 mahmoudmahdi24

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 :)

juliemr avatar Dec 22 '16 01:12 juliemr

Thanks for your reply Julie !

mahmoudmahdi24 avatar Dec 22 '16 11:12 mahmoudmahdi24

+1 for by.model and by.repeater - makes for less brittle and more data-driven tests. Happy to help review stuff/doc stuff/test stuff...

gazbert avatar Jan 17 '17 22:01 gazbert

Try this: var data = element.all(by.css('table[name='' + TableName + '']')).all(by.css('tr td')); expect(data.get(0).getText()).toEqual('0');

arunkalesh avatar Mar 08 '17 07:03 arunkalesh

Any further updates regarding use of by.repeater() with Angular2 repeater *ngFor, or still we need to follow by.css?

nithinkrishnan avatar Apr 04 '17 10:04 nithinkrishnan

@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.

arunkalesh avatar Apr 04 '17 10:04 arunkalesh

Any clue when this issue will be closed ?

AhmedRagheb avatar Jul 12 '17 15:07 AhmedRagheb

^

DMadrid avatar Jul 12 '17 18:07 DMadrid

@DMadrid What do u means :) :) ?

AhmedRagheb avatar Jul 12 '17 18:07 AhmedRagheb

bump

JeremyIglehart avatar Sep 26 '17 16:09 JeremyIglehart

Guys, any updates?

liwonder avatar Nov 17 '17 06:11 liwonder

With just 2 small releases since February, Protractor doesn't seem to be getting the attention that angular is getting.

samrantmedia avatar Nov 17 '17 11:11 samrantmedia

As a reason even I do not prefer using protractor anymore.

arunkalesh avatar Nov 17 '17 12:11 arunkalesh

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. :-(

TetonRaven avatar Nov 28 '17 17:11 TetonRaven

Is this planned to be fixed in any upcoming release?

martintro avatar Dec 13 '17 15:12 martintro

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.

fr0 avatar Dec 15 '17 21:12 fr0

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.

vonNord avatar Mar 14 '18 10:03 vonNord