zinserjan / wdio-screenshot

A WebdriverIO plugin. Additional commands for taking screenshots with WebdriverIO.
MIT License
109 stars 43 forks source link

Still failing with mocha async #58

Closed mparpaillon closed 7 years ago

mparpaillon commented 7 years ago

I'm trying to make it work with the mocha framework, but I can't get it to work.

I keep on having this error

Timeout of 10000ms exceeded. Try to reduce the run time or increase your timeout for test specs (http://webdriver.io/guide/testrunner/timeouts.html); if returning a Promise, ensure it resolves.

I've been trying to change "sync" property to true, add "asyncOnly" of "mochaOpts" to true too, and my test looks like that

it("captures Account view", function() {
  browser.url("/account");

  return browser.saveElementScreenshot(`${outputPath}/AccountView.png`, ".Account-View");
});

Would love some help, thx :)

zinserjan commented 7 years ago

change "sync" property to true, add "asyncOnly" of "mochaOpts" to true

You answered your own question already. Both options together makes no sense.

Closing as it has nothing to do with wdio-screenshot.

PS: Have a look at https://github.com/zinserjan/webdriverio-example. If you don't want the async/await stuff, just set sync:true in wdio.conf and remove all async/await.

Also there is a gitter chat for webdriverio to ask questions like this: Gitter

mparpaillon commented 7 years ago

I tried every combinations of those optios (but indeed this one was stupid). Anyway I managed to make it work by just making everything synchronous. wdio-screenshot uses async/await apparently and once transpiled doesn't seem to return a Promise. So I just set a ridiculously huge timeout and make it all synchronous. No more errors... Thanks for the lib