@@ -37,14 +37,14 @@ export async function type(
3737 const keys = parseKeys ( text ) ;
3838
3939 if ( ! options ?. skipPress ) {
40- dispatchEvent ( element , 'pressIn' , EventBuilder . Common . touch ( ) ) ;
40+ await dispatchEvent ( element , 'pressIn' , EventBuilder . Common . touch ( ) ) ;
4141 }
4242
43- dispatchEvent ( element , 'focus' , EventBuilder . Common . focus ( ) ) ;
43+ await dispatchEvent ( element , 'focus' , EventBuilder . Common . focus ( ) ) ;
4444
4545 if ( ! options ?. skipPress ) {
4646 await wait ( this . config ) ;
47- dispatchEvent ( element , 'pressOut' , EventBuilder . Common . touch ( ) ) ;
47+ await dispatchEvent ( element , 'pressOut' , EventBuilder . Common . touch ( ) ) ;
4848 }
4949
5050 let currentText = getTextInputValue ( element ) ;
@@ -66,12 +66,12 @@ export async function type(
6666 await wait ( this . config ) ;
6767
6868 if ( options ?. submitEditing ) {
69- dispatchEvent ( element , 'submitEditing' , EventBuilder . TextInput . submitEditing ( finalText ) ) ;
69+ await dispatchEvent ( element , 'submitEditing' , EventBuilder . TextInput . submitEditing ( finalText ) ) ;
7070 }
7171
7272 if ( ! options ?. skipBlur ) {
73- dispatchEvent ( element , 'endEditing' , EventBuilder . TextInput . endEditing ( finalText ) ) ;
74- dispatchEvent ( element , 'blur' , EventBuilder . Common . blur ( ) ) ;
73+ await dispatchEvent ( element , 'endEditing' , EventBuilder . TextInput . endEditing ( finalText ) ) ;
74+ await dispatchEvent ( element , 'blur' , EventBuilder . Common . blur ( ) ) ;
7575 }
7676}
7777
@@ -89,7 +89,7 @@ export async function emitTypingEvents(
8989 const isMultiline = element . props . multiline === true ;
9090
9191 await wait ( config ) ;
92- dispatchEvent ( element , 'keyPress' , EventBuilder . TextInput . keyPress ( key ) ) ;
92+ await dispatchEvent ( element , 'keyPress' , EventBuilder . TextInput . keyPress ( key ) ) ;
9393
9494 // Platform difference (based on experiments):
9595 // - iOS and RN Web: TextInput emits only `keyPress` event when max length has been reached
@@ -99,20 +99,20 @@ export async function emitTypingEvents(
9999 }
100100
101101 nativeState . valueForElement . set ( element , text ) ;
102- dispatchEvent ( element , 'change' , EventBuilder . TextInput . change ( text ) ) ;
103- dispatchEvent ( element , 'changeText' , text ) ;
102+ await dispatchEvent ( element , 'change' , EventBuilder . TextInput . change ( text ) ) ;
103+ await dispatchEvent ( element , 'changeText' , text ) ;
104104
105105 const selectionRange = {
106106 start : text . length ,
107107 end : text . length ,
108108 } ;
109- dispatchEvent ( element , 'selectionChange' , EventBuilder . TextInput . selectionChange ( selectionRange ) ) ;
109+ await dispatchEvent ( element , 'selectionChange' , EventBuilder . TextInput . selectionChange ( selectionRange ) ) ;
110110
111111 // According to the docs only multiline TextInput emits contentSizeChange event
112112 // @see : https://reactnative.dev/docs/textinput#oncontentsizechange
113113 if ( isMultiline ) {
114114 const contentSize = getTextContentSize ( text ) ;
115- dispatchEvent (
115+ await dispatchEvent (
116116 element ,
117117 'contentSizeChange' ,
118118 EventBuilder . TextInput . contentSizeChange ( contentSize ) ,
0 commit comments