mardi 31 mars 2015

angular chained orderby not updating when running protractor tests in browser

I am currently facing an issue with angular's ng-repeat directive containing multiple, piped filters when running it during a Protractor test suite. Although I can see Protractor click the sort/toggle button, the list does not change as it should. I expect it to sort the list and only show some items when clicking special toggle buttons.


However, when I execute all the commands manually (in the same browser!), it works just fine!


Please find how I call Protractor:



element(by.id('customers_sort_id')).click();
browser.driver.sleep(500);
browser.waitForAngular();
expect(element.all(by.repeater('c in list.customers')).get(0).all(by.tagName('td')).first().getText()).toEqual('500');


I have built in the sleep() command as well as the waitForAngular() call just for debugging reasons, but they also change nothing.


This is the HTML:



<tr class="clickable" ng-repeat="c in list.customers | filter : list.companyFilter.visible | filter : list.searchFilter | orderBy : list.orderBy : list.reverse" ng-click="detailOn(c.id)">


This is how the filter variable is set:



$scope.toggleSort = function(column) {
if($scope.list.orderBy == column) {
$scope.list.reverse = !$scope.list.reverse;
}
$scope.list.orderBy = column;
};


Neither the orderBy nor the reverse filter do anything.


Does anyone have an idea, why?? Thanks for any input!


Aucun commentaire:

Enregistrer un commentaire