I have very simple AngularJs 1.4.8 Front-End:
When the form is filled and the OK button is pressed the new person is added to the table.
The form is in the addingPersonController and the table is in the allPersonsController, both are childs under the masterController.
When a user is added(OK clicked) the following happens:
- a 
POSTrequest is sent to the server in order to add the new person. - a 
personAddedEventis emitted with$emitfrom theaddingPersonControllerto themasterController - the 
masterControllerbroadcasts anupdatePersonsEventto theallPersonsController - the 
allPersonsControllersends a GET request to the server in order to get all the persons and update the table. 
I have a protractor end to end test that exercises this case, the problem is that I can not figure out how to wait for the whole process to finish before to check the assertions and the test always fails.
The UI works when tested manually and I have tried to wait in the protractor test with:
browser.wait(function(){}, timeout);browser.sleep(ms);.click().then();
None of them worked.
Is there a way to wait for such a process to complete before checking the assertions?
