title: Protractor: open window and test url
body: <p>I'm trying to test a link in a table that opens a new window. I want to test the url of the new window.</p>
  
  <p>What I have so far is this:</p>
  
  <pre><code>    it('Should verify new window url', function () {
      page.list.get(0).click().then(function () {
          browser.getAllWindowHandles().then(function (handles) {
              newWindowHandle = handles[1];
              browser.switchTo().window(newWindowHandle).then(function () {
                  expect(browser.getCurrentUrl()).toMatch(/\/url/);
              });
          });
      });
  });
  </code></pre>
  
  <blockquote>
    <p>Error: Error while waiting for Protractor to sync with the page: {}</p>
  </blockquote>
  
  <p>Works if I remove the expect....I am confused about promises, can someone guide me in right direction please?</p>