cypress-react-selector
cypress-react-selector copied to clipboard
Cannot find component with props, despite showing in browser console
I have this code:

but it produces this error:

even though the Chrome Dev Tools Component tab show this:

This is intersting. Can you check if that component really exists or not.
cy.waitForReact();
cy.get(..).click()
cy.react('component name', {props:{your prop}}).should('exist');
cy.getReact(..).getProps(..).should('eq', true);
This is what I see when I try the above:

it's react, not getReact for the exist command:
cy.react('component name', {props:{your prop}}).should('exist');
hey, i'm also having this issue.
This is what I'm seeing in react dev tools.

This is the code I'm using to look for the component.
cy.waitForReact(); cy.react('DisplayLeadDetails').should('exist');
This is the error I'm seeing.

I did notice that if I were to look for say the ba component you see in the screenshot, it does pick it up correctly. Wonder if that can help debug this issue.
Hi, can you guys try with the latest version v2.2.2 and check if still happening.
Still getting the same issue, unfortunately.
I'm seeing this issue in a component test where each test mounts a new component tree.
The first test works and all other tests work, with .only, but if I allow them all to run, getReact and react queries fail.
This is on cypress 7.2.0.
@sovanyio Thanks for bringing the issue under the light. Can you confirm if the window gets reloaded every time you load a component? If so, you need to call waitForReact each time. I am interested in the codebase, can you share any repository where I can re-produce the bug?
Just want to drop a note that this hasn't fell off of my radar, life got unexpectedly busy this week. I will try to get something up next week.
i think it is because of forwardref type react components i think this plugin does not support them cz i also tried fetching them but it's not working. i also tried cy.react as well

I'm seeing this issue in a component test where each test mounts a new component tree. The first test works and all other tests work, with
.only, but if I allow them all to run,getReactandreactqueries fail.This is on cypress 7.2.0.
I have opened this issue, specific to component testing: https://github.com/abhinaba-ghosh/cypress-react-selector/issues/235