title: Why subsequent tests for ngmocke2e failed to call mock backend. Only the first test would pass. Second test would call the real backend
body: <p>Why subsequent tests for ngmocke2e failed to call mock backend? Only the first test would pass. Second test would call the real backend.</p>
  
  <p>Here is my sample code: The first test would call the mock. The second will call the real backend. </p>
  
  <pre class="lang-js prettyprint-override"><code>var LoginPage = require( './login_page' );
  
  describe('As a user, when using valid credentials', function() {
  
      var login = new LoginPage();
  
      beforeEach(
          function () {
  
              browser.addMockModule('myService', function() {
                  angular
                      .module('myService', ['myApp', 'ngMockE2E'])
                      .run(function($httpBackend) {
  
                          var access={"access_token":"a", "token_type":"bearer", "expires_in":299, "refresh_token":"a", "userName":"any", "clientId":"blah", ".issued":"Mon, 08 Jun 2015 20:47:40 GMT", ".expires":"Mon, 08 Jun 2015 20:52:40 GMT"};
  
                          $httpBackend.whenPOST("https://blah.com/OAuth2Server/1.0/OAuth/Token").respond(200, access);
  
                          $httpBackend.whenGET(/\/*/).passThrough();
                          $httpBackend.whenPOST().passThrough();
  
                      });
              });
          });
  
  
      it('logins successfully', function() {
              login
              .navigate()
              .login("anything", "password");
  
          browser.sleep(5000);
          browser.ignoreSynchronization=true;
  
          var currentUrl=browser.getCurrentUrl();
          expect(currentUrl).toBe("http://localhost:55555/#/my-jobs");
  
      });
  
  });
  
  describe('As a user, when using valid credentials', function() {
  
      var login = new LoginPage();
  
      beforeEach(
          function () {
  
              browser.addMockModule('myService', function() {
                  angular
                      .module('myService', ['myApp', 'ngMockE2E'])
                      .run(function($httpBackend) {
  
                          var access={"access_token":"a", "token_type":"bearer", "expires_in":299, "refresh_token":"a", "userName":"any", "clientId":"blah", ".issued":"Mon, 08 Jun 2015 20:47:40 GMT", ".expires":"Mon, 08 Jun 2015 20:52:40 GMT"};
  
                          $httpBackend.whenPOST("https://blah.com/OAuth2Server/1.0/OAuth/Token").respond(200, access);
  
                          $httpBackend.whenGET(/\/*/).passThrough();
                          $httpBackend.whenPOST().passThrough();
  
                      });
              });
          });
  
  
      it('logins successfully', function() {
              login
              .navigate()
              .login("anything2", "password2");
  
          browser.sleep(5000);
          browser.ignoreSynchronization=true;
  
          var currentUrl=browser.getCurrentUrl();
          expect(currentUrl).toBe("http://localhost:55555/#/my-jobs");
  
      });
  
  });
  </code></pre>