user17365506
user17365506

Reputation:

ReactSelector can not access all components

i am new to React and Testcafe and have to write some end-to-end tests. I thougt, it was a good idea to mainly use the ReactSelector from 'testcafe-react-selectors', but i can not access all components although they are accessible via the 'React Developer Tools' Components view in the DevTools of the browser (edge).

Can anyone give me a hint as to why this is the case?

best regards sebastian

Upvotes: 0

Views: 116

Answers (2)

user17365506
user17365506

Reputation:

I now found the issue: the elements, that i can't select, are forwardrefs. It is an already known bug in testcafe-react-selectors

It seems that there is a workaround in using ReactSelector('WithStyles(ForwardRef(TextField))') instead of ReactSelector('TextField').

I'm not sure, if this is really a good way to do this, so i ditched the react-selectors and now use only data-testids.

Upvotes: 0

Alexey Filin
Alexey Filin

Reputation: 101

I need to reproduce the problem locally to be able to assist you. If you manage to create a sample project, please create an issue in the TestCafe GitHub repository and add it there together with the information required to reproduce the incorrect behavior.

Upvotes: 1

Related Questions