Reputation: 12646
Trying to select the text from the first column in the first row of an ng-repeat. The html (these are rows within a table body):
<tr ng-repeat="c in cars | orderBy:'-type' ">
<!-- Type -->
<td>{{ c.type }}</td>
<!-- Notes -->
<td>{{ c.notes }}</td>
</tr>
The selection attempt:
var type= element.all(by.repeater("c in cars| orderBy:'-date' ").
row(0).column(0));
type.getText()
.then(function(text){
console.log('ISSUED FROM: ' + text);
});
What am I doing wrong? As usual, I have looked through the examples on SO (there a few for repeater), but they don't seem to work (...for me, I am sure they work and I am doing something wrong). I don't get an error, but I get nothing for "text" even though in the browser, there is clearly a string.
It looks like this when viewing source, if that helps:
<!-- Type -->
<td class="ng-binding">Murcielago</td>
Upvotes: 1
Views: 892
Reputation: 473833
by.exactRepeater()
would be a better option here. Also, column()
should be called with a binding passed into and, since you need a single element, use element()
:
var type = element(by.exactRepeater("c in cars").row(0).column("c.type"));
expect(type.getText()).toEqual("Murcielago");
Upvotes: 2