0

I am using javascript, nodejs, npm, wdio, cucumber in my testing automation framework.

In my main project root folder I have wdio.conf.js file. Suppose there is a dependency in node_modules folder with its own wdio.conf.js file. And suppose both wdio.conf.js has afterScenario() hook.

Two queries:

1)I want to ask which wdio.conf.js file will be run and which afterScenario() hook will be run?

2)Suppose I want to run afterScenario() hook in both wdio.conf.js files. How can I do this?

EDIT:

ROOT FOLDER:

|-some file

|-wdio.conf.js (contains afterScenario() hook)

|-package.json

|-nodes_module

       |-dependency1
    
             |-Some files
    
             |-package.json
      
             |-wdio.conf.js (also contains afterScenario() hook)
    
       |-dependency2

   
a Learner
  • 4,944
  • 10
  • 53
  • 89

1 Answers1

1

I don't think I completely understood your question. So let me ask you this, would having something like this in your package.json help?

"scripts": {
  "test1": "wdio wdio.conf1.js",
  "test2": "wdio wdio.conf2.js"
}

Where in wdio.conf1.js you would have 1 afterScenario() hook and in the wdio.conf2.js you would have a different afterScenario() hook. So if you rename your local wdio configuration may be enough to fix your issue? Let me know if this helps!

  • But in this way i will be able to run one wdio.conf.js at one time. For example, `>npm test1` will run only wdio.conf1.js. By the way I have edit my question. If you can please have a look at it. – a Learner Mar 13 '23 at 15:08