title: WebdriverIo For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves
body: <p>I have already seen this <a href="https://stackoverflow.com/questions/44149096/for-async-tests-and-hooks-ensure-done-is-called-if-returning-a-promise-en">solution</a>, but it did not help.</p>
  
  <p>I am trying to run webdriver.io tests using mocha, here I am using browser.waitUntil() method from webdriver.io, more details can be found here: <a href="https://webdriver.io/docs/api/browser/waitUntil.html" rel="nofollow noreferrer">https://webdriver.io/docs/api/browser/waitUntil.html</a>
  I have tried a different solution to the issue including adding 'done' to the method call and also I am giving max timeout in conf.js as well here 10000ms, but still, the page seems to get hang on the result page.</p>
  
  <p>Here increase timeout:</p>
  
  <pre><code>   mochaOpts: {
          ui: 'bdd',
          timeout: 100000
      },
  </code></pre>
  
  <p>Changed default wait time of mocha to at 100000ms 
  Added done as promise resolution</p>
  
  <pre><code>it('should see product and version selected', () =&gt; {
          browser.url('//some url');
          browser.maximizeWindow();
          browser.waitUntil(() =&gt; {
              return $(ProductPage.productSelector()).isDisplayed()
          }, 100000, 'expected page is loaded');
          let productSelector = ProductPage.otherProductSelector();
          let isEnabled = productSelector.isEnabled();
          if(isEnabled == true){
              const spanEle = $('//span[contains(text(),"text")]');
              isDisplayed = spanEle.isDisplayed();
              console.log(isDisplayed);
              assert.equal(isDisplayed, true, "Passed");
          }
      })
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Timeout of 100000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. 
  </code></pre>