-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Improve rootElement default #1742
Comments
If we're willing to make
|
Whoa, I was just about to open an issue on this topic, good to see this is something the protractor team is looking into. I sporadically get errors like: Error: Error while waiting for Protractor to sync with the page: "root element (body) has no injector. this may mean it is not inside ng-app." While for us, our homepage declares ng-app on the html tag, Which lead me to this thread on SO Would you suggest just adding root-element of html in my conf.js file? Why is it that the majority of the time protractor doesn't throw this error, when the default root element is body but that is not where I have set my ng-app at. |
If |
@sjelin thanks, I've specified rootElement: 'html' now in my cont.js file, just extremely curious as to why protractor 90% of the time never complained that it was looking for the rootElement on body, with my ng-app being defined on html |
Please ask questions like this on stack overflow. (Also I think that angular isn't loading properly) |
@sjelin I think I've got a fix that works. I'll post (and answer) a stackoverflow question and delete this. |
+1 for looking for |
I've set |
Hello, I have been reading about this issue that randomly, my protractor test is failing because of the same error mentioned above (Error while waiting for Protractor to sync with the page: "root element (body) has no injector. this may mean it is not inside ng-app.) Is there a solution there that guarantees consistency? My application does the bootstrapping manually, so the ng-app is set to body but sometimes I get this error. I have tried to set rootElement: 'html' but the tests fail sometimes. Can you please advise guys if you have found a solution for this? Thanks in advance. |
Please ask support questions on stack overflow. Also, you probably want |
Ok, thanks! |
I updated to Protractor 3.2.1, and I get the following error: ng-app is on html tag, and there is an ng-controller directive on the body tag. I tried setting rootElement: 'html', but that did not seem to make a difference. I did not get this error in Protractor 3.1.1 |
Does your test involve a non-angular page? Or client-side navigation (i.e. clicking on a link)? Did you check the URL for details? |
The test does not involve a non-angular page. By client-side navigation, I'm confused. Do you mean navigation that uses ng routing? i.e. we are using angular-ui-router, so the only links we have keep the user on the same page, just a different path after the /#/ But those links are everywhere in our app, and we need to test them in our automated tests. And the confusing part about the link is:
The workaround seems to be calling browser.refresh() after clicking on a link - does that actually add another browser refresh in this instance? It seems like a risky workaround. I guess I should be adding this info to that (closed) issue, but I thought that it had more to do with my rootElement being in the html tag, and controller in the body tag. And I could not recreate in 3.1.1, only 3.2.1. I also tried the workaround mentioned in the link below, but that did nothing: workaround I tried: rootElement: '[ng-app="ourApp"]' Hey, thanks for the quick response! Protractor is amazing, but it is really hard keeping up with browser and selenium versions. New stuff keeps coming in and breaking everything!! |
If the links never cause a page to unload then it's not a client-side navigation problem (probably). Could you get me a small reproduction of this problem? Preferably in a small github repo? And make a separate issue for it (since this is a discussion not a bug report)? |
Sorry for my messages, please disregard them. I was using gulp-protractor, and assumed that it was using protractor as a peer dependency. My issue is related to my own setup; nothing with protractor itself. |
This is also going to become interesting as Angular2 hits, where we have no |
Pending and version 5.0, we'll be changing this to the following:
This should find your root element almost all the time. |
This is a breaking change because it changes the default root element behavior and removes the `config.useAllAngular2AppRoots` flag. Modern angular apps now default to using all app hooks, and ng1 apps now check several places, notably the element the app bootstraps to. Closes angular#1742
This is a breaking change because it changes the default root element behavior and removes the `config.useAllAngular2AppRoots` flag. Modern angular apps now default to using all app hooks, and ng1 apps now check several places, notably the element the app bootstraps to. Closes angular#1742
This is a breaking change because it changes the default root element behavior and removes the `config.useAllAngular2AppRoots` flag. Modern angular apps now default to using all app hooks, and ng1 apps now check several places, notably the element the app bootstraps to. Closes angular#1742
This is a breaking change because it changes the default root element behavior and removes the `config.useAllAngular2AppRoots` flag. Modern angular apps now default to using all app hooks, and ng1 apps now check several places, notably the element the app bootstraps to. Closes angular#1742
rootElement: '[ng-app]', per angular/protractor#1742 lang='en', per http://stackoverflow.com/questions/28040078/no-injector-found-for-element-argument-to-gettestability Not sure about this one.
At the moment, rootElement defaults to
body
, which is not particularly smart. It can be set manually, but we can improve the experience here.The text was updated successfully, but these errors were encountered: