I have a straightforward AngularJs 1.4.8 Front-End:
https://i.stack.imgur.com/2H3In.png
After filling out the form and clicking the OK button, a new person is added to the table.
The form resides in the addingPersonController
, while the table is controlled by the allPersonsController
; both are children of the main masterController
.
Once a user is added (after clicking OK), the following sequence occurs:
- A
POST
request is sent to the server to add the new person. - A
personAddedEvent
is emitted from theaddingPersonController
to themasterController
using$emit
. - The
masterController
then broadcasts anupdatePersonsEvent
to theallPersonsController
. - Subsequently, the
allPersonsController
sends a GET request to the server to fetch all persons and update the table accordingly.
In order to test this scenario, I have created a protractor end-to-end test. However, I am encountering difficulty as the test fails before the process completes.
Despite successful manual tests of the UI, my attempts to wait for the process to finish in the protractor test using methods like:
browser.wait(function(){}, timeout);
browser.sleep(ms);
.click().then();
have not been fruitful.
Is there a way to ensure completion of the process before running assertions in the test?