0

Hello :) I have a problem and was wondering how to deal with it correctly. I have 2 application first one is like admin portal where I need to do initial setup and then rest if automated tests will run on different app that is using this initial setup. Since I don’t have access to database etc. I created a suite for that admin app and then suites for second application.

I want to run first suite just one before any other, so I wanted to execute it inside opPrepare function, is it possible ? Should it be executed as CLI argument and if so can CLI be invoked inside opPrepare?

version: @wdio/runner@5.11.14

Thanks

vertigo448
  • 45
  • 1
  • 6

1 Answers1

0

We are doing a similar thing using onPrepare hook.

We are validating all our test data and availability of endpoints in this hook. Based on this, we are deciding whether to execute the test suite or not. But we are doing this through Nodejs code and not using browser instance.

the code looks something like below.

onPrepare() {
validateTestData();
validateServices();
}

But if you are trying to run UI tests through this, it may not be possible as browser instance is not available in this hook.

Raju
  • 1,314
  • 2
  • 10
  • 14
  • Hi thanks for quick answer could You share some code snippet of Yours onprepare? If I cannot run browser instance there maybe I could connect to MSSQL to set some data. – vertigo448 Feb 12 '20 at 20:38
  • I am sorry but I may not be able to share the code here. But I can assure you that you can connect to MsSQL through nodeJS code. Here is a repo which might help you. https://github.com/mysqljs/mysql – Raju Feb 12 '20 at 20:44