cypress-io/cypress-react-unit-test

Second chained cy.getReact call returns nothing

bahmutov opened this issue · 4 comments

While using https://github.com/abhinaba-ghosh/cypress-react-selector the second call does not find the component

it('chains getReact', () => {
  // note that by itself, the component is found
  cy.getReact('AProduct', { name: 'First item' })
    .getProps('name')
    .should('eq', 'First item')

  // chaining getReact
  cy.getReact('ProductsContainer')
    .should('not.be.empty')
    // the second .getReact returns nothing?!
    .getReact('AProduct', { name: 'First item' })
    .getProps('name')
    .should('eq', 'First item')
})

Screen Shot 2020-08-11 at 10 53 32 PM

To recreate the problem:

  • clone the repo
  • install dependencies with npm i
  • start Cypress npx cypress open
  • open test cypress/component/advanced/react-book-example/src/components/ProductsList.spec.js
  • uncomment the test above

@abhinaba-ghosh do you have any ideas about this one?

Hi @bahmutov , thanks for finding out this bug. I am looking into this.

Changes are available in V2.0.1
Breaking changes introduced.
Raised PR: #386

works