Repository: cypress-io/cypress
File: packages/server/__snapshots__/6_web_security_spec.coffee.js (JavaScript)

Code before:
  web security
    1) fails when clicking <a> to another origin
    2) fails when submitted a form and being redirected to another origin
    3) fails when using a javascript redirect to another origin


  0 passing
  3 failing

  1) web security fails when clicking <a> to another origin:
     CypressError: Cypress detected a cross origin error happened on page load:

  > Blocked a frame with origin "http://localhost:4466" from accessing a cross-origin frame.

Before the page load, you were bound to the origin policy:
  > http://localhost:4466

A cross origin error happens when your application navigates to a new domain 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 to a non same-origin domain 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 'cypress.json'.

https://on.cypress.io/cross-origin-violation

      [stack trace lines]

  2) web security fails when submitted a form and being redirected to another origin:
     CypressError: Cypress detected a cross origin error happened on page load:

  > Blocked a frame with origin "http://localhost:4466" from accessing a cross-origin frame.

Before the page load, you were bound to the origin policy:
  > http://localhost:4466

A cross origin error happens when your application navigates to a new domain 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


Review comment (suggestion):
```suggestion
Cypress does not allow you navigate to different origin domains within a single test.
```

Code after:
  web security
    1) fails when clicking <a> to another origin
    2) fails when submitted a form and being redirected to another origin
    3) fails when using a javascript redirect to another origin


  0 passing
  3 failing

  1) web security fails when clicking <a> to another origin:
     CypressError: Cypress detected a cross origin error happened on page load:

  > [Cross origin error message]

Before the page load, you were bound to the origin policy:

  > http://localhost:4466

A cross origin error happens when your application navigates to a new URL which does not match the origin policy above.

A new URL does not match the origin policy if the 'protocol', 'port' (if specified), and/or 'host' (unless of the same superdomain) are different.

Cypress does not allow you to navigate to a different origin URL 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 in Chromium-based browsers which will turn off this restriction by setting { chromeWebSecurity: false } in 'cypress.json'.

https://on.cypress.io/cross-origin-violation

      [stack trace lines]

  2) web security fails when submitted a form and being redirected to another origin:
     CypressError: Cypress detected a cross origin error happened on page load:

  > [Cross origin error message]

Before the page load, you were bound to the origin policy:

  > http://localhost:4466

A cross origin error happens when your application navigates to a new URL which does not match the origin policy above.

A new URL does not match the origin policy if the 'protocol', 'port' (if specified), and/or 'host' (unless of the same superdomain) are different.

Cypress does not allow you to navigate to a different origin URL 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 in Chromium-based browsers which will turn off this restriction by setting { chromeWebSecurity: false } in 'cypress.json'.