Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make selectOption work when fake timers are enabled (#4604)
# Motivation While cleaning up a test in another branch, I discovered that `userEvent.selectOption` doesn't work when fake timers are enabled. I found a work-around here: testing-library/user-event#833 ``` userEvent.setup({ advanceTimers: jest.advanceTimersByTime }) ``` It also seems that `vitest` does not expose a way to test if fake timers are enabled, but fake timers specific method throw if fake timers are not enabled so this can be used to detect if fake timers are enabled. # Changes 1. Add a function `areFakeTimersEnabled` to check if fake timers are enabled. 2. If fake timers are enabled, use the work-around to use `userEvent.selectOption` in `JestPageObjectElement.selectOption`. # Tests Used in another branch to stop a test from timing out after enabling fake timers. # Todos - [x] Add entry to changelog (if necessary).
- Loading branch information