angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

Angular 2 waiting 30 seconds after page is loaded #4316

Closed fortunella closed 7 years ago

fortunella commented 7 years ago
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;

exports.config = {
  baseUrl: 'http://localhost:4200/',
  suites: {
    mandators:      './e2e/mandators/**/*.e2e-spec.ts',
    organizations:  './e2e/organizations/**/*.e2e-spec.ts'
  },
  capabilities: {
    'browserName': 'chrome'
  },
  directConnect: true,
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    showTiming: true,
    isVerbose: false,
    includeStackTrace: false,
    defaultTimeoutInterval: 120000,
    print: function() {}
  },
  allScriptsTimeout: 30000,
  getPageTimeout: 30000,
  beforeLaunch: function() {
    require('ts-node').register({ project: 'e2e' });
  },
  onPrepare: function() {
    browser.manage().window().maximize();
    jasmine.getEnv().addReporter(new SpecReporter());

    const protractorImageComparison = require('protractor-image-comparison');
    browser.protractorImageComparison = new protractorImageComparison({
      baselineFolder: './e2e/imageComparison/baseline/',
      screenshotPath: './e2e/imageComparison/temp/'
    });
  },
  useAllAngular2AppRoots: true
};

Running my e2e tests I'm facing the problem that there is a wait time of about 30 secs each time a page is loaded via URL.

For example, I call the login page of the application with browser.get(). The page is shown in the test browser very quick and after 30 seconds the user and password is filled into the input fields.

It seems that Protractor waits for a timeout and then continues with the test execution. This is very time consuming when executing a large test suite.

When I navigate inside the application by Angular routing there is no wait time. The application I'm testing is served by the webpack dev server via "ng serve".

wswebcreation commented 7 years ago

Can you manual check when the app is loaded if Angular is still processing stuff? I'm working with Angular 4 and Protractor 5.1.2 and I'm not facing the timeouts you are. So I'm guessing it's in the app itself.

By the way, as of Protractor 5 you don't need to use useAllAngular2AppRoots: true anymore.

fortunella commented 7 years ago

I think I found the reason for this waiting time. It's caused by Firebase :-( I read the issue #4300. This is about a similar topic.

When I deactivate Firebase the tests run fine without any waitings.

NickTomlin commented 7 years ago

Yep, sounds like it. Let's consolidate on #4300. I'm going to close this for now.