我用的是testRigor,我们的系统会发送短信。如何测试文本消息是否已收到?
发布于 2021-05-19 00:55:27
这可以通过使用Twilio实现。你可以去https://www.twilio.com/创建一个Twilio帐户,并从他们那里获得你的第一个电话号码。甚至他们的免费版本也是可能的。完成后,您可以转到Twilio仪表板并获取帐户SID、身份验证令牌和电话号码。然后,您可以转到testRigor并在Twilio部分下的设置/集成中指定这3个参数。完成后,您可以在系统上使用从Twilio获得的电话号码,然后就可以使用以下testRigor代码(假设您从Twilio获得的电话号码是+12345678902):
check that sms to "+12345678902" is delivered
例如,双因素身份验证登录测试可能如下所示:
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!"
https://stackoverflow.com/questions/67590558
复制相似问题