import { ChainableElement } from '../../common/types' ; import { OperatorUser } from '../helpers' ; export default class ExploitLoginPage { exploitRootUrl : string ; exploitLoginPath : string ; constructor ( exploitRootUrl ) { this . exploitRootUrl = exploitRootUrl ; this . exploitLoginPath = '/login' ; } get usernameInput ( ) : ChainableElement { return cy . get ( 'input[name="username"]' ) ; } get passwordInput ( ) : ChainableElement { return cy . get ( 'input[name="password"]' ) ; } get totpInput ( ) : ChainableElement { return cy . get ( 'input[name="_totp"]' ) ; } get loginButton ( ) : ChainableElement { return cy . get ( 'button[type="submit"]' ) ; } checkIsVisible ( ) { cy . url ( ) . should ( 'includes' , `${ this . exploitRootUrl }${ this . exploitLoginPath }` ) ; } login ( user ) { this . usernameInput . clear ( ) . type ( user . username ) ; this . passwordInput . clear ( ) . type ( user . password , { log : false } ) ; user . wrapTotp ( ) . then ( ( totp ) => this . totpInput . clear ( ) . type ( totp ) ) ; this . loginButton . click ( ) ; } }