I have my protractor tests set up to use http-backend-proxy which uses httpbackend, and everything works fine with protractor version 4.0.14, but in version 5.0+ they fail with an InvalidElementState error.
Code that now fails:
httpBackend = new HttpBackend( browser );
httpBackend
.when('GET', this.URL + 'user/self')
.respond( function() {
return [200, $httpBackend.context.userSelf];
});
I tried updating it to the following, just to see if that would help at all, but it still fails with the same error:
httpBackend
.whenGET(this.URL + 'user/self')
.respond( function() {
return [200, {}];
});
Any advice would be greatly appreciated!! Thanks!
I'm not super familiar with HTTPBackend but it isn't something we officially support. I'd suggest bringing this up on the HTTPBackend repo or on StackOverflow.
Good luck!
hm, ok thanks!
FYI: https://docs.angularjs.org/api/ngMock/service/$httpBackend
My apologies I mean to say http-backend-proxy, not HTTPBackend :)
This error: InvalidElementStateError: invalid element state: Failed to execute 'querySelector' on 'Document': The provided selector is empty is what you get if you call document.querySelector() with an empty string.
There is a bug where appRoot can be the empty string in some cases, but after looking through clientsidescripts.js, I don't see a case where that would make it to a document.querySelector() call.
Could you provide an example repro case? Also, a few questions:
by.cssContainingText?Apologizes for the delay. I didn't see a notification that you responded. Thank you for looking into this.
I will send you more example information and try setting the body of root element today and get back to you!
Adding rootElement: 'body' to my config file does fix the issue!
To try to simplify the code to show you for repo, I put everything in the onPrepare here:

Do you have a simple angular site that I could point to? I can't provide my app code for repo, but if you have an angular site that I could point to and set up to reproduce, I will do that.
Thanks again!!
I like to just use angularjs.org. That's what I did for the BlockingProxy demo.
Also, protractor has a test app in the repo. If you clone the repo and run npm start it'll bring up an app you can use for testing.
Hi!,
I have a working repo to demonstrate the issue for you: https://github.com/rfodge/protractor4249