Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selenium-side-runner command "store" import external parameters does not work. #1854

Open
spea1 opened this issue Aug 7, 2024 · 0 comments

Comments

@spea1
Copy link

spea1 commented Aug 7, 2024

Hi, I am trying to use external parameters, e.g. with Windows variables, "--params" or "env" input in the .side.yml file, in a functioning project side-file, unfortunately it does not work. The value of the variables is not transferred:

info: echo: Env MYUSERNAME: ${MYUSERNAME}, Env MYPASSWORD: ${MYPASSWORD}

Selenium Grid is run under WSL Docker and selenium-side-runner under Windows.

WSL-Version: 2.3.14.0
Kernelversion: 6.6.36.3-1
Microsoft Windows Server 2022 [Version 10.0.20348.2461]
C:>%USERPROFILE%\AppData\Roaming\npm\selenium-side-runner.cmd --version
4.0.12

Docker container:
Selenium Grid 4.23.0 (revision 77010cd)
chrome {"browserName":"chrome","browserVersion":"127.0","goog:chromeOptions":{"binary":"/usr/bin/google-chrome"},"platformName":"linux","se:containerName":"","se:noVncPort":7900,"se:vncEnabled":true}

Test.side file

...
"commands": [
{
"command": "echo",
"target": "Env MYUSERNAME: ${MYUSERNAME}, Env MYPASSWORD: ${MYPASSWORD}",
"value": "",
"id": "62047056-d94c-4b1d-8225-830dcc376e45"
},
{
"command": "store",
"target": "${MYUSERNAME}",
"value": "storedUsername",
"id": "8d9cc6ab-f7ec-4649-bdbc-9dcb42d59e53"
},
{
"command": "store",
"target": "${MYPASSWORD}",
"value": "storedPassword",
"id": "53475d8a-63ef-4337-b261-bfc446da22b7"
},
{
"command": "echo",
"target": "Username is: ${storedUsername} and Password is: ${storedPassword}",
"value": "",
"id": "fbff3d44-b897-42a9-9906-196623e64044"
},
{
"id": "ea00a4ed-b33e-4238-9de8-0509b55e4a6b",
"comment": "",
"command": "setWindowSize",
"target": "1280x800",
"targets": [],
"value": ""
},
...

Test: --params

set MYUSERNAME=demo
set MYPASSWORD=demo
%runner_CMD% %TEST% --output-directory=results --config-file %TestCase_Dir%.side.yml --params "MYUSERNAME=%MYUSERNAME% MYPASSWORD=%MYPASSWORD%" --server %Remote_URL%

error: unknown option '--params'

Test: Windows variables

set MYUSERNAME=demo
set MYPASSWORD=demo
%runner_CMD% %TEST% --output-directory=results --config-file %TestCase_Dir%.side.yml --server %Remote_URL%

Debug output:
Configuration: {
baseUrl: 'about:blank',
capabilities: {
browserName: 'chrome',
version: '128.0',
platform: 'linux',
acceptInsecureCerts: true,
'goog:chromeOptions': { args: [Array] }
},
debug: true,
debugConnectionMode: undefined,
debugStartup: true,
filter: '.*',
force: undefined,
maxWorkers: 4,
screenshotFailureDirectory: undefined,
projects: [
'e:\SpeedTest.side'
],
proxyOptions: {},
proxyType: undefined,
retries: 0,
runId: 'c4f0c2f9fe3e60390b6f85cccd7a6648',
path: 'C:\Users\Usr\AppData\Roaming\npm\node_modules\',
server: 'http://127.0.0.1:4444/wd/hub',
jestTimeout: 60000,
timeout: 15000
}
Jest command: node C:\Users\User\AppData\Roaming\npm\node_modules\selenium-side-runner\node_modules\jest\bin\jest.js [
'--config=C:\Users\User\AppData\Roaming\npm\node_modules\selenium-side-runner\runner.jest.config.js',
'--maxConcurrency=4',
'--json',
'--outputFile=results\results-2024-08-07T16-31-10.934Z.json',
'--runTestsByPath',
'C:\Users\User\AppData\Roaming\npm\node_modules\selenium-side-runner\dist\main.test.js'
] {
..
MYPASSWORD: 'demo',
MYUSERNAME: 'demo',

  Remote_URL: 'http://127.0.0.1:4444/wd/hub',
  runner_CMD: 'C:\\Users\\User\\AppData\\Roaming\\npm\\selenium-side-runner.cmd',
  ...
  SE_CONFIGURATION: '{"baseUrl":"about:blank","capabilities":{"browserName":"chrome","version":"128.0","platform":"linux","acceptInsecureCerts":true,"goog:chromeOptions":{"args":["incognito"]}},"debug":true,"debugStartup":true,"filter":".*","maxWorkers":4,"projects":["e:\\\\SpeedTest.side"],"proxyOptions":{},"retries":0,"runId":"c4f0c2f9fe3e60390b6f85cccd7a6648","path":"C:\\\\Users\\\\User\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\","server":"http://127.0.0.1:4444/wd/hub","jestTimeout":60000,"timeout":15000}'
}
info: Running test SpeedTest
debug: Playing state changed prep for test SpeedTest
debug: Playing state changed playing for test SpeedTest
debug: executing echo|Env MYUSERNAME: ${MYUSERNAME}, Env MYPASSWORD: ${MYPASSWORD}
info: echo: Env MYUSERNAME: ${MYUSERNAME}, Env MYPASSWORD: ${MYPASSWORD}
debug: passed echo|Env MYUSERNAME: ${MYUSERNAME}, Env MYPASSWORD: ${MYPASSWORD}
debug: executing store|${MYUSERNAME}|storedUsername
debug: passed store|${MYUSERNAME}|storedUsername
debug: executing store|${MYPASSWORD}|storedPassword
debug: passed store|${MYPASSWORD}|storedPassword
debug: executing echo|Username is: ${storedUsername} and Password is: ${storedPassword}
info: echo: Username is: ${MYUSERNAME} and Password is: ${MYPASSWORD}
debug: passed echo|Username is: ${storedUsername} and Password is: ${storedPassword}
debug: executing setWindowSize|1280x800
debug: passed setWindowSize|1280x800

Env from .side.yml: the variables are taken over, but the same behavior as above

%runner_CMD% %TEST% --output-directory=results --config-file %TestCase_Dir%.side.yml --server %Remote_URL%

.side.yml - file:
debug: true
#debugConnectionMode: true
debugStartup: true
baseUrl: "about:blank"
capabilities:
browserName: "chrome"
version: "128.0"
platform: "linux"
acceptInsecureCerts: true
goog:chromeOptions:
args:
- incognito
env:
MYUSERNAME: "demo"
MYPASSWORD: "demo"

Debug output:
...
server: 'http://127.0.0.1:4444/wd/hub',
jestTimeout: 60000,
timeout: 15000,
env: { MYUSERNAME: 'demo', MYPASSWORD: 'demo' }
}

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant