-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Current behavior
When visiting a page using cy.visit() inside cy.origin(), a subsequent GET request to download a JSON file causes a problem. The request is asynchronous, and Cypress loses sync inside cy.origin(). As a result, Cypress tries to parse the response (JSON) before it has been fully downloaded, causing a JSON parsing error.
Visiting the page outside of the cy.origin causes no problem.
Actual behavior: The JSON file is not fully downloaded before the client attempts to parse it, causing a parsing error.
Desired behavior
Expected behavior: Cypress should wait for the GET request to finish downloading the JSON file before attempting to parse it.
Test code to reproduce
describe("Testing Cross Origin", () => {
it("test", () => {
cy.visit('www.google.com');
cy.origin('https://demoportal-stage.infocert-labs.eu', () => {
cy.visit('https://demoportal-stage.infocert-labs.eu/login')
})
});
});
Cypress Version
13.17.0 or 14.1.0
Node version
v20.18.3
Operating System
Edition Windows 11 Enterprise Version 24H2 Installed on 20/01/2025 OS build 26100.3194 Experience Windows Feature Experience Pack 1000.26100.48.0