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
Protractor fails to synchronize when injecting AngularFire #225
I created an app from scratch with angular-cli, I ran E2E tests and they passed without any problem. Then I added providers and I injected AngularFire in my app component. I was able to setup authentication and bind to a list successfully but when I run protractor it throws a Timeout error because it can't synchronize with Angular.
Should I do anything else to run e2e tests? I created the issue because I couldn't find anything in docs about it.
Sorry if I am missing something. I really appreciate your efforts to build the library and if you are open to community contributions I would love to submit a PR fixing it.
Do the same tests work if run directly in the browser? If so, I'd suspect an issue with headless browsers (i.e. PhantomJS) or other sandboxing caused by the automated tools. Using chrome seems to resolve these cases.
Has anyone gotten this to work? Sorry it took so long to circle around, but we're currently seeing this issue - it's possible that something AngularFire is doing is interfering with Protractor's waiting for stability.
Upon a bit of further investigation, it looks like the firebase client may be setting a SetTimeout that runs inside Angular's zone and prevents whenStable from ever returning. (We've got a stack trace somewhere in compiled database.js but that's not super useful).
Steps: 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)
I have the same issue. I enabled ignore synchronization and test based on incoming requests and use wait for. Ideally I think the best solution would be to 'pause' the socket. Do something that triggers fire base and pause once the request is returned or sent.
Activity
jeffbcross commentedon Jun 16, 2016
@aguzubiaga thanks for the issue. I wonder if Protractor is having an issue with the Web sockets that Firebase is opening.
@juliemr off the top of your head, are there any known issues with stabilization and Web Sockets?
katowulf commentedon Sep 27, 2016
Do the same tests work if run directly in the browser? If so, I'd suspect an issue with headless browsers (i.e. PhantomJS) or other sandboxing caused by the automated tools. Using chrome seems to resolve these cases.
davideast commentedon Oct 26, 2016
Closing due to inactivity.
juliemr commentedon Dec 19, 2016
Has anyone gotten this to work? Sorry it took so long to circle around, but we're currently seeing this issue - it's possible that something AngularFire is doing is interfering with Protractor's waiting for stability.
juliemr commentedon Dec 19, 2016
Upon a bit of further investigation, it looks like the firebase client may be setting a SetTimeout that runs inside Angular's zone and prevents
whenStablefrom ever returning. (We've got a stack trace somewhere in compiled database.js but that's not super useful).@davideast are you the best contact for this?
sdebaun commentedon Jan 16, 2017
I have run into this issue as well.
@juliemr @davideast
Minimal repro in this repo:
https://github.com/sdebaun/af-protractor-test
Steps:
ng newnpm install --save angularfire2 firebaseimport
AngularFireModuleinAppModuleadd constructor with AngularFire to
app.component.tsng serveandng e2e, y voila!varsis commentedon Jan 17, 2017
I have the same issue. I enabled ignore synchronization and test based on incoming requests and use wait for. Ideally I think the best solution would be to 'pause' the socket. Do something that triggers fire base and pause once the request is returned or sent.
sdebaun commentedon Jan 17, 2017
i am concerned that the ignore synchronization workaround leads to a lot of unnecessary test code.
interestingly enough, the tests fail even if you dont do anything with the result of
database.list.mwanago commentedon Jul 27, 2017
https://github.com/alfonso-presa/protractor-testability-plugin
Solved the problem for me
raDiesle commentedon Aug 9, 2017
How does plugin solved issue? It works sometimes with plugin, but slow like hell.
daraul commentedon Oct 6, 2019
Is there any workaround for this? Or a solution?
I think I'm having this issue as well.