0

I'am testing a login page, and then wait to load the home page title to expect true, but when I run the test I have this message:

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

I read something, but the solution is to set browser.waitForAngularEnabled(false);

Why is it? I don't understand why? Now It works but would be a problem with more complex tests?

Thanks

Alan Grosz
  • 1,175
  • 10
  • 15

1 Answers1

0

Protactor will wait that all Angular task in the browser will end before protector executes the next step. Now using browser.waitForAngularEnabled(false) you tell protactor to dont wait for Angular tasks to finish.

In your code you use probably async code (like timeout, interval) that will not end in the given protactor timeout and he will throw then the error.

Protactor waits for Angular to know that the site rendering is done and all elements in the DOM are accessible.

G.Vitelli
  • 1,229
  • 9
  • 18
  • So? I have to waitForAngular or not? How I do to wait and doesn't have the timeout error after 11 seconds? Thank you – Alan Grosz Nov 29 '17 at 11:31
  • No, if this timout error will happen, try to figure out, what angular are doing in the background looking in the Browser eventloop. What you also can do is to extend the timeout via adding getPageTimeout: timeout_in_millis to your Protractor configuration file. When you need to add waitForAngular you are doing something wrong. – G.Vitelli Nov 29 '17 at 13:18