1

I have a script that needs to be run after passing all the tests, how can this be done in Wdio?

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

Such code in the configuration file does not help. How to solve this problem?

Or Assayag
  • 5,662
  • 13
  • 57
  • 93
s3202
  • 11
  • 1

1 Answers1

0

I'm not sure I understand properly, but you want to run this method after a suite ends? For this you have afterSuite hook.

If you want to run it after all tests from all of suites, you have onComplete hook. Please see the configuration file example from wdio docs (https://webdriver.io/docs/configurationfile).

  • When using the onComplete hook, an error of the type falls: it is not possible to read the undefined properties (reading 'stack') in C:\project\e2e_tests\node_modules\@wdio\cli\build\utils.js:88:53 in asyncPromise.all (index 0) in the launcher.execute (C:\project\e2e_tests\node_modules\@wdio\cli\build\launcher .js:94:39 ) – s3202 Dec 07 '22 at 17:15