Different global variables depending on capabilities
Is there a way calling a different set of static variables depending on what capability is used. For example if I'm testing in Chrome and IE, could I use different login credentials to enable me to run tests concurrently that might not possible if restricted to using the same user (due to the way the the app in test handles sessions).
Thanks
I do something similar, generating individual user names per browser so i can ran e2e in parallel:
// Sample returns: 'user1_ie10', 'user1_ch', 'user1_ff', 'user2_ie9', 'user3_ie11', ...
function getUserName(idx) {
return 'user' + idx + '_' + browser.getShortNameVersion();
};
You will need to put bellow gist code within an onPrepare file or section:
https://gist.github.com/elgalu/82929eeeef4a80e01835#file-onprepare-conf-js
Thanks, just what I was looking for!
@juliemr Would you be interested in merging some of that gist code into protractor core?
I imagine many users might enjoy asking handy questions without going through getCapabilities() every time, i.e.
browser.getShortBrowserName(); //=> 'ch' / 'ff' / 'sa' / 'ie'
browser.isInternetExplorer(); //=> true / false
browser.isInternetExplorer(11); //=> true / false
browser.isInternetExplorer(9); //=> true / false
browser.isSafari(); //=> true / false
browser.inWindows(); //=> true / false
browser.inOSX(); //=> true / false
// .... and so on ...
@elgalu i am trying to set the global variable from onPrepare() method using browser.variablename and try to get value in spec using browser.variablename but i am not getting. I have also tried global instead of browser but still it is not working.