Questions tagged [ngmocke2e]

ngMockE2E is an AngularJS module which contains mocks suitable for end-to-end testing.

ngMockE2E is an AngularJS module which contains mocks suitable for end-to-end testing. Currently there is only one mock present in this module - the e2e $httpBackend mock.

Docs:https://docs.angularjs.org/api/ngMockE2E

38 questions
11
votes
2 answers

Module 'ngMockE2E' is not available! AngularJS

Getting the following error in my browser: Uncaught Error: [$injector:modulerr] Failed to instantiate module sayHiApp due to: Error: [$injector:modulerr] Failed to instantiate module ngMockE2E due to: Error: [$injector:nomod] Module 'ngMockE2E' is…
user818700
7
votes
1 answer

Print request in httpBackend API mock module in Protractor

I run my e2e tests against a mocked API using angular service $httpBackend in protractor. I already have the debug log of the selenium browser: afterEach(function() { browser.manage().logs().get('browser').then(function(browserLog){ …
louis amoros
  • 2,418
  • 3
  • 19
  • 40
3
votes
0 answers

Angular $httpBackend mock not working well with Protractor

Setup: beforeEach(function () { const targetUrl = browser.baseUrl + '/#/Editor/AddRule'; browser.ignoreSynchronization = true; browser.get(targetUrl); browser.wait( function () { return…
tsnn2d
  • 141
  • 8
3
votes
0 answers

AngularJS $httpBackend asynchronous response

I'm trying to mock the back-end for an AngularJS(1.3.8)-app with ngMockE2E as replacement until the back-end code has been written. I'm using already existing services that also query other data, however they return a promise. I am aware that…
3
votes
1 answer

How to setup e2e protractor backend request mocking/stubbing

I try to setup my independent protractor project to mock some of my backend requests. Therefore, I included angular-mocks.js and attached another module within the onPrepare() function of my protractor.conf.js: browser.addMockModule('httpBackend',…
DonJuwe
  • 4,477
  • 3
  • 34
  • 59
3
votes
1 answer

Is there an easy way to whitelist HTTP requests with ngMockE2E

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…
jusopi
  • 6,791
  • 2
  • 33
  • 44
3
votes
1 answer

Add multiple mock modules in one test with 'addMockModule'

I'm mocking some end-points on an Angular website with Protractor using the following pattern: // mock.js // adding the mock module and passing it data Mock.prototype.all = { default: function() { browser.addMockModule('httpBackendMock',…
magicode118
  • 1,444
  • 2
  • 17
  • 26
3
votes
1 answer

Mocking API with httpBackend [Protractor]

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…
3
votes
1 answer

Loading ngMock only in testing context when using Protractor

I'm switching all of our protractor E2E tests of an angular app to ngMock, so that we can mock our resources/http calls. However, I can't find a recommended method for loading ngMock in that scenario. I don't want to include the script itself in my…
helion3
  • 34,737
  • 15
  • 57
  • 100
2
votes
1 answer

Protractor version 5.0 Http-backend-proxy failing

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…
2
votes
0 answers

Mocking backend with Protractor

I found a lot of similar discussion about this topic but unfortunately none of them fit my scenario. I'm trying to mock the backend response from Protractor for testing a new functionality that is not present in the real API at the moment. I tried…
andreasonny83
  • 1,213
  • 11
  • 19
2
votes
1 answer

Security and ngMockE2E

I have some protractor tests and I would like to mock some calls to a third party service used by my Angular JS app. I've read about ngMockE2E. My understanding is this requires I add angular-mocks.js to my page. What are the best practices…
objectuser
  • 671
  • 6
  • 15
2
votes
1 answer

ngMockE2E is causing every request mock the moment added to dependency

I have angular.module("myModule", [ //Some dependency "ngMockE2E" ]) This is actually mocking template request and throwing error Unexpected request: GET javascripts/custom/utils/templates/global_loader.html No more request expected at…
Neo
  • 4,550
  • 6
  • 34
  • 51
2
votes
2 answers

Dynamically load JSON for ngMock httpBackend response in Protractor

I'm building an ngMock httpBackend in a Protractor test. var mockJson = require(projectRoot + 'mock/load.json'); var mockResource = function() { angular.module('aMockObject', ['myApp', 'ngMockE2E']) .run(function($httpBackend) { …
helion3
  • 34,737
  • 15
  • 57
  • 100
2
votes
0 answers

ngMockE2E intercepting a passthrough

I was wondering if in ngMockE2E there is a way to intercept the response from the server coming through a passthrough. To be prefectly honest I don't have any code examples, because I am not sure what this would look like. I tried…
Thomas Florin
  • 403
  • 6
  • 14
1
2 3