Cypress: cy.click() fails on 'illegal invocation' error after updating to 3.0.3

Created on 1 Aug 2018  路  2Comments  路  Source: cypress-io/cypress

Current behavior:

After update to 3.0.3, cypress started throwing errors on previously passing tests:

snimka obrazovky 2018-08-01 o 10 11 20

Works fine after downgrading to 3.0.2.

Desired behavior:

No reason to fail. Element is visible, actionable and works.

Steps to reproduce:

You can run this code to replicate:

describe('Replicate cypress bug', () => {

  beforeEach(() => {

    cy
      .server()
      .route({
        method: 'POST',
        url: `/api/v0.5/events/*/questions/*/like`
      }).as('likeSend');

    cy
      .clearLocalStorage();

  });

  it('Should be able to like a question', () => {

    cy
      .visit('https://app2.sli.do/event/ylzdusae');

    // click on like
    cy
      .get('.score--card [ng-bind=\'$ctrl.getScorePositive()\']')
      .get('.score--card button.score__btn--plus')
      .click();

    // like should be sent through api
    cy
      .wait('@likeSend')
      .its('status')
      .should('eq', 200);                   

    // see like appear
    cy
      .get('.score--card [ng-bind=\'$ctrl.getScorePositive()\']')
      .get('.score--card button.score__btn--plus')
      .should('have.class', 'active');

  });

});

Versions

3.0.3., Behavior is replicable on CI, Desktop or headless run. Downgrading back to 3.0.2 aids the issue.

Most helpful comment

This issue has been fixed and will go out in our next release. https://github.com/cypress-io/cypress/pull/2246

All 2 comments

I was also experiencing this.
changing .click() to .trigger('click') seemed to work in some situations, but obviously not a good workaround.

switching back to 3.0.2 works

This issue has been fixed and will go out in our next release. https://github.com/cypress-io/cypress/pull/2246

Was this page helpful?
0 / 5 - 0 ratings