Protractor / Selenium XHR stays in status "pending"
As a last resort, you can execute JS:
waitForAngular(function(browser, timeOut){ pendingReq = browser.executeScript("var injector = window.angular.element('body').injector(); var $http = injector.get('$http'); return ($http.pendingRequests.length === 0);" if (timeOut >= 0){ timeOut -= 1; if ( pendingReq ){ return }; else { waitForAngular(browser, timeOut) }; }; else { console.log("did not load in time"); };});
This is not a clean way to code but I have found it to help me with Angular App where Requests are still pending...
Hope you find this helpful!
EDIT:
The function above should work it may need some refactoring I did not test it...
Your test didn't execute on time. So, you can increase the timeout in protractor.conf.js
file.
jasmineNodeOpts: { ... /** * Default time to wait in ms before a test fails. */ defaultTimeoutInterval: 50000, ...},
In the below link you can find various timeout arguments which you can configure in protractor.conf.js
:https://github.com/angular/protractor/blob/master/lib/config.ts
If this doesn't solve your problem, then mostly it's because of some plugins or third-party ads.