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

test-utils for menu interactions cannot work without Jest #7632

Open
mxp-qk opened this issue Jan 18, 2025 · 2 comments
Open

test-utils for menu interactions cannot work without Jest #7632

mxp-qk opened this issue Jan 18, 2025 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@mxp-qk
Copy link

mxp-qk commented Jan 18, 2025

Provide a general summary of the issue here

The selectOption method of a test User for the menu ARIA pattern call jest.runAllTimers() when it might not be installed in the test environment (if setup with vitest for example)

🤔 Expected Behavior?

@react-aria/test-utils should work with jest or vitest. I assume that because of the way the test User is setup and can be passed a method for advanceTimer

😯 Current Behavior

Test using the menu ARIA pattern will fail if trying to select an option or open a submenu

💁 Possible Solution

the runAllTimers method could be injected in addition of advanceTimer

🔦 Context

Trying the alpha version of @react-aria/test-utils to replace some homemade utils to interact with react app using RAC components

🖥️ Steps to Reproduce

  1. Open this code sandbox
  2. Run the test script

Version

@react-aria/test-utils 1.0.0-alpha.4

What browsers are you seeing the problem on?

Other

If other, please specify.

Chromuim from playwright

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@snowystinger
Copy link
Member

Thanks for reporting! Looks like we missed adding it as a peer requirement or as a dependency injection.
I think we can try out the dependency injection first and see if that makes sense before locking out others.

@snowystinger snowystinger added enhancement New feature or request bug Something isn't working labels Jan 19, 2025
@LFDanLu
Copy link
Member

LFDanLu commented Jan 21, 2025

@snowystinger I think we should try to replace those jest.runAllTimers calls in the menu utils, they seem to be there to wait for transitions perhaps? If so then we could wait for the menu to disappear/appear accordingly

@LFDanLu LFDanLu moved this from 🩺 To Triage to ✏️ To Groom in RSP Component Milestones Jan 21, 2025
@LFDanLu LFDanLu moved this from ✏️ To Groom to 📋 Waiting for Sprint in RSP Component Milestones Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: 📋 Waiting for Sprint
Development

No branches or pull requests

3 participants