Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with testability API #815

Closed
rcomblen opened this issue Dec 23, 2016 · 7 comments
Closed

Integration with testability API #815

rcomblen opened this issue Dec 23, 2016 · 7 comments

Comments

@rcomblen
Copy link

Issue description
I'm doing end-to-end testing of my app (that uses angular2-google-maps).

I'm resorting to the testability API of Angular, to wait for angular to be stable before doing my actions (just like protractor does), i.e. I wait for

window.getAllAngularTestabilities()[0].isStable()

to return true.

It seems angular2-google-maps often leaves pending tasks in the zone (hard to debug, as there is no API to inspect the pending tasks, see angular/angular#8219). Hence it is never stable, and my tests are blocked.

It would be nice to make sure there are no pending tasks in the zone, e.g. make sure setTimeout is wrapped in a _zone.runOutsideAngular call when necessary.

I guess the same applies to all the calls in the wrapper to the Google API. Logic by the Google code should run outside of the zone.

angular2 & angular2-google-maps version
1.6.0 (but I guess it happens just the same with newer versions).

@sebholstein
Copy link
Owner

@rcomblen thanks for the report. This is really hard to debug. I'm skeptical that a runOutsideAngular is enough because the google maps API has also some setTimeout calls and other async stuff that gets executed automatically by Zone.JS. Do you have the time to test this with the native google maps api and see if it gets stable when you wrap all calls to the maps api?

@rcomblen
Copy link
Author

rcomblen commented Jan 3, 2017

@SebastianM I cannot promise I'll find the time for that :-(

@Ardenexal
Copy link

Having the same issue, but with angular 6 and using Protractor. Protractor times out because it is waiting for all the async tasks to finish which for google maps don't finish causing it to time out and break my e2e tests

@BovineEnthusiast
Copy link

BovineEnthusiast commented Sep 18, 2018

In my instance, there is a setTimeout of 25 seconds coming from the Google Maps API's common.js file. I had to increase the timeout of my tests significantly even though I don't think the setTimeout call back did anything (hard to tell, it's minimized code). Anyway this can run outside the Angular zone?

@demisx
Copy link

demisx commented Sep 18, 2018

Same issue here. Have to bump up the timeout to 40 seconds for the setTimeOut() to finish and the zone get stable. Obviously, it adds a lot of time to my e2e tests.

@stale
Copy link

stale bot commented Dec 17, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 17, 2018
@stale stale bot closed this as completed Dec 25, 2018
@BovineEnthusiast
Copy link

BovineEnthusiast commented Jun 1, 2019

Hey, has there been any progress into this?

mpienkowski added a commit to mpienkowski/angular-google-maps that referenced this issue Aug 30, 2019
Wrap all Google Maps APIs calls in the wrapper with runOutsideAngular

Fixes NgZone stability (issue sebholstein#815)
ghost pushed a commit that referenced this issue Nov 5, 2019
…1714)

Wrap all Google Maps APIs calls in the wrapper with runOutsideAngular

fixes: #815
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants