Navigate back to the homepage

react-native-otp-input detox example

Infinitbility
React Native, Detox
January 13th, 2022 · 1 min read
keep affilitate

Hello Friends 👋,

Welcome To Infinitbility! ❤️

React Native detox tutorial

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.

1describe('register flow', () => {
2 it('should able to enter otp', async () => {
3 await waitFor(element(by.id('OTPInputView'))).toExist();
4
5 await element(by.text('').withAncestor(by.id('OTPInputView'))).atIndex(0).replaceText('1');
6 await element(by.text('').withAncestor(by.id('OTPInputView'))).atIndex(0).replaceText('2');
7 await element(by.text('').withAncestor(by.id('OTPInputView'))).atIndex(0).replaceText('3');
8 await element(by.text('').withAncestor(by.id('OTPInputView'))).atIndex(0).replaceText('4');
9 });
10});

In my case, i have a OTP input of 4 boxes you can also use for more then 4 boxes.

Thanks for reading…

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

melio affilitate

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide

Tutorials

Categories

More articles from Infinitbility

Javascript remove whitespace from beginning and end of string

Javascript, how to remove space from start and end of string.

January 12th, 2022 · 1 min read

react-native-date-picker detox example

React Native, detox guide to test react-native-date-picker example

January 11th, 2022 · 1 min read
© 2020–2022 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]