-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test] The cell with id=X and field= received focus #3850
Comments
We added this warning because we keep in the state which cell has focus and since we use the +fireEvent.mouseUp(button);
fireEvent.click(button); Here's the updated CodeSandbox: https://codesandbox.io/s/datagrid-tests-warning-forked-lhpzp?file=/src/App.spec.tsx:523-582 More information about it see #3486. |
What's frustrating is that I'm not focusing anything, I'm clicking a button... This is still unclear why I need to refactor tests that work perfectly fine, testing code that run perfectly fine in production, just to avoid warnings that you added in the lib. Can you clarify? Thx, |
I think the warning is also usefull for your tests |
I am also encountering the issue. This warning (actually, a Let me demonstrate with a code sample, using mui-5, jest and react-testing-library. I am willing to provide a full fledged example as well if requested. Let's assume that we start with a
Having to add the second Yes, there probably is an inconsistency between the DOM and the grid state - and it is something that should be looked at. But since this inconsistency is inside the grid, perhaps that warning could be silenced for others not working on the MUI DataGrid, especially when they are running tests. |
@m4theushw could we enable this warning only if an env variable is present ? (or the opposite) |
Have been trying in many different ways to get the fix from statements above to work but they are not working on our project. we are using userEvent and i have tried to place the fireEvent.mouseUp() function before every userEvent.click function but i still get the same error as stated above. are there any other work arounds? |
Would work I suppose. But reading others comments above the warning itself might be wrong. Or am I missing something? |
I got the same feeling when I originally opened the issue. My test clicks a button, I use fireEvent.click, having to do mouseUp / mouseDown or other tricks feels weird... |
on top of the weird feeling from having to add an extra mouse event the tests would not accurately simulate the users actions when performing actions on the data grid. i think this needs to be reverted or as @flaviendelangle said have an env variable to trigger the warnings |
This warning was added because we had a |
@m4theushw : but I am not clicking outside a cell to commit a value. In my example above, I could delete an item from a |
Thx for the fix |
Duplicates
Latest version
Current behavior 😯
Some of our tests trigger a new warning in tests:
This is very recent.
We're following upgrades closely and are currently running v5.5.0. I can bissect if you want to find the precise version where this started happening.
Expected behavior 🤔
No warning
Steps to reproduce 🕹
Run tests of https://codesandbox.io/s/datagrid-tests-warning-9dy64?file=/src/App.spec.tsx
This is a very minimal example of our use case:
Context 🔦
N/A
Your environment 🌎
`npx @mui/envinfo`
Order ID 💳 (optional)
31461
The text was updated successfully, but these errors were encountered: