Cypress failing test due to CORS?
I have a simple test that fails due to CORS
and I'm unsure how to fix it:
it("Visits home", () => {
cy.visit("http://localhost:3000");
});
This is the error:
1) Test
Visits the home page:
SecurityError: Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.
Go to cypress.json
and add:
chromeWebSecurity: false
Setting chromeWebSecurity
to false
in Chrome-based browsers allows you to do the following:
- Display insecure content
- Navigate to any superdomain without cross-origin errors
- Access cross-origin iframes that are embedded in your application