-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
What happened?
In a TextInput
with a maxLength
prop set, calling replaceText
with a string that has a length over half of the maxLength
causes the string to be repeated at the start of the input.
For example
<TextInput testID='testInput' maxLength={10} >
element(by.id('testInput')).replaceText('abcdef');
causes the TextInput
value to become abcdabcdef
It seems this was reported back in 2018 but wasn't addressed. #921
What was the expected behaviour?
That replaceText
would only enter the specified string once in the TextInput
Was it tested on latest Detox?
- I have tested this issue on the latest Detox release and it still reproduces.
Did your test throw out a timeout?
- I have followed the instructions under Identifying which synchronization mechanism causes us to wait too much.
Help us reproduce this issue!
- Create a TextInput component with a maxLength, e.g.
maxLength={10}
- In a test, call
replaceText
on the above TextInput using a string with a length >= half of the maxLength, e.g.'abcdef'
- Run the test and see the TextInput value become
abcdabcdef
In what environment did this happen?
Detox version: 19.9.0
React Native version: 0.66.4
Node version: 16.14.0
Device model: iPhone 13
iOS version: 15.2
Test-runner (select one): jest-circus
Detox logs
Detox logs
15:16:18.746 detox[98658] TRACE: [WS_SEND] {"type":"invoke","params":{"type":"action","action":"replaceText","params":["abcdef"],"predicate":{"type":"id","value":"TEST"}},"messageId":18}
15:16:18.746 detox[98658] TRACE: [WSS_GET_FROM, #tester] {"type":"invoke","params":{"type":"action","action":"replaceText","params":["abcdef"],"predicate":{"type":"id","value":"TEST"}},"messageId":18}
15:16:18.746 detox[98658] TRACE: [WSS_SEND_TO, #app] {"type":"invoke","params":{"type":"action","action":"replaceText","params":["abcdef"],"predicate":{"type":"id","value":"TEST"}},"messageId":18}
15:16:20.346 detox[98658] TRACE: [WSS_GET_FROM, #app] {"params":{},"messageId":18,"type":"invokeResult"}
15:16:20.346 detox[98658] TRACE: [WSS_SEND_TO, #tester] {"params":{},"messageId":18,"type":"invokeResult"}
15:16:20.347 detox[98658] TRACE: [WS_MESSAGE] {"params":{},"messageId":18,"type":"invokeResult"}
Device logs
Device logs
paste logs here!
More data, please!
No response
adamhongmy and gogolubev