Получение перекрестной ошибки при запуске моих тестов Cypress в Jenkins - PullRequest
0 голосов
/ 21 февраля 2019

Я запускаю свой 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, но после входа в тест я получил «data:» в моем URL (я выхожу из системы с помощью вызова API /, который не выполняет перенаправление)

1 Ответ

0 голосов
/ 21 февраля 2019

Скорее всего, есть какой-то javascript, который вызывает window.top.location или какая-то другая форма перенаправления.Мы называем это framebusting, когда ваше приложение выводит из iframe в кадр верхнего уровня кипариса.Cypress пытается удалить этот код framebusting через regex, но код может проскользнуть.

Вы должны либо:

  • найти и отключить / удалить framebusting javascript
  • отправить проблему с более подробной информацией в команду кипариса здесь

вот некоторые схожие с вами вопросы: https://github.com/cypress-io/cypress/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+framebust

...