wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.23k stars 1.92k forks source link

How can I test when app requires OTP via SMS? #3006

Closed ZineAoraya closed 2 years ago

ZineAoraya commented 3 years ago

How can I test when app requires OTP via SMS?

indradeepchowdhury commented 3 years ago

You may use a third party service like Twilio. They provide api's to manage phone numbers and also allow you to read the sms.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

noomorph commented 2 years ago

@d4vidi do we have a solution? Or we should just tell to mock this?

MuckT commented 2 years ago

We had a use case that was similar and ended up going the route that @indradeepchowdhury mentioned and ended up using the Twilio API.

d4vidi commented 2 years ago

Typically, we would advise testing in a more stable mocked environment. Namely, running the (login?) flow all the way to the OTP, mocking away the OTP service itself, and only making sure it was triggered properly using your mock. For example, render a screen showing which args were passed to it and asserting them using toBeVisible() calls.

If, nevertheless, you need to test this E2E in an unmocked (though potentially flaky) way, you might want to consider using twillio's OTP solution, as suggested.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

stale[bot] commented 2 years ago

The issue has been closed for inactivity.