@@ -4,6 +4,13 @@ import * as console from 'console';
44import * as path from 'path' ;
55import registerCypressGrep from '@cypress/grep/src/plugin' ;
66
7+ const getLoginCredentials = ( index : number ) : { username : string ; password : string } => {
8+ const users = ( process . env . CYPRESS_LOGIN_USERS || '' ) . split ( ',' ) . filter ( Boolean ) ;
9+ const userEntry = users [ index ] || '' ;
10+ const [ username = '' , password = '' ] = userEntry . split ( ':' ) ;
11+ return { username, password } ;
12+ } ;
13+
714export default defineConfig ( {
815 screenshotsFolder : './cypress/screenshots' ,
916 screenshotOnRunFailure : true ,
@@ -22,15 +29,23 @@ export default defineConfig({
2229 ) ,
2330 // User 0 credentials - as kubeadmin or even non-admin user
2431 // specifically for perses e2e tests, user0 is considered as console admin user to install COO and create RBAC roles and bindings
25- LOGIN_USERNAME : ( process . env . CYPRESS_LOGIN_USERS || '' ) . split ( ',' ) [ 0 ] ?. split ( ':' ) [ 0 ] || '' ,
26- LOGIN_PASSWORD : ( process . env . CYPRESS_LOGIN_USERS || '' ) . split ( ',' ) [ 0 ] ?. split ( ':' ) [ 1 ] || '' ,
32+ LOGIN_USERNAME : getLoginCredentials ( 0 ) . username ,
33+ LOGIN_PASSWORD : getLoginCredentials ( 0 ) . password ,
2734 // User 1 credentials
2835 // User 2 credentials
2936 // specifically for perses e2e tests, user1 and user2 are considered as perses e2e users to test RBAC access to dashboards
30- LOGIN_USERNAME1 : ( process . env . CYPRESS_LOGIN_USERS || '' ) . split ( ',' ) [ 1 ] ?. split ( ':' ) [ 0 ] || '' ,
31- LOGIN_PASSWORD1 : ( process . env . CYPRESS_LOGIN_USERS || '' ) . split ( ',' ) [ 1 ] ?. split ( ':' ) [ 1 ] || '' ,
32- LOGIN_USERNAME2 : ( process . env . CYPRESS_LOGIN_USERS || '' ) . split ( ',' ) [ 2 ] ?. split ( ':' ) [ 0 ] || '' ,
33- LOGIN_PASSWORD2 : ( process . env . CYPRESS_LOGIN_USERS || '' ) . split ( ',' ) [ 2 ] ?. split ( ':' ) [ 1 ] || '' ,
37+ LOGIN_USERNAME1 : getLoginCredentials ( 1 ) . username ,
38+ LOGIN_PASSWORD1 : getLoginCredentials ( 1 ) . password ,
39+ LOGIN_USERNAME2 : getLoginCredentials ( 2 ) . username ,
40+ LOGIN_PASSWORD2 : getLoginCredentials ( 2 ) . password ,
41+ LOGIN_USERNAME3 : getLoginCredentials ( 3 ) . username ,
42+ LOGIN_PASSWORD3 : getLoginCredentials ( 3 ) . password ,
43+ LOGIN_USERNAME4 : getLoginCredentials ( 4 ) . username ,
44+ LOGIN_PASSWORD4 : getLoginCredentials ( 4 ) . password ,
45+ LOGIN_USERNAME5 : getLoginCredentials ( 5 ) . username ,
46+ LOGIN_PASSWORD5 : getLoginCredentials ( 5 ) . password ,
47+ LOGIN_USERNAME6 : getLoginCredentials ( 6 ) . username ,
48+ LOGIN_PASSWORD6 : getLoginCredentials ( 6 ) . password ,
3449 TIMEZONE : process . env . CYPRESS_TIMEZONE || 'UTC' ,
3550 MOCK_NEW_METRICS : process . env . CYPRESS_MOCK_NEW_METRICS || 'false' ,
3651 COO_NAMESPACE : process . env . CYPRESS_COO_NAMESPACE || 'openshift-cluster-observability-operator' ,
0 commit comments