title: Mocking rest calls in functional e2e protractor tests in angular 4 project
body: <p>We have a huge project and we have written a lot of test cases to cover a lot of real scenario user behavior in our e2e functional test cases.</p>
  
  <p>As the test goes on, it makes a lot of rest calls to complete the test cases. When we cover different browser in sauce lab it multiplies 5-9 times.</p>
  
  <p>What I want is to mock all the rest calls so that there will not be any real calls to the actual server but internally it will be handled. its for functional e2e test not unit test as we mocked all unit tests using jasmine <code>spyOn</code>.</p>
  
  <p>I have explored <code>json-server</code> and <code>$httpBackend</code> of protractor. son-server did not fit as it does not handles app post, put, delete calls well. in case of $httpBackend </p>
  
  <p>I have gone through <a href="https://stackoverflow.com/questions/16807130/mock-httpbackend-in-angular-e2e-tests">this post</a> and its  for andularJs app not angular app and also its all about single rest call mocking for angularJs not for all rest calls.</p>
  
  <p>Also looked this angularjs <a href="https://github.com/wongatech/angular-multimocks" rel="nofollow noreferrer">multi mock for angularjs</a> and its also for angularjs not angular and looks like this changes the original rest url for query parameter.</p>