The plugin takes in account the ForwardRef
Closed this issue · 1 comments
When writing a command like
cy.react('TextField', { props: { label: 'Project Title' }})
the cypress yields more than one elements. After an investigation it seems that it looks at the ForwardRef, too.
This means that you can't type() because this function requires only one element. A workaround is to add a unique prop which exists inside the desired component like this
cy.react('TextField', { props: { label: 'Project Title', fieldProps: true }})
Apparently it's not the best solution and I think there should be a flag or something to make the plugin to ignore the ForwardRef.
Please, advice on this.
Thanks!
Hi @ahaddad-dia , while it is a good idea to add an option to selectively ignore a ForwardRef
, meanwhile you can fetch the element by index and try to type on it.
cy.react('TextField', { props: { label: 'Project Title' }}).eq(0).type('myAwsomeText');