Closed DanielDaCosta closed 1 month ago
I want to share a solution that worked for me when using Cypress with localhost, in case anyone faces the same issue:
Instead of accessing cy.visit("http://localhost:3000"), swap localhost with your own IP address. To get your IP on a Mac, run the following command:
ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2
Your Cypress test would look something like this:
cy.visit("http://192.168.86.37:3000")
I tried setting custom headers, but it didn't resolve the issue:
cy.visit("http://localhost:3000", { headers: { "Accept-Encoding": "gzip, deflate" } })
Increasing the timeout didn't help either:
cy.visit("http://localhost:3000", { timeout: 30000 })
Adjusting the response timeout also didn't work for me:
cy.visit("http://localhost:3000", { responseTimeout: 120000 })
Hopefully, this helps someone else facing similar issues!
Even after running the web app, I continue to encounter the following error, despite being able to access localhost:3000 through the browser:
Here’s how the web app appears when accessed locally: