You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot use Protractor at all; tests hang if database.list() is called #779
ng new npm install --save angularfire2 firebase
import AngularFireModule in AppModule
add constructor with AngularFire to app.component.ts ng serve and ng e2e, y voila!
- Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular
While waiting for element with locator - Locator: By(css selector, app-root h1)
Expected behavior
To not have the test timeout waiting for angular
Actual behavior
It times out waiting for angular
Reacted by Andrea Z., Lukas Elmer, Poul Kruijt, Moritz Habegger and Ivan Vasilko
changed the title [-]Protractor tests hang if `database.list()` is called[/-][+]Cannot use Protractor at all; tests hang if `database.list()` is called[/+]on Jan 17, 2017
@sdebaun From what I understand, Protractor doesn't work great with Web Sockets and therefore the Firebase SDK. Your best option right now is ignoring synchronization. I've spoken with the team about improving things but nothing is planned at the moment. Since this has been awhile, is there anything you have discovered?
The problem is that the firebase sdk is setting up some long running intervals and timeouts. The database client for example sends a heartbeat every 45 seconds, which you can see in the frames of the WebSocket connection in the network tab of your browser. But just calling firebase.initializeApp sets up a 30 second timeout. Protractor is waiting those timeouts and any work scheduled by them. So any tests relying on these tasks to end will timeout.
I'm experiencing the same problem. After having spent an entire day trying to figure out why all my Protractor test were failing, I realised that either removing my Firebase service from the project or ignoring synchronization fixed the issue.
I would really like to have a full Protractor support when using FireBase in my web application.
Closing for now as it's not a angularfire2 issue. If there's something the Firebase JS SDK can do to make things more testable please open an issue there.
I believe what @blaugold said is right: the protractor is waiting for the angular fire to finish its task in the event loop. And I will also support @Maistho to run firebase outside of the angular zone if it has to keep the setInterval.
Activity
[-]Protractor tests hang if `database.list()` is called[/-][+]Cannot use Protractor at all; tests hang if `database.list()` is called[/+]davideast commentedon Mar 16, 2017
@sdebaun From what I understand, Protractor doesn't work great with Web Sockets and therefore the Firebase SDK. Your best option right now is ignoring synchronization. I've spoken with the team about improving things but nothing is planned at the moment. Since this has been awhile, is there anything you have discovered?
blaugold commentedon Mar 25, 2017
The problem is that the firebase sdk is setting up some long running intervals and timeouts. The database client for example sends a heartbeat every 45 seconds, which you can see in the frames of the WebSocket connection in the network tab of your browser. But just calling
firebase.initializeAppsets up a 30 second timeout. Protractor is waiting those timeouts and any work scheduled by them. So any tests relying on these tasks to end will timeout.andreasonny83 commentedon May 24, 2017
I'm experiencing the same problem. After having spent an entire day trying to figure out why all my Protractor test were failing, I realised that either removing my Firebase service from the project or ignoring synchronization fixed the issue.
I would really like to have a full Protractor support when using FireBase in my web application.
andreasonny83 commentedon May 24, 2017
Another solution not to loose the Angular integration with Protractor, is to extend the timeout limit. Here my
protractor.cong.jsjamesdaniels commentedon Jun 2, 2017
Closing for now as it's not a angularfire2 issue. If there's something the Firebase JS SDK can do to make things more testable please open an issue there.
Maistho commentedon Sep 1, 2017
@jamesdaniels is it possible to run firebase outside of the angular zone?
http://www.protractortest.org/#/timeouts#angular
Seems like blaugold/firebase-rxjs is doing something of the sort.
I'm not sure if it should or can be a part of angularfire2, or if it should be a part of the SDK.
Should be related to firebase/firebase-js-sdk#119
JamboBuenna commentedon Sep 24, 2018
Any updates on this. Being able to run firebase outside of the angular zone would solve so many issues with automation
huan commentedon Oct 15, 2018
I ran into this issue too.
I believe what @blaugold said is right: the protractor is waiting for the angular fire to finish its task in the event loop. And I will also support @Maistho to run firebase outside of the angular zone if it has to keep the setInterval.