我在本地运行我的赛普拉斯并且它们总是通过,但是当我在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但在我的网址中登录测试后得到“data:”(我正在注销w / api调用,不进行重定向)
很可能有一些javascript调用window.top.location
或其他形式的重定向。我们称之为framebusting
,当你的应用程序从它的iframe
破灭到柏树顶层框架。赛普拉斯试图通过framebusting
剥离这个regex
代码,但代码可能会漏掉。
你应该:
framebusting
javascript这里有一些与你类似的问题:https://github.com/cypress-io/cypress/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+framebust