使用async / await的Webdriverio-建议采取什么措施?

时间:2019-01-02 14:47:49

标签: javascript webdriver-io

我正在使用WebdriverIO运行功能测试。即使没有async/await,我也可以通过WebdriverIO测试。但是我读过一些文章,async/await是编码JavaScript来处理Promise的最佳方法。

我是Java的新手,对诺言很迷茫。在WebdriverIO中编码的最佳方法是什么(是否使用异步/等待 |例如:在配置中关闭同步并使用它?

wdio.conf.js配置文件指出以下内容:

// By default WebdriverIO commands are executed in a synchronous way using
// the wdio-sync package. If you still want to run your tests in an async 
// e.g. using promises you can set the sync option to false.
//
sync: true

1 个答案:

答案 0 :(得分:2)

WebdriverIO仍然在后台使用async / await,它只是为您处理它。我绝对建议您使用“同步”模式,因为它可以减少测试的详细程度。