angular/protractor — pull request #1066 by hankduan (2014-07-11 19:10:43+00:00)
Title: feat(protractor): allow advanced features for ElementArrayFinder

changed ElementFinder as a subset of an ElementArrayFinder
There are no breaking changes. Everything that works before _should_ work the same way now (same syntax and all).

Features:
* Finding through multiple branches instead of one:
```
@view

1a

1b

2a

2b

@example
var foo = element.all(by.css('.parent')).all(by.css('.foo'))
expect(foo.getText()).toEqual(['1a', '2a'])
var baz = element.all(by.css('.parent')).all(by.css('.baz'))
expect(baz.getText()).toEqual(['1b'])
var nonexistent = element.all(by.css('.parent')).all(by.css('.NONEXISTENT'))
expect(nonexistent.getText()).toEqual([''])
```

* Filters can be chained and returns ElementArrayFinder
* ElementArrayFinder and ElementFinder are integrated together
```
i.e.
element.all(by.W).all(by.X).filter(filterFn1).filter(filterFn2).last().element(by.Y).all(by.Z)
```

* Actions can be done on an ElementArrayFinder
```
var multiElement = $$('#checkboxes').filter(function(elem, index) {
return elem.getText().then(function(text) {
return text === 'checkbox1' || text === 'checkbox2';
});
});
multiElement.click();
//expect: both checkboxes should be checked;
```

All of the above features (i.e. filter, get/first/last, all, element) can be incorporated into page objects. Especially with the filter, you should be able to build much stronger selectors for your page objects.

Lastly, your test should run _slightly_ faster now in theory because of the implementation changes (and protractor's tests did go from 113.817s to 106.551s), but this is not a guarantee and is just a side effect