-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[BUG] Component tests. Cannot compile test if component passed as property #15620
Comments
I have the same error, but i don't use component testing |
same problem here (see issue mentioned above #18481 ) |
This issue has been open for a few months. Any idea when there might be a fix? Thanks |
I'm getting the same error. This is a pretty big bummer to doing component testing. Here's a link to my comment in a previous issue about this. It outlines which situations |
any update on this? I am forced to stay with 1.22 version due to this issue |
You can only pass primitive values and JSON-alike objects as parameters, see https://playwright.dev/docs/next/test-components#under-the-hood for details. The easiest workaround would be to introduce a component for testing ButtonForTest, that would pass non-trivial objects into your production component. |
Related issue: #16605 |
Would that known limitation above be the reason why a react component like this won't mount?
In vs code, I get an error stating: Any help is appreciated. |
Any updates on this? I would love to be able to use Playwright but not being able to test any components that take functions as props without creating a whole extra component every time is a complete non-starter. |
@dospunk functions as props are possible atm. See |
@sand4art that seems to be passing callback functions, but what this issue is describing is JSX via a callback (render prop). |
@sand4rt sorry, I seem to have misunderstood this issue a bit. I'm on Vue where MountOptions.props is typed as a JsonObject which does not allow passing functions |
@dospunk see comment from earlier: #21400 (comment) |
Any updates in this issue? |
This should be fixed in 1.42. |
@pavelfeldman thanks for the fix!
I'm I doing something wrong or it's still an issue? Context: Code Snippet Steps |
Context:
"@playwright/experimental-ct-react": "^1.22.2",
Code Snippet
https://github.com/pashidlos/pw-component-test-example/tree/component-as-prop
Describe the bug
Getting error trying to pass icon as property in component
Locally made icons are throwing different error than the ones from external libraries (ex
@mui/icons-material
)Local icon error
yarn test-ct1
External icon error
yarn test-ct2
The text was updated successfully, but these errors were encountered: