react-admin
react-admin copied to clipboard
fix: implement proper ResizeObserver mock for Cypress tests
What does this PR do?
This PR replaces the current ResizeObserver error workaround with a proper mock implementation for Cypress tests. Fixes #10649
Why is this change needed?
The current solution in cypress/support/index.js simply ignores ResizeObserver errors using Cypress.on('uncaught:exception'). This isn't ideal because:
- It masks potential real issues
- It doesn't properly simulate ResizeObserver behavior
- It's not a maintainable long-term solution
How does this PR solve the problem?
- Implements a proper ResizeObserver mock that:
- Correctly implements the ResizeObserver interface
- Maintains a map of observed elements
- Triggers callbacks appropriately
- Provides proper cleanup methods
- Removes the old error-ignoring workaround
- Maintains all existing test functionality
- Properly organizes the mock file in the TypeScript-compatible directory structure
Related issues
Fixes #[your issue number] (replace with the actual issue number you created)
Testing
- [ ] All Cypress tests pass
- [ ] No ResizeObserver errors in test output
- [ ] Components still resize and behave as expected
Checklist
- [x] I have followed the project's coding style
- [x] I have added tests that prove my fix is effective
- [x] I have added necessary documentation (if applicable)
- [x] I have updated the changelog (if applicable)
Unfortunately the tests are failing
Any news on this one?