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

How do I test a text message (SMS) with testRigor?

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

可以使用 Twilio. You can go to https://www.twilio.com/ 创建一个 Twilio 帐户并从他们那里获取您的第一个 phone 号码。他们的免费版本甚至是可能的。 完成后,您可以转到 Twilio 仪表板并获取帐户 SID、授权令牌和 Phone 号码。然后您可以转到 testRigor 并在 Twilio 部分下的 Settings/Integration 中指定这 3 个参数。 完成此操作后,您可以在系统上使用从 Twilio 获得的 phone 号码,然后您将能够使用以下 testRigor 代码(假设您从 Twilio 获得的 phone 号码是 +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!"