webdriverio-boneyard / wdio-sync

A WebdriverIO v4 plugin. Helper module to run WebdriverIO commands synchronously.
http://v4.webdriver.io
MIT License
17 stars 31 forks source link

Fix async tests in jasmine #34

Closed kurtharriger closed 8 years ago

kurtharriger commented 8 years ago

This fixes https://github.com/webdriverio/wdio-jasmine-framework/issues/13 where jasmine test does not wait on promises returned by the it block.

The root cause is that jasmine determines if it should run a test in async or sync mode based on the number of arguments the function provided to it takes. If the argument length is 0, then jasmine does not wait for the done to be called.

This modifies runSpec to always run in jasmine async mode, wrapping non-promise results in promise that resolves immediately.

Tested by using npm link wdio-sync into both wdio-jasmine-framework andwdio-mocha-framework to ensure changes support both frameworks.

Also tested with example project originally reproducing the issue here. webdriverio-async-jasmine-tests

christian-bromann commented 8 years ago

One small comment, otherwise LGTM

christian-bromann commented 8 years ago

Thanks! 👍

christian-bromann commented 8 years ago

Will publish it later today