angularjs - Mocking API with usage of httpBackend and Protractor -
i'm trying mock api (as seen in question mocking api httpbackend [protractor]). i'm navigating specific url - 'http://0.0.0.0:9000/#/organizations/profile'. url requests specific view seen here:
error: unexpected request: vcs/common/layouts/main/view.html no more request expected @ $httpbackend (angular-mocks.js:1211) @ sendreq (angular.js:9667) @ serverrequest (angular.js:9383) @ processqueue (angular.js:13248) @ angular.js:13264 @ scope.$eval (angular.js:14466) @ scope.$digest (angular.js:14282) @ scope.$apply (angular.js:14571) @ bootstrapapply (angular.js:1455) @ object.invoke (angular.js:4203)
i have trouble in understanding how 'whenpost(url, [data], [headers]);' method works. how can use in current code? here's code:
describe('e2e tests', function() { it('fo tests', function() { browser.addmockmodule('webclientapp', function() { console.log('test'); angular.module('webclientapp', ['ngmocke2e']) .run(function($httpbackend) { console.log('test2'); $httpbackend.whenpost('http://0.0.0.0:9000/api/organizations').respond(200); $httpbackend.whenpost('/api/auth/get_resource_by_token').respond(200); $httpbackend.whenget('/api/auth/current_resource').respond(200); $httpbackend.whenget(/.*/).respond(200); }); }); browser.getregisteredmockmodules(); browser.get('http://0.0.0.0:9000/#/organizations/profile'); browser.pause(); }); });
Comments
Post a Comment