You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
In the 'spec/basic/synchronize_spec.js' example, there are some test that indicate they are waiting for time-outs versus not waiting however both tests look the same.
Is this a bug, or am I missing some detail here? What is the correct way to click a button that generates a server call and wait for it to return before testing the change to the page?
The text was updated successfully, but these errors were encountered:
it('DOES NOT wait for timeout',function(){varstatus=element(by.binding('slowTimeoutStatus'));varbutton=element(by.css('[ng-click="slowTimeout()"]'));expect(status.getText()).toEqual('not started');button.click();expect(status.getText()).toEqual('pending...');});
To answer your first question: Note that the last line expects the status to be 'pending' instead of 'done', as the other tests do. The difference is that Angular/Protractor doesn't know about your custom timeout calls, so it can't wait for them to finish. However, Angular does know when you use $timeout or $http, so it can do the right thing there.
So for your second question, as long as your button uses $http at some level, you shouldn't have to do anything special at all to wait!
Thanks, makes sense. In my case the button click invokes a $Location change. The target route's Controller init is what issues the $http call. In this scenario is it possible to auto wait around this indirect $http call? I resorted to using setTimeout, which works, but seems hacky.
In the 'spec/basic/synchronize_spec.js' example, there are some test that indicate they are waiting for time-outs versus not waiting however both tests look the same.
Is this a bug, or am I missing some detail here? What is the correct way to click a button that generates a server call and wait for it to return before testing the change to the page?
The text was updated successfully, but these errors were encountered: