The protractor works well on Angular 1, but after upgrading my application to hybrid Angular 1 + 2, I get this error:
Error: Error while waiting for Protractor to synchronize with the page: "[ng: test] no injector was found for element argument to getTestability http://errors.angularjs.org/1.4.9/ng/test "
This seems like a common mistake when you do not have the ng-app tag <div ng-app=myAppManager">in your Angular 1 application and can be easily fixed by wiyh rootElement : 'html'in your protractor configuration file, but it does not seem to change anything in the hybrid application.
I tried rootElement : 'html'or even useAllAngular2AppRoots: true.
I suspect the problem is with asynchronous loading of hybrid Angular (from upgrade doc):
One noticeable difference between angular.bootstrap and upgradeAdapter.bootstrap is that the latter works asynchronously. This means that we cannot assume that the application was created immediately after the bootstrap call returned.
my configuration file:
exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['protractor.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 50000,
},
allScriptsTimeout: 50000,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'prefs': {
'profile.managed_default_content_settings.notifications':2
}
}
},
rootElement : 'html',
jasmineNodeOpts: {
realtimeFailure: true
},
onPrepare: function() {
var failFast = require('jasmine-fail-fast');
jasmine.getEnv().addReporter(failFast.init());
}
}
source
share