tnicola / cypress-parallel

Reduce up to 40% your Cypress suite execution time parallelizing the test run on the same machine.
MIT License
560 stars 117 forks source link

How do I pass environment variable as arguments in command line #163

Open tausif29 opened 1 year ago

tausif29 commented 1 year ago

"cy:run": "npx cypress run --browser chrome", "cy:parallel" : "cypress-parallel -s cy:run -t 4 -d cypress/e2e/features/ -m false -a '\"--env ENV=${ENVI}\"'",

I have above script command, I want to pass ENVI as LIVE or QA System is not accepting the environment variable in above command

Can you share how do I pass the the arguments in above command?

KeenanBailey commented 1 year ago

windows cmd: "cy:open": "cypress open -C cypress/config/%npm_config_envi%.config.js", cross-var cmd: "cy:run": "cross-var cypress run -C cypress/config/$npm_config_envi.config.js",

execution cmd: npm run cy:open --envi=live

antonio-junior commented 4 months ago

@tausif29 were you able to make it work?

antonio-junior commented 4 months ago

it worked by using:

cy:run:test": "cross-var cypress-parallel -s cy:run -t 6 -d cypress/e2e/features/* -a '\"--env env=$npm_config_env\"'"

tausif29 commented 4 months ago

Yes it worked for me with below 2 commands:

$env:ENVI="QA"
npm run cy:parallel