cypress: Frequent InvalidStateError when running tests in 3.1.4 update

Current behavior:

When running certain tests, I will frequently get an InvalidStateError on tests that worked previously in 3.1.3. Additionally, this does not happen everytime the test is run. Sometimes the test will pass, but many times this error will happen.

InvalidStateError: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'arraybuffer').

Desired behavior:

The test should pass without any errors. Consistent behavior from one test run to another.

Steps to reproduce: (app code and test code)

The below test is on a page that loads a HERE map, and consequently receives many XHR responses upon loading. Example code of a test case that resulted in this error, but worked in previous Cypress versions.

const Accounts = require('../../constants/accounts');
const Routes = require('../../constants/routes');

describe('Switching organizations, then refreshes the page', () => {
  before(() => {
    cy.viewport('macbook-15');
    cy.visit(Routes().dashboardBaseUrl);
    cy.get('input[name=email]').type(Accounts().email);
    cy.get('input[name=password]')
      .type(Accounts().pw)
      .type('{enter}');
  });

  it('should default back to original organization view upon refresh', () => {
    context('switch from parent organization to child organization', () => {
      cy.get('[data=subscribedName]').should(
        'have.text',
        'organization name'
      );

      //open the dropdown
      cy.get('[data=dropdown-toggle]').click();

      //Click on the first child organization
      cy.get('[data=orgName]:first').click();

      //organization title should have changed
      cy.get('[data=subscribedName]').should(
        'have.text',
        'blacklist'
      );
    });

    cy.reload();
    cy.get('[data=subscribedName]').should(
      'have.text',
      'organization name'
    );
  });
});

Versions 3.1.4

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 30 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve started a PR to fix this, so hopefully should get out in 3.1.5 https://github.com/cypress-io/cypress/pull/3054

We have a similar error since the 3.1.4 update

Error: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'blob').
    at isAbortedThroughUnload (http://localhost:9999/__cypress/runner/cypress_runner.js:62461:57)
    at onReadyStateFn (http://localhost:9999/__cypress/runner/cypress_runner.js:62816:17)
    at XMLHttpRequest.<anonymous> (http://localhost:9999/__cypress/runner/cypress_runner.js:62773:25)

The difference is text' (was 'blob') instead of arraybuffer

Tests fail when running cypress run with Electron 59. The tests do run successful with cypress open running Chrome 71 but fail with the above message with cypress open running Electron 59

Released in 3.1.5.

Would 3.1.5 also fix the text' (was 'blob') issue?

I pulled down the issue-branch and built it locally. We had the (was ’blob’) which was solved.

Looking at the changes in the fix-branch, it looks like every (was ’xxx’) will be covered.

Thanks a bunch @jennifer-shehane 🎉

Same here. I’m getting Error: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'arraybuffer'). when running inside docker with cypress run --spec=cypress/tests/visual/*.test.js --browser chrome.

Docker base image: cypress/browsers:chrome69

Hey @Dan195, does this happen during cypress open, cypress run, or both? Could you also specify OS/browser being used?