Digest loop is the mechanism that angular uses to check for changes to the model and update the view accordingly. This is asynchronous and there by causes a problem when writing end to end selenium tests.
Selenium has come up with protractor for testing angular applications. I have not given it a shot. We solved the problem of having to wait for atleast one digest loop to complete after the page loads by using selenium’s wait for async script hook.
"angular.element([DOM element]).injector().get('$timeout')(arguments[arguments.length - 1]);"
The timeout service of angular executes the call back passed to it after the completion of atleast one digest cycle if you don’t pass a time out, which is the case here.
Together these ensure that angular had a chance to process the current route atleast once before you do assertions on the elements using selenium webdriver.