trying to call run-multiple parallel with ---profile
looks like when running it parallel the codeceptjs ignore this param
Could you share your config?
I have suggestion, that browser in multiple section rewrote your process.profile || 'chrome' (as in example ) described in browser section in WebDriverIO section.
And this multiple browser does not include process.profile || 'chrome' expression.
the issue that I want to be able to pass parameters on start with flag profile it is working on codeceotjs run and should also work on parallel. what I am passing is user and pass.
My current workaround here is to avoid usage of --profile and instead use a separate config file with -c configs/…
Should be fixed with newest release 2.6 - use process.env.profile instead of process.profile.
I am using codeceptjs 2.6.6 and still seeing an issue with this. It looks like one codeceptjs instance is using the profile, but the second is undefined.
Test run output:
npx codeceptjs run-multiple parallel --profile dev
{
// printing our config urls
}
profile dev // console.log(process.env.profile)
{
// printing our config urls
}
profile undefined // console.log(process.env.profile)
I am using codeptjs 2.6.7 and process.env.profile is not parsed even when using chunks: 1
Looks like --profile is not passed to child processes using run-multiple.
For example, I want to pass a test URL as an argument: --profile env="https://test.com". I have a function to retrieve this by looking at the process.argv and returning when it matches. @pablopaul any suggestions on how to get this working?
I made a workaround function to get the config passed to the child processes, parse it and get the URL from there.
@paulcredmond can you please share us that function? It would benefit others.
Sure @idxn
This very much tailored for my needs which is to pass a string (URL) for Webdriver to use as the URL to be tested.
So it would look like: npm run e2e --profile env=https://URL.com
// Profile is passed to the first process and the config is passed to child processes, but --profile is not
// This function will search for the config in the process.argv, parse the JSON and find the URL
getEnvObject: (argsArray) => {
let url = null;
const env = argsArray.filter((el) => el.includes('WebDriver'));
const obj = env[0] || null;
if (obj) {
const parsedObj = JSON.parse(obj);
url = parsedObj.helpers.WebDriver.url || null;
}
return url;
},
let testUrl = 'http://localhost:3000/'; // default if no env= argument
const envObject = getEnvObject(process.argv);
// env= URL passed through config to child processes (run-multiple)
if (envObject) {
testUrl = envObject;
}
module.exports = {
testsFolder: './../tests/*_test.js',
testUrl: testUrl,
...rest of config