screen.findByText not finding text fetched from mocked axios call using msw #402
Unanswered
LuisBarroso37
asked this question in
Q&A
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 |
0 replies
|
@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 |
0 replies
|
If the problem is |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
@testing-library/jest-domversion: 5.11.9mswversion: 0.28.2nodeversion: 14.17.1react-testing-libraryversion: 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
screento 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?
All reactions