abhinaba-ghosh / cypress-react-selector

:zap: cypress plugin to locate react elements by component, props and state
https://www.cypress.io/
MIT License
274 stars 28 forks source link

Selector is reporting too many/duplicate items #418

Open mkascel opened 1 year ago

mkascel commented 1 year ago

I'm evaluating this lib and have run into a strange issue, selecting my component via cy.react is returning more results than are rendered. Here the selector/assertion I'm using is:

cy.react('ProductPlacement').should('have.length', 1);

But the assertion is failing as cy.react() is returning two items.

Screenshot 2023-03-31 at 16 10 10

However, I've verified that only one item is rendering, by querying the DOM directly

Screenshot 2023-03-31 at 16 11 05

This is against Cypress 12.8.1 using the latest version of this lib. Any ideas how I could start debugging this?