I\'m trying to write some e2e test for my Angular application using Protractor.
I have a simple html button having id=my-btn
which I want to click, usin
I had some trouble with this. There are a few things you can try.
timer
that does a health check every 5 minutes. But this timer
operation being on the stack constantly meant that Angular never stabilized. If you do find such an operation, you can use ngZone.runOutsideAngular()
to keep it from destabilizing your tests.
constructor(
private ngZone: NgZone
) {}
ngOnInit() {
this.ngZone.runOutsideAngular(() => {
this.appStatusInterval = interval(this.appStatusUpdateIntervalTime)
// rest of your code here
});
});
}
getAllAngularTestabilities()
. Try to get what information you can from there. You can try to get extra data from the source code. This bit in particular might be useful to you:isStable(): boolean {
return this._isZoneStable && this._pendingCount === 0 && !this._ngZone.hasPendingMacrotasks;
}
You can at least get more of an idea on what's destabilizing Angular by checking each of these three conditions in turn.