【发布时间】:2019-06-18 12:07:00
【问题描述】:
我在身份验证页面上运行 testcafe 测试,我可以看到 testcafe 在向网站发送请求时正在修改/删除/添加标头,这阻止了我在此页面上执行 2FA
一遇到问题,我就尝试使用 Selenium 进行自动化,以确认它是 testcafe 问题。由于 selenium 不会创建代理来插入 js 脚本并使网站自动化,因此我可以使用 selenium 进行自动化,但我想使用 testcafe,因为该网站是在 react 中开发的。
await t.typeText(this.emailInput, config.userEmail)
.click(this.nextButton)
.typeText(this.passwordInput, config.userPassword)
.click(this.nextButton)
.click(this.otpOption)
.typeText(this.otpInput, this.token)
.click(this.signinButton)
}
单击下一个按钮时,我应该有 2FA 表单要求输入代码,但我得到一个页面说无法进行身份验证(发生了错误),我看到 BeginAuth 端点的响应代码是 222没有任何响应而不是 200。
我用来进行身份验证的 URL 如下所示:
https://login.microsoftonline.com/client uuid/oauth2/authorize?response_type=code%20id_token&response_mode=form_post&client_id=client uuid&scope=openid&x-client-Ver=4.0.0
【问题讨论】:
-
- 当我编辑并重新发送请求时,我可以获得 200 和响应正文,但我需要删除标头:
x-hammerhead|xhr|request-marker: truex-hammerhead|xhr|origin: https://login.microsoftonline.com并添加来源之一:Origin: https://login.microsoftonline.com -
这可能是 TestCafe 中的一个错误。我们将在github ticket 的上下文中寻找解决方案。
-
谢谢@Artem 我忘了在这里添加评论,但是确实是一个错误,我在 testcafe 锤头 github 项目中创建了这个问题并忘记在此处添加答案
标签: header automated-tests e2e-testing web-testing testcafe