0

I'm using Cypress 6.3.0. Why does the following happen?

cy.intercept('https://some.random.url', {
  statusCode: 200
})

threw a Cypress detected a cross origin error happened on page load error

but

cy.intercept('http://some.random.url')

did not.

slee
  • 344
  • 3
  • 5
  • 15
  • Please have a look at [this answer](https://stackoverflow.com/a/71277156/17865804) as to why this is happening. – Chris Oct 17 '22 at 10:19

2 Answers2

1

You have two different protocols there in the code snippets you quote: https vs http. This is possibly tripping Cypress up.

Michael Große
  • 1,818
  • 1
  • 16
  • 20
0

As mentioned in the cypress docs setting chromeWebSecurity to false in your configuration file (cypress.json by default) will solve this issue.

{
  "chromeWebSecurity": false
}
Alapan Das
  • 17,144
  • 3
  • 29
  • 52
  • thanks, i know this. my question isn't about solving this issue. my question is why this is happening only when i supply `{ statusCode: 200 }`. – slee Feb 17 '21 at 18:53