vitest-dev / vitest-dev/vitest

Inexplicable and flaky userEvent action timeouts

Open
#7,871 16 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feat: browser pending triage
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Describe the bug

Since the version 3.1.2, some tests became flaky: userEvent (from @vitest/browser/context) actions lead to unexpected timeout errors.
These tests used to work in 3.1.1, the call logs do not reveal any issues, the screenshots look good, the actions should work, it's really inexplicable why these timeout errors start happening.
I cannot reproduce these errors at all locally, it's only happening in our CI, no clue why.

Here's a couple examples below:

TimeoutError: locator.hover: Timeout 581ms exceeded.
Call log:
  - waiting for locator('[data-vitest="true"]').contentFrame().locator('body')
    - locator resolved to <body>…</body>
  - attempting hover action
    - waiting for element to be visible and stable
    - element is visible and stable
    - scrolling into view if needed
    - done scrolling

It says "Timeout 581ms exceeded", but it's not like we set an explicit 581ms timeout limit, really odd.

TimeoutError: frame.dragAndDrop: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('div:nth-child(4) > .dragIconClassname_d1f2l6jt')

Here setting a 10s timeout limit, and it's still exceeded, even though it should pass/not timeout.

TimeoutError: locator.hover: Timeout 5000ms exceeded.
Call log:
  - waiting for locator('[data-vitest="true"]').contentFrame().locator('body')
    - locator resolved to <body>↵  ↵↵</body>
  - attempting hover action
    - waiting for element to be visible and stable
    - element is visible and stable
    - scrolling into view if needed
    - done scrolling
TimeoutError: locator.hover: Timeout 5000ms exceeded.
Call log:
  - waiting for locator('[data-vitest="true"]').contentFrame().locator('body')
    - locator resolved to <body>…</body>
  - attempting hover action
    - waiting for element to be visible and stable
Reproduction

A simple

await userEvent.hover(document.body, { position: { x: 0, y: 0 } });

can timeout in our CI since 3.1.2.

This is with the playwright provider.

System Info
System:
    OS: Windows 11 10.0.26100
    CPU: (32) x64 AMD Ryzen 9 9950X3D 16-Core Processor
    Memory: 36.50 GB / 63.58 GB
  Binaries:
    Node: 23.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.3.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.99)
  npmPackages:
    @vitejs/plugin-react: ^4.4.1 => 4.4.1
    @vitest/browser: ^3.1.2 => 3.1.2
    @vitest/coverage-v8: ^3.1.2 => 3.1.2
    playwright: ~1.52.0 => 1.52.0
    vite: ^6.3.2 => 6.3.2
    vitest: ^3.1.2 => 3.1.2
    vitest-browser-react: ^0.1.1 => 0.1.1
Used Package Manager

npm

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal userEvent.hover reproduction using the Playwright provider and compare behavior between versions 3.1.1 and 3.1.2. Trace the timeout handling for browser userEvent actions, including hover and dragAndDrop, and verify that the CI reproduction completes reliably without unexpected timeouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, typescript
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.