Protractor and angular manual bootstrap
See original GitHub issueI’m having a problem when running protractor 0.8 and having troubles running protractor on our app that is manually bootstrapped.
Here are some snippets revealing the relevant parts of the application and setup: index.html:
<script type="text/javascript" data-main="js/main" src="js/libraries/require.js"></script>
js/main.js:
require({
shim: {
.... snip ..
}
},
['require', ..... ], function(require) {
return require(['bootstrap']);
bootstrap.js:
var appElm = $('html');
appElm.addClass('ng-app'); // this
angular.bootstrap(document, ['app']);
This works in practice and Angular is started in a correct way. When I view the html source I cannot see the ng-app attribute appearing on the html element. May be Protractor also fails to do so?
I use the protractor sample configuration and changed the relevant values to suit my app:
specs: [
'../src/test/javascript/protractorSpec/*_spec.js',
],
baseUrl: 'http://localhost:8080/Viewer/',
rootElement: 'html',
Sample test:
describe('List SMC Charts', function() {
var ptor= protractor.getInstance();
beforeEach(function() {
ptor.get('#/smcChart');
});
it('list, no filter', function() {
var selectOption = ptor.findElement(ptor.By.input("selectOption"));
});
});
When I run this test two errors appear:
1) List SMC Charts list, no filter
Message:
Error: Angular could not be found on the page http://localhost:8080/Viewer/#/smcChart
Stacktrace:
Error: Angular could not be found on the page http://localhost:8080/Viewer/#/smcChart
at /usr/local/lib/node_modules/protractor/lib/protractor.js:392:15
and
2) List SMC Charts list, no filter
Message:
TypeError: Cannot call method 'input' of undefined
Stacktrace:
TypeError: Cannot call method 'input' of undefined
at null.<anonymous> (/Users/........//Viewer/src/test/javascript/protractorSpec/some_spec.js:9:55)
The first error seems to be the most important one, but the last error is also quite interesting. It appears to me that the line: ptor.By.input is not working.
Any ideas?
Issue Analytics
- State:
- Created 10 years ago
- Comments:49 (8 by maintainers)
Top GitHub Comments
@sjelin What’s the documented way to support manual bootstrapping? I can’t find the relevant information for protractor 5.0.
@juliemr With Angular 1.5, manually bootstrapping is the preferred way to bootstrap. Is there blessed protractor support on the way?