import OperatorUser from './operator-user' ; const users = [ { password : Cypress . env ( 'EXPLOIT_USER_PASS' ) , role : 'exploitant' , secretTotp : Cypress . env ( 'EXPLOIT_USER_TOTP' ) , username : Cypress . env ( 'EXPLOIT_USER_NAME' ) , } , { password : Cypress . env ( 'EXPLOIT_ADMIN_PASS' ) , role : 'administrateur' , secretTotp : Cypress . env ( 'EXPLOIT_ADMIN_TOTP' ) , username : Cypress . env ( 'EXPLOIT_ADMIN_NAME' ) , } , ] ; export const getOperatorUserByType = ( userType ) : OperatorUser => { const userData = users . find ( ( user ) => user . role === userType ) ; const operatorUser = new OperatorUser ( userData ) ; expect ( operatorUser , `No operator user found with type '${ userType }'` ) . to . exist ; cy . wrap ( operatorUser ) . as ( 'operatorUser' ) ; return operatorUser ; } ;