I am getting an error which reads:
"Error while waiting for Protractor to synce with the page: "Cannot read property '$$testability' of undefined"
Below is my test.
describe('On the MyMoments page', function(){
beforeEach(function() {
var editLocationText = 'Location';
browser.driver.get('http://192.168.0.6:8100/#/page1/myMoments');
});
it('The edit button should work', function() {
browser.driver.get('http://192.168.0.6:8100/#/page1/myMoments').then(function() {
// browser.waitForAngular();
browser.getCurrentUrl().then(function(url) {
});
});
});
});
This is my config file:
exports.config = {
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
args: ['--disable-web-security']
}
},
baseUrl: 'http://192.168.0.6:8100',
specs: [
'*.test.js'
],
jasmineNodeOpts: {
isVerbose: true,
}
};
I don't think this is something to do with my test since my test is incredibly simple. Has anybody run into this issue before? I'm a bit stuck.
Thanks.
EDIT:
Downgraded my Protractor version all the way to 4.0.14 in order to fix this error. Now i'm getting:
"Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability/http://errors.angularjs.org/1.5.3/ng/test"
If anyone knows what this is or how to resolve this, let me know!
Thanks.
I had the same issue with an Angular hybrid app. In my case the issue was fixed after removing,
from the config.
Changing the browser from chrome to firefox worked for me.
Although it's sometimes caused by documents without an html tag in the root, "Cannot read property '$$testability' of undefined" is more likely to manifest as a symptom of another error that prevented the page from loading, or any interaction with a page that isn't loaded for whatever reason.
Try using a browser.sleep above the line that is throwing the error, to give the page time to load.
A browser.ExpectedConditions clause which is intended to wait for a specific condition can throw this error if the page is not ready for protractor.
Sometimes, hard coded sleeps can not be avoided.
To diagnose and fix it,
This is a known issue in Protractor, see here. As mentioned in the issue this is because browser.angularAppRoot() is expected to return the current value of app root if a value isn't passed to it, but currently returns undefined. A new release is coming that should fix this issue.
Hope it helps