benbaran / adal-angular4

Angular 4/5/6/7 ADAL Wrapper
MIT License
87 stars 106 forks source link

Run rxjs timer for refreshToken outside angular zone -> for Protractor E2E tests #107

Closed filipows closed 5 years ago

filipows commented 5 years ago

When testing Angular app with Protractor, Protractor will wait until Angular Zone stabilizes. This means long running async operations will block test from continuing (docs)

In adal-angular4 AdalService sets a rxjs timer to execute refreshLoginToken function 5min before the token expires. This causes protractor tests to hang as the Zone is not stabilised.

To work around this, we need to run that task outside the Angular zone.