Cypress component tests do not work with Material UI's ThemeProvider #29727
Labels
CT
Issue related to component testing
stage: needs investigating
Someone from Cypress needs to look at this
stale
no activity on this issue for a long period
Current behavior
I am trying to use Cypress component tests for components with Materal UI's ThemeProvider, but on attempt to mount those I get:
TypeError: Cannot read properties of null (reading 'useContext')
It is a Nx project with Nextjs and React.
I am trying to wrap components in themeprovider on mount, which looks like should be working, but keep getting this error.
Is there a way to bypass this?
The link to reproduce this is provided below.
Thanks in advance
Desired behavior
To be able to use cypress component tests with MUI-styled components
Test code to reproduce
My repository where I try to wrap mounted component in a themeprovider
https://github.com/anyaname/ugh
Cypress Version
13.11.0
Node version
20.10.0
Operating System
macOS Sonoma 14.5
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: