-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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] Modal snapshot test fail "TypeError: parentInstance.children.indexOf is not a function" #9243
Comments
This comment has been minimized.
This comment has been minimized.
The information provided aren't actionable on our end. We need a reproduction repository. Also, what is this |
|
While I do understand you want to keep things tidy in here, I'm not spending too much time on this. I'll just comment out my dialog stories for now. If anyone else comes across this issue, maybe they're willing to make the example. |
@RWOverdijk Thanks, I will have a look at what's going on with codesandbox! Yes, same on our side. We have limited ressources, trying reproducing issues has a poor value/cost ratio in comparaison to other tasks. It's why we use a strict policy. |
Came across the same issue...
Component
Test
Error message
|
Just run into the same issue. It has something to do with the Portals. I made a simple reproduce project here: https://github.com/Skaronator/material-ui-issue-9243
And you'll get the following error:
|
@Skaronator Enzyme do not support the portal API of React: enzymejs/enzyme#252. We use a mockPortal.js for our tests internally. |
i have the same problem |
I can confirm with @oliviertassinari that mockPortal.js solves this issue. (not all issues trying to snapshot a material-ui dialog, but this particular one) |
This comment has been minimized.
This comment has been minimized.
Enzyme now supports the portal API of React. We have removed our |
This comment has been minimized.
This comment has been minimized.
Oh cool - didn't know that. They didn't even close the issue on thier repo. |
package.json
Test
btn-icon.js
hint.js - tooltip
And I'm getting the same error:
How can I solve this issue while we are waiting for a new enzyme (enzyme that will support portals)? |
Solved it with - Example:
|
I still have this issue using material-ui and react-test-renderer 16.13.0. Is the solution here to use I would like to continue to use
|
I experience same issue when using mui Dialog and react-test-renderer. Here's the related sandbox. |
This comment has been minimized.
This comment has been minimized.
The root cause is
|
You need to mock out
|
Expected Behavior
I expect the tests to run without a problem.
Current Behavior
I get an error:
I think this is due to portals not working properly in combination with jest snapshots.
Steps to Reproduce (for bugs)
Where
<AlertDialog />
is a boring wrapper around<Dialog />
.I'm sorry for not including a code snippet. I don't know how to set up the tests to illustrate the issue, but I tried my best to provide as much relevant information as possible.
Context
I'm using storybooks with storysnaps (jest snapshots), and our tests are failing. I'm pretty sure it has something to do with enzymejs/enzyme#1150 and potentially reactjs/react-modal#553 could benefit from a solution as well.
Your Environment
Additional
I have a feeling this is something that could be caught in storyshots but I'm not experienced enough with the material at hand. Any pointers, or better yet solutions would be greatly appreciated.
I'm not against fixing it and contributing either (if I get the right pointers to help me out).
The text was updated successfully, but these errors were encountered: