redwoodjs / redwood

The App Framework for Startups
https://redwoodjs.com
MIT License
17.31k stars 994 forks source link

[Bug?]: Mantine components break web tests #10044

Open will-ks opened 8 months ago

will-ks commented 8 months ago

What's not working?

After setting up mantine components with yarn rw setup ui mantine and using any mantine component, the tests will fail due to:

Error: @mantine/core: MantineProvider was not found in component tree, make sure you have it in your app

The fix for this would be to add MantineProvider to the react-testing-library wrappers (ie. here https://github.com/redwoodjs/redwood/blob/main/packages/testing/src/web/customRender.tsx#L20).

Ideally the setup command would handle this, but if not possible, maybe the docs could be updated to describe how to get around this yourself?

I have done the following to work around the issue:

const customRender = (ui: ReactElement, options?: RenderOptions) => render(ui, { wrapper: (props) => (

),
...options,

})

export { customRender as render }


- Update all web test files to import `render` from this file instead of from `@redwoodjs/testing/web`

### How do we reproduce the bug?

- `yarn rw setup ui mantine`
- add any mantine component to a web component
- run `yarn rw test web`

### What's your environment? (If it applies)

_No response_

### Are you interested in working on this?

- [ ] I'm interested in working on this
KrisCoulson commented 8 months ago

Thanks for the bringing this to our attention @will-ks. I'll make sure to relay to the team to get their thoughts.

Tobbe commented 8 months ago

Thanks for your well written issue report @will-ks The team prioritizes React Server Components right now, and won't have time to look into this for a few weeks/months.

If someone from the community submitted a PR I or someone else will review it, but unfortunately that's all I can commit anyone to right now :(