Skip to content

Allow users to override the default options of @testing-library/user-event used under the hood by Locator in preview mode #9882

@yjaaidi

Description

@yjaaidi

Clear and concise description of the problem

When using preview mode — mostly in webcontainer environments such as Stackblitz — methods such as Locator#fill never resolve when fake timers are in manual mode.

It would be nice if users could override the advanceTime option of userEvent.setup() that is used under the hood to either use real timers or advance fake timer.

Suggested solution

Allow users to configure default user-event options with some API such as:

import { userEvent }  from 'vitest/browser';
userEvent.setDefaultOptions({ advanceTime });

Another approach — which is probably better — is to make the PreviewLocator use a userEvent instance where the time is advanced with real timers.
This would make it more symmetric to other providers.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions