pranav kumar
pranav kumar

Reputation: 51

how to read sms while testing in appium or selenium

While testing of Android and iOS app. This is a Provisioning Screen of my app, A OTP Usecase comes up which stops further testing of App. Usecase is.

When user enters the mobile number in app's starting page where instruction was . After tap on send button a another text box for OTP option comes up on app's screen. Upto this point, it is possible to record/playback. But after this, we stops our process.

Because this usecase is not possible to automate our app for further processings.

Here, OTP comes via SMS and for verification purpose user needs to enter the OTP(one time passcode) which comes via SMS. So, my complication is ...
How to check OTP from sms app of device, and return back to testing app and enter the verification code into it. this step validate the user and app appears for user. My query is... How can i test this use case using automation? Please help me because this blocks my complete further testings.

Upvotes: 5

Views: 3291

Answers (2)

Baradé
Baradé

Reputation: 1342

I could not find any abstract functionality in Appium so far. You could try this for Android only:

adb shell content query --uri content://sms

and handle the resulting output. I found this question about IOS: How to programmatically read incoming text messages on iOS

It is very sad that there is no generic function in Appium.

Upvotes: 0

Keshav
Keshav

Reputation: 425

I think we cannot navigate from one application to another application with a single test as we are passing capabilities of test application only and we cannot work with another application.

However a workaround you can try is:
1. With first test, send the OTP from test application.
2. With second test, get the OTP copied to your clipboard from message box(you can get the application package/activity using any of the open source applications in android).
3. With third test, Paste/enter that OTP in your application.

Hope this will help!

Upvotes: -1

Related Questions