At the moment I faced an issue when the project I am working with was refactored using ocLazyLoad. From my side, I am an Automation QA working with Protracktor v.5.1.2 .
Before implementing above-mentioned feature I was successfully using protractor involving such option as
browser.ignoreSynchronization = false;
But now as the app downloads js bundles separately, protractor seems to recognize the end of Angular $http and $timeout tasks, when the first js bundle is loaded. Whereas the page still is not ready for further work, because it loads next lazy loaded bundle and I am getting such errors like:
No element found using locator
I have also tried
browser.waitForAngularEnabled(true);
but this is basically the same as ignoreSynchronization if you see the source code .
Such approaches might seem to be efficient
browser.sleep(5000);
or
browser.isElementPresent(by.css('a[ui-sref="some.stateLink"]'));
var $registerLink = element(by.css('a[ui-sref="some.stateLink"]'));
expect($registerLink.getText()).toEqual('Register Now');
or
var elem = by.css('a[ui-sref="some.stateLink"]');
browser.driver.wait(function() {
return browser.isElementPresent(elem);
}, 5000);
var $registerLink = element(elem);
expect($registerLink.getText()).toEqual('Register Now');
but they make tests fragile and there are too much places in my code where I have to process it.
Did anybody face such a problem? Are there any better solutions in comparison to ones I suggested? Thank you.