ngmocke2e

Protractor addMockModule additional arguments not working?

自作多情 提交于 2019-12-22 18:32:50
问题 This seems so, so easy, but I can't figure out why this simple code doesn't work. I am adding a mock module to mock my API backend in my Angular E2E tests. I'm using Protractor 1.6.0. I need to pass additional arguments to the mocked module, which, according to the Protractor docs, is possible by just sending them as additional arguments. However, my function claims it has no arguments... var mock = function() { // This is undefined and arguments.length is 0....why??? var env = arguments[0];

Mocking API with httpBackend [Protractor]

∥☆過路亽.° 提交于 2019-12-06 07:25:49
问题 I'm developing a frontend app for a REST API. I'm using Protractor for end-to-end tests with the API mocked out. I was able to mock AUTHtoken API response and navigate to chosen URL, but page displayed under destined URL renders empty. Here's my 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

Protractor addMockModule additional arguments not working?

烂漫一生 提交于 2019-12-06 04:38:14
This seems so, so easy, but I can't figure out why this simple code doesn't work. I am adding a mock module to mock my API backend in my Angular E2E tests. I'm using Protractor 1.6.0. I need to pass additional arguments to the mocked module, which, according to the Protractor docs, is possible by just sending them as additional arguments. However, my function claims it has no arguments... var mock = function() { // This is undefined and arguments.length is 0....why??? var env = arguments[0]; var mocks = angular.module('mocks.login', ['MyApp', 'ngMockE2E']); mocks.run(function($httpBackend) {

Mocking API with httpBackend [Protractor]

99封情书 提交于 2019-12-04 14:58:08
I'm developing a frontend app for a REST API. I'm using Protractor for end-to-end tests with the API mocked out. I was able to mock AUTHtoken API response and navigate to chosen URL, but page displayed under destined URL renders empty. Here's my 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

Is there an easy way to whitelist HTTP requests with ngMockE2E

ⅰ亾dé卋堺 提交于 2019-11-30 09:21:10
问题 Due to some infrastructure changes (namely servers & VPNs) there are times I want to run our application in an offline mode. I've been able to implement this with ngMockE2E however it seems to be an all or nothing approach, meaning you have to explicitly set every single HTTP request out of the app. Is there a way to have it assume that unless you have explicitly set a route/url to be handled that it will automatically call a generic passThrough() operation? Currently I am doing this: noSrvc

Is there an easy way to whitelist HTTP requests with ngMockE2E

孤者浪人 提交于 2019-11-29 15:31:39
Due to some infrastructure changes (namely servers & VPNs) there are times I want to run our application in an offline mode. I've been able to implement this with ngMockE2E however it seems to be an all or nothing approach, meaning you have to explicitly set every single HTTP request out of the app. Is there a way to have it assume that unless you have explicitly set a route/url to be handled that it will automatically call a generic passThrough() operation? Currently I am doing this: noSrvc = $location.search().hasOwnProperty 'nosrvc' # # templates # $httpBackend.whenGET /(\.htm|\.html)$/