DevExpress / testcafe-react-selectors

TestCafe selector extensions for React apps.
https://testcafe.io
MIT License
205 stars 43 forks source link

Trying to use the lib with TanStack/Table #199

Open giraud opened 1 year ago

giraud commented 1 year ago

We have been using testcafe and testcafe-react-selectors for a long time now in our end-to-end tests. It is a great lib, thank you for that.

We recently tried to test a new page that is using a tanstack Table with the cells containing our custom Checkbox component. Unfortunately some of our tests are failing randomly. It happens in normal mode or in native-automation mode. It is not always failing in the same location, so we know the selectors are correct. And occasionally(rarely) the test succeed.

our selectors: image

The UserRoleChecbox is problematic, the findReact is not working as expected.

I don’t know how we get into these situations, and my only repro case is our application. So I tried to debug the lib with lot of logs. What I found is that sometimes the child is correct and have the expected hierarchy and sometimes not.

For example, here my child is totally empty (the expanded FiberNode is component.child, it should have other children): log3

in that case I found that the alternate version can get me the correct child.

after digging, I found that the problem happens when the child component has a flag equals to 8. From what I’ve seen, it should correspond to ContentReset. And if I use the alternate child in that case, my tests are passing.

I changed the code to this (in index.js function getRenderedChildren): image

I don’t know if it is the correct approach or if I am doing something wrong in my tests. what do you think ?

versions: testcafe@2.6.2 & testcafe-react-selectors@5.0.3

giraud commented 1 year ago

maybe the same then #146 ?

aleks-pro commented 1 year ago

Hello @giraud ,

Thank you for your kind words. We appreciate them.

To find the cause of the issue, we need to reproduce it on our side. Could you please share a simple project sample with test code using which we can reproduce the issue?

giraud commented 1 year ago

yes, I understand, but that is my problem right now: having a small reproducible app :(.