Skip to content

".and" chainer returns undefined after upgrade to 3.4.0 #4833

@kyleburnett

Description

@kyleburnett

Current behavior:

After upgrading from Cypress 3.3.2 to 3.4.0, we now receive CypressError when attempting to use chai-jquery's ".and" chainer. It reports the following.

CypressError: Timed out retrying: Cannot read property 'have' of undefined

Here is what my test case looks like (from the and-chainer-undefined branch of the https://github.com/proknow/cypress-test-tiny repo).

describe('page', () => {
    it('should', () => {
        cy.visit('https://docs.cypress.io');
        cy.get('nav#main-nav').should(($nav) => {
            var node = $nav[0];
            var guides = node.querySelector('ul li:first-child a');
            var $guides = Cypress.$(guides);

            // Both of these assertions work in Cypress v3.3.2 and fail in Cypress v3.4.0
            expect(guides).to.be.visible.and.have.class('active');
            expect($guides).to.be.visible.and.have.class('active');
        });
    });
})

Desired behavior:

I would like the behavior of the ".and" chainer to function as it did in version 3.3.2 of Cypress.

Steps to reproduce: (app code and test code)

Please clone the and-chainer-undefined branch of https://github.com/proknow/cypress-test-tiny. To reproduce:

  1. Run npm install.
  2. Run npx cypress open and run the spec.js integration script.

To see the behavior in 3.3.2:

  1. Change package.json to use 3.3.2 for Cypress.
  2. Run npm install.
  3. Run npx cypress open and run the spec.js integration script.

Versions

Cypress: 3.4.0
OS: macOS 10.14.5 (18F132)
Browser: Chrome 75.0.3770.142

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: regressionA bug that didn't appear until a specific Cy version release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions