在詹金斯(Jenkins)运行我的柏树测试时,会出现交叉起源错误



我在本地运行我的柏树,它们总是通过,但是当我在詹金斯(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但是在测试中登录后在我的URL中获得了"数据:"(我正在登录没有重定向的API调用)

很可能有一些JavaScript调用window.top.location或其他形式的重定向。当您的App 将其iframe的应用程序淘汰时,我们将其称为framebusting。赛普拉斯试图通过regex剥离此framebusting代码,但代码可以滑过。

您应该:

  • 查找并禁用/删除framebusting JavaScript
  • 在此处向柏树团队提交更多细节的问题

这与您的一些类似的问题:https://github.com/cypress-io/cypress/issues?utf8=✓&amp;q = is:isspim is s sist sort:open sort:updated-desc framebust

相关内容

  • 没有找到相关文章

最新更新