When testing an angular app using protractor, I encountered a strange issue recently. Every now and then, or since a recent update, protractor seems to stall or slow down significantly.
After investigating the problem, I discovered that a simple someElement.getText().then(...)
call is taking an unusually long time to resolve; the .then(...)
part never gets executed. Adding a allScriptTimeOut: 500 000
delay allows the promise to eventually resolve after about 6 minutes (which is very inconvenient!).
While waiting with allScriptTimeOut: 500 000
does work eventually, it takes too long.
An alternative solution to this slowdown is to instruct protractor to ignore Angular's promises and asynchronous tasks and proceed without waiting for them by setting
browser.ignoreSynchronization = true;
However, setting this boolean to true causes issues as it treats the entire angular app as non-angular and disregards all Angular processes. Additionally, our app is not entirely angular; some pages are non-angular. Here lies my question:
Is there a way to access the controlflow queue and monitor if any enqueued action is taking longer than 11 seconds? If so, can we set
browser.ignoreSynchronization = true
? A hypothetical code snippet would look like this:
protractor.controlflow(function(delay){
if(delay > 11 sec){
browser.ignoreSynchronization = true;
}else{
browser.ignoreSynchronization = false;
}
});
The syntax may not be correct, but the concept is what matters most to me;
Thank you again for understanding my dilemma.
UPDATES:
Upon further inspection, Protractor can click on most buttons successfully, except for one at the bottom of the screen. Even though I scrolled to bring the button into view before clicking, it still took 6 minutes to register the click.
Why is there such a significant delay in successfully clicking on that particular button?