question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can’t run Protractor test on Angular2+ apps using Firrebase. Following up from https://github.com/angular/angularfire2/issues/779

Bug report

  • Node Version: v7.3.0
  • Protractor Version: 5.1.2
  • Angular Version: 4.1.2
  • Browser(s): chrome
  • Operating System and Version MacOS Sierra 10.12.4
  • Your protractor configuration file
const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    print: function() {}
  },
  beforeLaunch: function() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
  },
  onPrepare() {
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};
  • A relevant example test
import { browser, element, by } from 'protractor';

describe('test App', () => {
  beforeEach(() => {
    browser.get('/');
  });

  it('should display the home page', () => {
    expect<any>(element(by.css('app-root h1')).getText()).toBe('Test App');
  });
});
  • Output from running the test
- 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)
  • Steps to reproduce the bug Just including either AngularFireAuth or AngularFireDatabase in an Angular4 AppTestComponent triggers the error.
import { Injectable } from '@angular/core';
import { AngularFireDatabase } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
import { Observable } from 'rxjs/Observable';
import * as firebase from 'firebase/app';

@Injectable()
export class FirebaseService {
  constructor(
    private afAuth: AngularFireAuth,
    private db: AngularFireDatabase,
  ) { }

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:16
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
crinelapcommented, Aug 10, 2017

For me worked this workaround:

    it('test ', function(){
        page.navigateTo();
        browser.sleep(3000);
        browser.waitForAngularEnabled(false);
       
        page.getProjectTitle().then(function(str){expect(str).toBe("Title")});
     
    });
10reactions
fortunellacommented, Jul 8, 2017

In my project I solved it by disabling the synchronization. But this has a drawback: I had to insert some sleeps to wait “manually” for the page to get ready. Especially with Angular Material which I use in my project as it uses lots of animations. And there I often have to wait until the animation has finished. But for me this is not a big problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The WebSocket API (WebSockets) - Web APIs - MDN Web Docs
desktop desktop Chrome Edge WebSocket Full support. Chrome4. Toggle history Full support. Edge12. Toggl... WebSocket() constructor Full support. Chrome4. Toggle history Full support. Edge12. Toggl...
Read more >
WebSocket - Wikipedia
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was ...
Read more >
What is web socket and how it is different from the HTTP?
WebSocket is a bidirectional communication protocol that can send the data from the client to the server or from the server to the...
Read more >
What is WebSocket and How It Works? ⚙️ - Wallarm
WebSocket allows us to create “real-time” applications which are faster and require less overhead than traditional API protocols. Sometimes referred to as a ......
Read more >
WebSockets - A Conceptual Deep Dive - Ably Realtime
In a nutshell, WebSockets are a thin transport layer built on top of a device's TCP/IP stack. The intent is to provide what...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found