使用 async/await 的 Webdriverio - 推荐什么?
Webdriverio using async/await - What is recommended?
我正在 运行 我的功能测试使用 WebdriverIO。即使没有 async/await
,我也可以让 WebdriverIO 测试通过。但我读过一些文章,认为 async/await
是编码 javascript 以处理承诺的最佳方式。
我是 Javascript 的新手,对承诺很迷茫。在 WebdriverIO 中编码的最佳方式是什么(使用 async/await,或者不使用 | 例如:在配置中关闭同步并使用它?)
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
WebdriverIO 仍在后台使用 async/await,它只是为您处理。我肯定会推荐使用 'sync' 模式,因为它可以减少测试的冗长程度。
我正在 运行 我的功能测试使用 WebdriverIO。即使没有 async/await
,我也可以让 WebdriverIO 测试通过。但我读过一些文章,认为 async/await
是编码 javascript 以处理承诺的最佳方式。
我是 Javascript 的新手,对承诺很迷茫。在 WebdriverIO 中编码的最佳方式是什么(使用 async/await,或者不使用 | 例如:在配置中关闭同步并使用它?)
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
WebdriverIO 仍在后台使用 async/await,它只是为您处理。我肯定会推荐使用 'sync' 模式,因为它可以减少测试的冗长程度。