My ng-repeat
looks something like this
<div ng-repeat="(idx, field) in content">
And in protractor I want to get the row where the field.type === 'some value'
which I'm not being able to do. I don't know if there's a direct way to do this but my approach at this time is getting all rows with
element.all(by.repeater('(idx, field) in content'));
which gives me 10 elements.
And then was trying to get the types using
element.all(by.repeater('(idx, field) in content').column('field.type'));
which gives me 0 elements.
In Protractor documentation by repeater there are some examples but none use this separation on the repeater.
What am I doing wrong or what could be a different approach to filter these rows.
You can do it via filter()
+ evaluate()
:
element.all(by.repeater('(idx, field) in content')).filter(function (row) {
return row.evaluate("field.type").then(function (fieldType) {
return fieldType === "some value";
});
});