I'm testing AngularJS with Protractor, I have a repeater and I'm trying to sum all values in the rows, and compare it to the summary line value.
Here's my HTML:
<table>
<th>
<td>100</td>
</th>
<tr data-ng-repeat="item in publishers_data">
<td>{{item.a}}</td>
</tr>
</table>
I used the following code in my e2e test:
var total = 100;
var sum = 0;
element.all(by.repeater("item in publishers_data")).then(
function(rows){
for(var i=0;i<rows.length;i++){
sum + = rows(by.model("{{item.a}}").getText();
}
});
expect(sum).toEqual(total);
I'm getting various kind of errors, can someone advice what am I doing wrong here?
An example error I get:
There was a webdriver error: TypeError Object [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[objec
t Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Ob
ject],[object Object],[object Object],[object Object] has no method 'getText'