screen.findByText not finding text fetched from mocked axios call using msw #402
Replies: 4 comments
-
Thanks for the feedback. Please provide a CodeSandbox or a link to a repository on GitHub. Otherwise these types of issues are incredibly hard for us to debug. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve |
Beta Was this translation helpful? Give feedback.
-
@eps1lon I tried to recreate it as best as I could. I had to do some changes to make it work on CodeSandbox. Here is the link: https://codesandbox.io/s/create-react-app-typescript-forked-9z498?file=/src/UsersTable.test.tsx |
Beta Was this translation helpful? Give feedback.
-
If the problem is |
Beta Was this translation helpful? Give feedback.
-
Is the CodeSandbox enough? Are you able to figure out what the issue is? |
Beta Was this translation helpful? Give feedback.
-
@testing-library/jest-dom
version: 5.11.9msw
version: 0.28.2node
version: 14.17.1react-testing-library
version: 11.2.5@material-ui/core
: 4.11.3,@material-ui/data-grid
: 4.0.0-alpha.19Relevant code or config:
What happened:
This is the error message:
Problem description:
I expected
screen
to find the fetched data in the DataGrid component but it does not. I have written other very similar tests with the same setup and they all pass so I do not understand why this one does not.I console logged the response that I get back from the mocked axios call and I see the data. I know that the state is being updated but for some reason
screen.findByText()
does not find it.Can you help me figure out why this is happening?
Beta Was this translation helpful? Give feedback.
All reactions