I would like to end-to-end test our angular 2 application using Protractor, but I'm stuck with the message:
"Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds."
My conf file.
exports.config = {
directConnect: true,
specs: ['spec.js'],
// For angular2 tests
useAllAngular2AppRoots: true,
}
Chrome is opened, and the website is also opened, then nothing happens till the the timeout.
When disabling the synchronisation (using browser.ignoreSynchronization = true; ), it's OK. But I'm loosing the "automatic waiting" feature, one of the main advantages of using Protractor.
The application is fully based on angular 2. So why this does not work?
Our developers told me that we are not polling (one of the possible cause according Protractor documentation). By the way, we are using websocket architecture. I don't know if there's a link.
Actually, I don't know how to troubleshoot this issue at all.
Could someone help, please?
Temporarily enabling browser.ignoreSynchronization fixes it, as reported in an answer here.
(code that throws the error)
Your guess is right. This error would occur when their are any outstanding tasks running in your angular2 application.
Yes, the most common reason is when application continuously polls $timeout or $http, Protractor will wait indefinitely and time out. But this can also occur in scenarios where App takes more than 11 seconds
Please refer here for more information on different timeouts
the default timeout value is 11 seconds. You can change this by adjusting the below value in config.js and try and see if you are still seeing the issue
Modify the test case and put
browser.waitForAngularEnabled(false);
after the first click, should work.However, recommended method can be overriding the default timeout in your
conf.js
file asallScriptsTimeout: 110000