File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,14 +103,18 @@ Cypress.Commands.add('loginViaDescopeUI', () => {
103103 . find ( 'input' )
104104 . type ( loginID )
105105 cy . get ( 'descope-wc' )
106- . find ( 'button' ) . contains ( 'Continue' ) . click ( )
106+ . find ( 'descope- button' ) . contains ( 'Continue' ) . click ( )
107107 cy . get ( 'descope-wc' ) . find ( '.descope-input-wrapper' ) . find ( 'input' ) . should ( 'exist' ) // Assertion added to wait for the OTP code input to appear
108108 let otpCodeArray = Array . from ( otpCode ) ; // Convert the OTP code string to an array
109- for ( var i = 0 ; i < otpCodeArray . length ; i ++ ) {
110- cy . get ( 'descope-wc' ) . find ( '.descope-input-wrapper' ) . find ( 'input' ) . eq ( i + 1 ) . type ( otpCodeArray [ i ] , { force : true } )
111- }
109+ otpCodeArray . forEach ( ( digit , index ) => {
110+ cy . get ( `descope-text-field[data-id="${ index } "]` ) . then ( $element => {
111+ const input = $element [ 0 ] . shadowRoot . querySelector ( 'input' ) ;
112+ input . value = digit ;
113+ input . dispatchEvent ( new Event ( 'change' , { bubbles : true } ) ) ;
114+ } ) ;
115+ } ) ;
112116 cy . get ( 'descope-wc' )
113- . find ( 'button' ) . contains ( 'Submit' ) . click ( )
117+ . find ( 'descope- button' ) . contains ( 'Submit' ) . click ( )
114118 } )
115119 } )
116120} )
You can’t perform that action at this time.
0 commit comments