Skip to content

Protractor fails to synchronize when injecting AngularFire  #225

Closed

Description

@agu-z

Hello,

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.

Thanks.

Activity

  1. jeffbcross commented on Jun 16, 2016

    @jeffbcross
    Contributor

    @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?

  2. katowulf commented on Sep 27, 2016

    @katowulf
    Contributor

    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.

  3. davideast commented on Oct 26, 2016

    @davideast
    Collaborator

    Closing due to inactivity.

  4. juliemr commented on Dec 19, 2016

    @juliemr

    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.

  5. juliemr commented on Dec 19, 2016

    @juliemr

    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).

    @davideast are you the best contact for this?

  6. sdebaun commented on Jan 16, 2017

    @sdebaun

    I have run into this issue as well.

    @juliemr @davideast

    Minimal repro in this repo:
    https://github.com/sdebaun/af-protractor-test

    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)
    
  7. varsis commented on Jan 17, 2017

    @varsis

    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.

  8. sdebaun commented on Jan 17, 2017

    @sdebaun

    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.

  9. mwanago commented on Jul 27, 2017

    @mwanago
  10. raDiesle commented on Aug 9, 2017

    @raDiesle

    How does plugin solved issue? It works sometimes with plugin, but slow like hell.

  11. daraul commented on Oct 6, 2019

    @daraul

    Is there any workaround for this? Or a solution?

    I think I'm having this issue as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions