title: How to handle DeprecationWarning: Unhandled promise rejections are deprecated in Protractor
body: <p>I'm using a page object Protractor framework written in Typscript, which applies the async/await feature. I assert with Jasmine. I'm testing an application built using Angular and Angular CLI.</p>
  
  <p>There have been instances when an element has failed to appear prior to the assertion, because the issue is not handled as part of the assertion the test hangs for 60 seconds until I receive a jasmine.DEFAULT_TIMEOUT_INTERVAL error. </p>
  
  <p>I also receive the following depracationWarning from node: </p>
  
  <blockquote>
    <p>(node:9796) [DEP0018] DeprecationWarning: Unhandled promise rejections
    are deprecated. In the future, promise rejections that are not handled
    will terminate the Node.js process with a non-zero exit code.</p>
  </blockquote>
  
  <p>As you would expect the test imports the pages objects needed and they extend common actions. The spec is as below: </p>
  
  <pre><code>it('should allow user to update bank acocunt number',  async(done) =&gt; {
        await sideMenu.clickMenuItem(sideMenu.myDetailsOption);
        await sideMenu.clickMenuItem(sideMenu.bankDetailsOption);
        await bankDetailsPage.editAccountNumber('12345678');
        await bankDetailsPage.isDisplayed(bankDetailsPage.confirmationOfUpdateText)
        .then(isVisible =&gt; expect(isVisible).toBeTruthy())
        .then(done, done.fail);
    }, 60000);
  </code></pre>
  
  <p>My first thought was to catch the promise rejection, so I made the following changes:</p>
  
  <pre><code>it('should allow user to update bank acocunt number',  async(done) =&gt; {
        await sideMenu.clickMenuItem(sideMenu.myDetailsOption).catch(done.fail);
        await sideMenu.clickMenuItem(sideMenu.bankDetailsOption).catch(done.fail);
        await bankDetailsPage.editAccountNumber('12345678').catch(done.fail);
        await bankDetailsPage.isDisplayed(bankDetailsPage.confirmationOfUpdateText)
        .then(isVisible =&gt; expect(isVisible).toBeTruthy())
        .then(done, done.fail);
        }, 60000);
  </code></pre>
  
  <p>However, when handling a promise rejection like this I'm experiencing very flaky tests whereby intermittently the promise is rejected and as a result the test fails, stating an element couldn't be found; however upon further investigation the element was present. I've now chosen not to handle a promise rejection prior to the assertion.</p>
  
  <p>I understand a test should only fail on an assertion but often with e2e tests, I find they experience issues prior to the assertion in some instances. </p>
  
  <p>Should we be worried about this warning? If so how should we handle promise rejections that occur prior to the assertion?</p>
  
  <p>Thanks in advance. </p>