title: setTimeout alternative in protractor
body: <p>Just started working on a functional test repo that uses protractor and tests an angular 4 app. Throughout the tests we're wrapping almost every action in a setTimeout and surely theres a better way. Here's a small example. Is there a config option somewhere or something that waits for page and network calls to finish?</p>
  
  <pre><code>it('do something', function (done) {
      setTimeout(() =&gt; {
          var adminBtn = element(by.id('adminBtn'));
          adminBtn.click();
          setTimeout(() =&gt; {
              var payloadsBtn = element(by.id('payloadsBtn'));
              payloadsBtn.click();
              setTimeout(() =&gt; {
                  expect(browser.getCurrentUrl()).toMatch(conf.web + "/payloads");
                  done();
              }, 3000)
          }, 2000)
      }, 4000)
  });
  </code></pre>