微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用 testRigor 测试短信 (SMS)?

如何解决如何使用 testRigor 测试短信 (SMS)?

我正在使用 testRigor,我们的系统会发送短信。如何测试是否已收到短信?

解决方法

可以通过使用 Twilio。您可以前往 https://www.twilio.com/ 创建一个 Twilio 帐户并从他们那里获取您的第一个电话号码。甚至可以使用他们的免费版本。 完成后,您可以转到 Twilio 仪表板并获取帐户 SID、身份验证令牌和电话号码。然后,您可以转到 testRigor 并在 Twilio 部分下的设置/集成中指定这 3 个参数。 完成此操作后,您可以在系统上使用从 Twilio 获得的电话号码,然后您将能够使用以下 testRigor 代码(假设您从 Twilio 获得的电话号码是 +12345678902):

check that sms to "+12345678902" is delivered

例如,2 因素身份验证登录测试可能如下所示:

click "Sign in"
enter "jacob" into "Username"
enter "jacobs-secure-password" into "Password"
click "Verify me"
check that sms to "+12345678902" is delivered and matches regex "Code\:\d\d\d\d" and save it as "sms"
extract value by regex "(?<=Code\:)[0-9]{4}" from "sms" and save it as "confirmationCode"
enter saved value "confirmationCode" into "code"
click "Continue to Login"
check that page contains text "Welcome,Jacob!"

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。