Skip to content

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

@mxp-qk

Description

@mxp-qk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions