Cypress.io - Using location.href to redirect user to same origin results in Cross Origin Error

Viewed 202

I'm seeing this error when doing a location.href to redirect my user to a different path on the same host. To illustrate, I'm redirecting from https://www.example.com to https://www.example.com/newpage.

I know that Cypress strips out any subdomains (in this case, www) and sets the host as document.domain, so I don't understand why this isn't working.

Error: CypressError: Cypress detected a cross origin error happened on page load:

Blocked a frame with origin "https://www.example.com" from  accessing 
a cross-origin frame.

Before the page load, you were bound to the origin policy:
  https://example.com

According to the docs, both https://www.example.com and https://example.com are considered same-origin, so why the error?

I'm on Cypress 6.1.0.

0 Answers
Related