mammoth-electrician-64243
07/19/2022, 8:17 AMcypress run --browser
. In my setupNodeEvents
I define launch arguments. I see these in the console via a console.log
. However when chrome is opened by browser it seems this is ignored. I can see this by the result shown for the page. If I open the page normaly in chrome launched via the command bellow I get a message I made for you're on mobile. Chrome via command line C:\Program Files\Google\Chrome\Application\chrome.exe" --use-mobile-user-agent --user-agent="Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36"
. Code for `before:browser:launch`:```if (oConfig.oStartup.strBrowser === 'chrome') {
if (oConfig.oStartup.bTestMobile) {
launchOptions.args.push('--use-mobile-user-agent --user-agent="' + oConfig.oStartup.strMobileAgent + '"');
}
else if (oConfig.oStartup.bTestTablet) {
launchOptions.args.push('--use-mobile-user-agent --user-agent="' + oConfig.oStartup.strTabletAgent + '"');
}
return launchOptions
}```
Console log shows it is added to the arguments '--use-mobile-user-agent --user-agent="Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36"'
.
EDIT:
Got it working, you must do one argument per line, so do 2 args.push
in this case