title: Protractor HTTP GET request
body: <p>In my protractor tests, I'm trying to hit an endpoint that will reset all data for the currently logged in user.  Right now, I'm using plain old javascript to hit that endpoint in a <code>beforeAll</code>, and it's successfully hitting it, however now my tests are executing before the page has refreshed causes them to fail.  Here's my current code:</p>
  
  <pre><code>var EC = protractor.ExpectedConditions,
      el = element(by.css('body div.modal-x'));
  
  browser.executeAsyncScript(function() {
      var inj = angular.element(document.body).injector();
      var reHTTP = inj.get('reHTTP');
      var myService = inj.get('myService');
      var someVar = myService.getCurrent().definition.userName;
      console.log(someVar); // works
      reHTTP.get('/app/' + someVar + '/reset').then(function () {
          // console.log('i am here'); // this works
          // alert('Success!'); // this works
          return browser.wait(EC.visibilityOf(el)); // this does not work
      });
  });
  </code></pre>
  
  <p><strong>Problem:</strong> I can't use Protractor functions within that executeScript block because I'm in the browser context now.  i.e. <code>EC</code> is undefined</p>
  
  <p><strong>Question:</strong> How can I properly access/use my <code>ExpectedConditions</code> while also hitting this endpoint (again, I'm currently using this function in a <code>beforeAll</code> block)?</p>
  
  <p>A few things to note:</p>
  
  <ul>
  <li>If I don't use <code>browser.executeAsyncScript</code> then <code>angular</code> is undefined and I can't access the services (or I couldn't find another way)</li>
  <li>Using <code>executeScript</code> (rather than AsyncScript) fails even faster than async script</li>
  </ul>
  
  <p>Any ideas?</p>