title: Call other api when running tests using Protractor
body: <p>I currently have setup some tests using protractor. These tests are retrieving data from a WebApi. However, I want to point the WebApi calls to a real but mocked WebApi that just returns the objects I want to use as test data.</p>
  
  <p>For example, the current request is:</p>
  
  <pre><code>http://localhost/myApp/api/profile/getUser/1
  </code></pre>
  
  <p>I want to manipulate this request so the test will use:</p>
  
  <pre><code>http://localhost/myApp/apiMock/profile/getUser/1
  </code></pre>
  
  <p>First I thought to write an interceptor that changes the request header but I don't have a clue how to make this work with Protractor. I can't use angular directly within my protractor tests, can I? If I can, writing the interceptor isn't a problem, I just don't know how to plug it in for my tests in protractor.</p>
  
  <p>I've read the following post: <a href="http://lostechies.com/gabrielschenker/2014/04/21/angularjspart-15-end-to-end-tests-and-mocking/" rel="nofollow">E2E and Mocking</a> but it doesn't fulfill my needs as I don't want to call the same url over and over again, I want to replace (part of) the dynamic url to point to the mocked api service.</p>
  
  <p>Just to make myself more clear, I'm not looking for mocked data on the client side. I want to keep the API calls (in my opinion it's more E2E) but just point to another API url that returns mocked data.</p>