【发布时间】:2019-07-14 16:29:39
【问题描述】:
我在本地运行我的 Cypress,它们总是通过,但是当我在 jenkins 中运行它们时,我不断收到这个错误:
> Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.
Before the page load, you were bound to the origin policy:
> http://localhost:3000
A cross origin error happens when your application navigates to a new superdomain which does not match the origin policy above.
This typically happens in one of three ways:
1. You clicked an <a> that routed you outside of your application
2. You submitted a form and your server redirected you outside of your application
3. You used a javascript redirect to a page outside of your application
Cypress does not allow you to change superdomains within a single test.
You may need to restructure some of your test code to avoid this problem.
Alternatively you can also disable Chrome Web Security which will turn off this restriction by setting { chromeWebSecurity: false } in your 'cypress.json' file.
https://on.cypress.io/cross-origin-violation
有时其中一个会通过
我试图将chromeWebSecurity: false 添加到我的 cypress.json
但登录测试后在我的网址中得到“数据:”
(我正在注销不执行重定向的 api 调用)
【问题讨论】:
-
这能回答你的问题吗? Cypress throwing SecurityError
标签: jenkins automated-tests cross-domain subdomain cypress