does anyone know how to automate OTP (sms) login?
@istle_z If you really donโt have the option to have a proper test environment with an option to turn it off, then SMS Gateway API would be a way to go.
SMS Gateway API allows you to send and receive SMS messages using API calls by interacting with the SMS gateway of a service provider. You can use these APIs for testing within your test code to ensure that your SMS functionality works as expected.
Thanks, Iโll give it a go
Itโs hard to suggest a specific one without knowing the project and automation requirements but ping me if you need any help. Maybe Iโll be able to give a hint or something
I believe by far the easiest way is to use testRigor. Hereโs the video: Tips & Tricks - Two Factor Authentication & SMS Testing - testRigor AI-Based Automated Testing Tool disclaimer: Iโm a co-founder of testRigor
I have found Twilio to be good enough for this.
Thanks, Iโll give it a trial.
Thank you, Artem, itโs my pleasure. Iโll give testRigor a trial.
Twilio or a testing service like Mailinator are great. You can get an SMS phone number (supplied by Twilio) and Mailinator provides an API to get whatever data / messages are sent to it.
Two ways:
- Use a service like MITM proxy to intercept the API call and grab the code from the call. This test would be fast and hermetic.
- Use a service like twilio.
I sometimes set up end to end tests that can run with both modes. I run 1 in CI very frequently. 2 I run much less frequently - itโs slower, costs money, etc. but is helpful if/when the OTP code changes and can detect bugs caused by the API changing.