In my app, I need to call a slow API endpoint on page loading. This call doesn't really affect the app but should be performed right on page load.
During the whole time the request is performed, there's a macro-task in the queue which prevents Angular Zone from becoming stable and non-testable (in e2e-tests).
This is the only thing I need to be ignored by Zone, all other ones should be waited as usual and many tests already depend on it.
So turning waitForAngularEnabled
off in the tests is not the best option.
I tried to perform this long-lasting call outside Angular Zone like this:
this.ngZone.runOutsideAngular(() => this.httpClient.post(...))
The XMLHttpRequest
task is still in the queue and blocks Zone stability:
Please advise what's the way to run Http requests outside Angular Zone?