capybara-angular
capybara-angular copied to clipboard
Manual bootstrapping angular not supported
As per Angular 2 documentation:
Pure Angular 1 applications can be bootstrapped in two ways: By using an ng-app directive
somewhere on the HTML page, or by calling angular.bootstrap from JavaScript. In Angular 2, only
the second method is possible - there is no ng-app in Angular 2. This is also the case for hybrid
applications. Therefore, it is a good preliminary step to switch Angular 1 applications to use the
JavaScript bootstrap method even before switching them to hybrid mode.
So in order to get this gem working with Angular 2 or even hybrid ng-upgrade apps, ng-app can no longer be required.
The protractor documentation solved this problem in a similar way to how the gem has solved it, so only minor updates are required.
I have already forked the gem and made the change here: #33
@wrozka Some coworkers brought up the fact that this solution ONLY works if you use ng-app on the body tag. Note that this is the recommendation on the angular docs, but could potentially be considered a regression.
A safer change might be to grep for $('[ng-app]')
first, then fall through to $('body')
if that tag is not found. If you care about this backwards compatibility let me know, i'll create another/update the pull request.
Thanks for spotting that, I missed that, please update the pull request if you can.
I'll do this today.