I have an angular2 application that I want to test with a protractor.
In this application, I have a page with a graph that is regularly updated with auto-generated data.
Apparently, one protractor feature is waiting for scripts and http calls to complete before the test code is executed. However, if there is a constant polling script that never ends, the protractor will wait forever and time out after a certain time.
In angular1, this can be solved by performing a survey with $interval , which does not reach the protractor. Unfortunately, angular2 doesn't have $interval , and the correct way to do the polling seems to be Observable.interval , so it looks like my code:
Observable.interval(500) .map(x => this.getRandomData()) .subscribe(data => this.updateGraph(data));
When testing the page on which this code works, the protractor will be disabled. He expects the page to finish loading, and thinks that this script will come out someday (when it actually works forever).
Is there an interval mechanism in angular2 that protractor recognizes so that it does not wait for polling to complete before running user interface tests?
If not, how can I say that the protractor did not wait for this interval to complete before executing the larger test code?
EDIT: To clarify, a timeout problem already existed in the transporter with angular1, but can be fixed with $interval , see
This does not work in angular2 because there is no $interval .
source share