Skip to content
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

Cypress component tests do not work with Material UI's ThemeProvider #29727

Open
anyaname opened this issue Jun 24, 2024 · 1 comment
Open

Cypress component tests do not work with Material UI's ThemeProvider #29727

anyaname opened this issue Jun 24, 2024 · 1 comment
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

Comments

@anyaname
Copy link

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')
image

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

@jennifer-shehane jennifer-shehane added CT Issue related to component testing stage: needs investigating Someone from Cypress needs to look at this labels Jun 24, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants