Cypress: Fails with Chrome 73

Created on 13 Mar 2019  路  4Comments  路  Source: cypress-io/cypress

Current behavior:

before update to Chrome 73, everything was running fine. Since update Cypress fails, timeout, does not connect to Chrome it seems

Steps to reproduce: (app code and test code)

just update Chrome and relaunch.

Versions

Cypress 3.1.5
Chrome 73
Linux, Mac OS X

Most helpful comment

cy.get(selector).then(subject =>
        cy
            .fixture(fileName, 'base64')
            .then(Cypress.Blob.base64StringToBlob)
            .then(blob => {
                const el = subject[0];
                const testFile = new File([blob], fileName, {
                    type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
                });
                const dataTransfer = new DataTransfer();
                dataTransfer.items.add(testFile);
                el.files = dataTransfer.files;
                               el.dispatchEvent(new Event('change', { bubbles: true }));  
                              // ^^^ adding this line seems to fix it.
            })
    );

All 4 comments

Hey @streamnsight, could you provide an example of the test code you are running when you experience this?

Last time we had an issue, it was Cypress not connecting to Chrome at all.

This time, it seems linked to our upload command.

The code goes like this to simulate a browser event:

cy.get(selector).then(subject =>
        cy
            .fixture(fileName, 'base64')
            .then(Cypress.Blob.base64StringToBlob)
            .then(blob => {
                const el = subject[0];
                const testFile = new File([blob], fileName, {
                    type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
                });
                const dataTransfer = new DataTransfer();
                dataTransfer.items.add(testFile);
                el.files = dataTransfer.files;
            })
    );

it then waits for the POST api call to happen (registered as an alias) and now it just waits, but the POST never happens, so this code doesn't work anymore.

cy.get(selector).then(subject =>
        cy
            .fixture(fileName, 'base64')
            .then(Cypress.Blob.base64StringToBlob)
            .then(blob => {
                const el = subject[0];
                const testFile = new File([blob], fileName, {
                    type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
                });
                const dataTransfer = new DataTransfer();
                dataTransfer.items.add(testFile);
                el.files = dataTransfer.files;
                               el.dispatchEvent(new Event('change', { bubbles: true }));  
                              // ^^^ adding this line seems to fix it.
            })
    );

thanks @streamnsight that solution worked well to me, I was having the issue running cypress tests in docker, so you saved me

Was this page helpful?
0 / 5 - 0 ratings