Protractor version 5.0 Http-backend-proxy failing

176 Views Asked by At

I upgraded from protractor version 4.0.14 to version 5.0.0 and now my tests are failing. I use http-backend-proxy for mocking the backend.

The tests run fine with version 4.0.14, but fails with an InvalidElementState error when I upgrade to version 5.0:

E/launcher - invalid element state: Failed to execute 'querySelector' on 'Document': The provided selector is empty.
  (Session info: chrome=56.0.2924.87)
  (Driver info: chromedriver=2.26.436421 (6c1a3ab469ad86fd49c8d97ede4a6b96a49ca5f6),platform=Mac OS X 10.11.4 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 36 milliseconds

And it fails on this (on the respond line):

  afterLoadLogin: function( ) {
            httpBackend
                .when('POST', this.URL + 'user/login')
                .respond( function() {
                    return [$httpBackend.context.loginStatus, $httpBackend.context.login];
                });
        }    
1

There are 1 best solutions below

0
On

Protractor marked this as a bug to be fixed and provided a workaround here: https://github.com/angular/protractor/issues/4249