You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
elementArrayFinder already supports .map() which is quite nice, but I would also like to use other functions like .reduce() or .filter() which are typically supported by Array-like objects.
Example
Lets take the example from #392, but this time I don't want to know all menu labels, but look if one specific label appears once.
var total = 100;
var sum = element.all(By.repeater('item in publishers_data')).map(function(row) {
return row.getText();
}).then(function(arr) {
return arr.reduce(function(a, b) {
return Number(a) + Number(b);
})
});
expect(sum).toEqual(total);
We could write this:
var total = 100;
var sum = element.all(By.repeater('item in publishers_data')).reduce(function(rowA, rowB) {
// lets imagine a `plus` function, which accepts promises for readability
// and also returns a promise
return plus(rowA.getText(), rowB.getText());
});
expect(sum).toEqual(total);
The text was updated successfully, but these errors were encountered:
elementArrayFinder
already supports.map()
which is quite nice, but I would also like to use other functions like.reduce()
or.filter()
which are typically supported by Array-like objects.Example
Lets take the example from #392, but this time I don't want to know all menu labels, but look if one specific label appears once.
Instead of writing this:
I could write this:
Or take this StackOverflow question.
Instead of writing this:
We could write this:
The text was updated successfully, but these errors were encountered: