title: Protractor doesn't wait for redirect
body: <p>I've got protractor's code written with Jasmine that is supposed to log in the user. Unfortunately there's a redirect going on after going to root url that takes quite some time (about 5 seconds) and I cannot make protractor wait for it. I've already tried <code>browser.wait</code>, I've tried using promises, I've tried with <a href="http://docsplendid.com/archives/209" rel="nofollow">this blogpost</a>, but nothing did it. It still doesn't wait. The login page is a page from Keycloak server, that's why I use <code>driver.findElement</code> instead of <code>element</code>. Here's my current code:</p>
  
  <pre><code>describe('my app', function() {
    it('login', function() {
      var driver = browser.driver;
      browser.get('/');
      console.log('get');
      driver.findElement(by.id('username')).isPresent().then(function() {
        console.log('waited');
        driver.findElement(by.id('username')).sendKeys("test");
        driver.findElement(by.id('password')).sendKeys("test");
        driver.findElement(by.id('kc-login')).click();
        driver.findElement(by.css('.page-header')).isPresent().then(function() {
          console.log('ok');
          expect(browser.getLocationAbsUrl()).toMatch("/test");
        });
      });
    });
  });
  </code></pre>
  
  <p>Do you know what can I do to make it work? I've started protractor project with this seed: <a href="https://github.com/angular/angular-seed" rel="nofollow">https://github.com/angular/angular-seed</a></p>