0

I created 3 jenkins jobs linked to the same github project, i'm using wdio v5 and cucumber, i want to run each job on a different port this is why i'm trying to pass the port from the jenkins post-build task : execute shell I tryed this -- --seleniumArgs.seleniumArgs= ['-port', '7777'] then this -- --seleniumArgs.seleniumArgs= ["-port", "7777"] then -- --seleniumArgs.seleniumArgs= '-port: 7777' but nothing works

mehdi
  • 47
  • 1
  • 8

1 Answers1

1

i found a solution :

so this is the wdio.conf.js file :

var myArgs = process.argv.slice(2);
Port= myArgs[1]

    exports.config = {

    ////////////////////////

services: ['selenium-standalone'],
seleniumArgs: {
seleniumArgs: ['-port', Port]
},

//////////////////////

}

myArg will receive an array with the arguments passed in the command line

and this is the command

npm test 7777 -- --port 7777

the 7777 is the argument number 2, thus the index 1 in the array, the index 0 is : wdio.conf.js, which is in the "test" script in package.json ===> "test": "wdio wdio.conf.js"

mehdi
  • 47
  • 1
  • 8