I'm facing a challenge with NightwatchJS as I attempt to configure multiple globals files based on different environments.
While the documentation at suggests that this can be achieved, I'm having trouble implementing it correctly. It seems that only a global file specified at the top level of the configuration file is being recognized, and any attempts to embed them within the environment nodes are being overlooked.
"chromeTR" : {
"persist_globals": true,
"globals": {
"Report":true
},
"desiredCapabilities": {
"browserName": "chrome",
"test_card" : "4111111111111111",
"test_alt_card" : "0000405060708090",
"chromeOptions": {
"args" : ["--no-sandbox"]
},
"cli_args" : {
"webdriver.gecko.driver" : "drivers/chromedriver"
}
}
},
This setup is necessary because I am creating a custom before
function that varies depending on the environment.
Furthermore, since this is the before
function, I am unable to utilize a globally defined variable from the environment to trigger a switch within the function itself, as the before
function lacks access to the browser object.