在Jenkins中运行我的赛普拉斯测试时出现交叉原点错误

问题描述 投票:4回答:1

我在本地运行我的赛普拉斯并且它们总是通过,但是当我在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调用,不进行重定向)

jenkins automated-tests cross-domain subdomain cypress
1个回答
0
投票

很可能有一些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

© www.soinside.com 2019 - 2024. All rights reserved.