How to pass the baseUrl parameter from Jenkins to wdio.conf.js?

  1. In Jenkins in Source code management through Git i am handing over JS project with tests written in WebdriverIO
  2. Next i do Build Steps npm install and npm test and tests run
    To pass a parameter to wdio.conf.js in Jenkins i add parameterized assembly "BASEURL" 2022-12-01_16-36-13
    Next i do Build Steps npm install and npm wdio run ./wdio.conf.js --baseUrl $BASEURL 2022-12-01_16-37-22
    in the console I get:
TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:372:5)
    at URL.onParseError (node:internal/url:553:9)
    at new URL (node:internal/url:629:5)
    at new URL (node:internal/url:626:22)
    at Browser.url (C:\Users\User\.jenkins\workspace\test\node_modules\webdriverio\build\commands\browser\url.js:45:17)
    at Browser.wrapCommandFn (C:\Users\User\.jenkins\workspace\test\node_modules\@wdio\utils\build\shim.js:137:38)
    at async Context.<anonymous> (C:\Users\User\.jenkins\workspace\test\test\specs\example.e2e.js:6:9)

although this command works in my PHPStorm
But the parameter is not passed, please tell me how to implement it?

Hi,

Are you using a FreeStyle project?

Hello, is it the FreeStyle project.

I recommend adding an echo before the npx to verify all your parameters, or failing that set +x before your statement, just to see what the value is.

At first glance what you’ve done should work but we’d need more information.

WAIT WAIT WAIT

The second screenshot says windows, env variables in windows are %VARNAME% not $VARNAME

so try npx wdio run ./wdio.conf.js --baseUrl %BASEURL%

3 Likes

Thank you very much it helped

1 Like

Thanks a lot for your feedback @Serhii .

1 Like