Hello Friends 👋,
Welcome To Infinitbility! ❤️
React Native detox tutorial
2. React native detox multiple typeText crash issues
3. React native detox with react navigation example
4. react-native-date-picker detox example
5. react-native-otp-input detox example
react-native-otp-input package not provides option to test by detox using testID but i have found some hack and i’m going to share with you guys.
Today, we will learn how we can test react-native-otp-input using detox in react native.
Lets start with code example.
describe('register flow', () => {
it('should able to enter otp', async () => {
await waitFor(element(by.id('OTPInputView'))).toExist();
await element(by.text('').withAncestor(by.id('OTPInputView'))).atIndex(0).replaceText('1');
await element(by.text('').withAncestor(by.id('OTPInputView'))).atIndex(0).replaceText('2');
await element(by.text('').withAncestor(by.id('OTPInputView'))).atIndex(0).replaceText('3');
await element(by.text('').withAncestor(by.id('OTPInputView'))).atIndex(0).replaceText('4');
});
});
In my case, i have a OTP input of 4 boxes you can also use for more then 4 boxes.
Thanks for reading…