简体   繁体   English

WebdriverIO 在所有测试套件结束时运行的脚本

[英]WebdriverIO the script that runs at the end of all test suites

I have a script that needs to be run after passing all the tests, how can this be done in Wdio?我有一个脚本需要在通过所有测试后运行,这在 Wdio 中如何完成?

after: async function () {
    await deleteAllDataFromAccount()
},

Such code in the configuration file does not help.配置文件中的此类代码无济于事。 How to solve this problem?如何解决这个问题呢?

I'm not sure I understand properly, but you want to run this method after a suite ends?我不确定我是否理解正确,但您想在套件结束后运行此方法? For this you have afterSuite hook.为此你有afterSuite钩子。

If you want to run it after all tests from all of suites, you have onComplete hook.如果你想在所有套件的所有测试之后运行它,你有onComplete钩子。 Please see the configuration file example from wdio docs ( https://webdriver.io/docs/configurationfile ).请参阅 wdio 文档 ( https://webdriver.io/docs/configurationfile ) 中的配置文件示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM