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

Protractor addMockModule additional arguments not working?

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,…
jhdavids8
  • 381
  • 3
  • 9
1
vote
1 answer

Alternative for http-backend-mock and ngE2e for a react application

Currently, I have been using ngMockE2e and httpbackend mock with protractor for an angular page. Now we are thinking of using react for development, Is there any alternative which I can use for mocking stuff for end to end testing for http calls.
Dinesh
  • 149
  • 1
  • 3
  • 12
1
vote
0 answers

Errors with .passThrough() using angular E2E

I am trying to test my real API using Angular MockE2E, but am getting errors using the .passThrough function. Here is my code: describe('simple test', function () { var $controller,…
Frazer Wilson
  • 161
  • 1
  • 1
  • 13
1
vote
0 answers

Karma config vs Protractor config files - Where to inject Angular mocks?

So I'm struggling to setup a mock unit test for my Angular controllers via Protractor. Reason ? It's because I can't figure how to inject Angular mocks into my tests. Using Karma runner, I have succeeded in setting this up, due to clear examples re:…
bob.mazzo
  • 5,183
  • 23
  • 80
  • 149
1
vote
2 answers

Unable to use httpBackend flush for ngMockE2E

I am trying to test my controller using jasmine. Basically, when the controller is created it will call a service to make http request. I am using httpBackend to get the fake data. When I try to run the test I always get the error "No pending…
Steven
  • 415
  • 1
  • 4
  • 12
1
vote
1 answer

Changing mock responses on a 'per test' basis

I have just started setting up e2e tests for our angular project. We have a page that collects and displays a lot of data from server. The user will interact with the page in a limited number of ways, but the data can be presented in many different…
clearfix
  • 467
  • 1
  • 5
  • 10
1
vote
1 answer

Updating mocked objects in protractor tests

Just wondering if anyone has a good solution for updating mocked calls within a protractor test. I need to be able to mock a call (which I can do using ngMockE2E) but the next time the call is made, I want it to come back with different…
reutsey
  • 1,743
  • 1
  • 17
  • 36
1
vote
1 answer

Why subsequent tests for ngmocke2e failed to call mock backend. Only the first test would pass. Second test would call the real backend

Why subsequent tests for ngmocke2e failed to call mock backend? Only the first test would pass. Second test would call the real backend. Here is my sample code: The first test would call the mock. The second will call the real backend. var…
1
vote
1 answer

Mocking a server response

I'm new to e2e testing. I've encountered problem during my protractor tests. My web application calls API despite my efforts: Started GET "/api/programs" for 127.0.0.1 at 2015-06-22 10:43:19 +0200 Processing by Api::V1::ProgramsController#index as…
1
vote
1 answer

Grunt Connect Prism Mock Server not recording requests

My goals is to use grunt-connect-prism (as described here) to catch server requests from my AngularJS app to then use as mock data for protractor E2E tests. Alternatively, I'm looking for suggestions for better server mock data libraries for…
user12121234
  • 2,519
  • 2
  • 25
  • 27
0
votes
1 answer

ngMockE2E skipped when using addMockModule in Protractor test for mock requests

Using Angular's Protractor framework, I have the following test file: storeItems.e2e.js: 'use strict'; describe('home test', function() { beforeAll(function() { browser.addMockModule('httpMocker', function() { …
toodloo
  • 1
  • 1
0
votes
0 answers

Protractor addMockModule for angular applications without ngApp

The angular application on which I am running my e2e tests does not have ngApp directive and bootstraps manually. Is it not possible to insert mock modules via Protractor in this case? //load angular mocks as a string here var angularMocks =…
Manya
  • 315
  • 4
  • 17
0
votes
1 answer

ngMockE2E - $http keeps returning

I've been trying to write app in Angular 1.6 in ES6 and I wanted to use that fake HTTP Backend from ngMockE2E: https://docs.angularjs.org/api/ngMockE2E/service/$httpBackend So I implemented those API calls like this in home.run.js: mocks.$inject =…
0
votes
0 answers

angularjs - e2e mocked backend

I'm trying to mock the backend so that I can write some e2e tests. I searched online but I can't figure out what i'm doing wrong. I get this error on the first line of my code: angular is not defined. My protractor config file is: exports.config =…
Nick
  • 13,493
  • 8
  • 51
  • 98
0
votes
2 answers

Using variables in httpBackend mock function

I want to be able to define a variable and then use said variable in the respond() method inside the module.run() function. I have this code inside my it(): var testValue=randomValue(); // suffice to say, a random value generator var…
Keith Tyler
  • 719
  • 4
  • 18