I am running my webdriverIO test cases using command npx wdio run .\wdio.conf.js --spec .\test\intel.test.js
Now I want to pass environment variable for the same like ENV=qa
If I run command like this ENV=qa npx wdio run .\wdio.conf.js --spec .\test\intel.test.js Getting error:
ENV=qa : The term 'ENV=qa' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
- ENV=qa npx wdio run .\wdio.conf.js --spec .\test\intel.test.js
is there any way to set environment variable when we are using npx to run test cases?
you can pass as like in the below command for user,key and baseurl which are all the allowed keys in wdio.conf.js.
npx wdio run .\wdio.conf.js --spec .\test\intel.test.js --user=automation
if you want to use any other parameters (like ENV as you mentioned), pls go with dotenv.