vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Implement `userEvent.wheel` in interactivity api

Open kwojcik opened this issue 1 year ago • 3 comments

Clear and concise description of the problem

Allow a test to scroll the wheel in browser mode. We want to use wheel within a number input to change the value.

Suggested solution

Hook up to Playwright's wheel

Alternative

No response

Additional context

See https://github.com/testing-library/user-event/issues/475 for existing feature request on testing-library/user-event.

Validations

kwojcik avatar Nov 19 '24 19:11 kwojcik

I was so confused about all these layers of abstractions, running in circles between "@testing-library/vue", "vitest/browser" and "vitest-browser-vue", even asked LLMs (which I usually don't do) both of which got stuck in a loop of broken rewritings.

Turns out, the thing is simply not implemented yet, ahh.

Are there workarounds? Like, using underlying Playwright API directly? I'm still not sure how any of this composes together.

ratijas avatar Nov 28 '25 18:11 ratijas

I'm no longer have access to the project that I needed this on, but iirc we had a separate jsdom workspace for tests that need unimplemented features and used fireEvent.wheel for this as a workaround

kwojcik avatar Nov 28 '25 18:11 kwojcik

Searching the whole vitest workspace for a similar event named tripleClick yields "64 results - 16 files". Seems like adding support for scroll/wheel would be involve quite a lot of work, preferably from someone who knows what are they doing 👀

For the reference, Webdriver implemented it "a while ago:"

  • https://github.com/w3c/webdriver/pull/1410
  • https://github.com/servo/servo/issues/23180
  • https://w3c.github.io/webdriver/#wheel-input-source

ratijas avatar Nov 28 '25 19:11 ratijas