我有一个本地端点来检查我是否已登录,如果是,它会生成令牌并将我重定向到另一个 API 端点。我想测试重定向但是,我以以下错误结束:
cy.visit() failed trying to load:
http://getmantaportal.test/authorize/
The response we received from your web server was:
> 403: Forbidden
This was considered a failure because the status code was not 2xx.
This http request was redirected '1' time to:
- 302: https://example.com/api/?token=eyJ0eXAiOiJKV1QiL
这是我的代码:
it('Redirect to Manta Edge if already logged in.', function () {
// Login first.
// [...]
// Go to the endpoint and get redirected immediately.
cy.visit('/authorize/')
cy.url().should('contain', '/api/?token=')
})
非常感谢提前。