diff --git a/docs/guide/browser/context.md b/docs/guide/browser/context.md index 5780534c0288..744bb37ec597 100644 --- a/docs/guide/browser/context.md +++ b/docs/guide/browser/context.md @@ -20,6 +20,7 @@ The `userEvent` API is explained in detail at [Interactivity API](/guide/browser */ export const userEvent: { setup: () => UserEvent + cleanup: () => Promise click: (element: Element, options?: UserEventClickOptions) => Promise dblClick: (element: Element, options?: UserEventDoubleClickOptions) => Promise tripleClick: (element: Element, options?: UserEventTripleClickOptions) => Promise diff --git a/packages/browser/context.d.ts b/packages/browser/context.d.ts index d2c7b1b8fabd..c332b1df9de9 100644 --- a/packages/browser/context.d.ts +++ b/packages/browser/context.d.ts @@ -59,7 +59,12 @@ export interface UserEvent { * @see {@link https://vitest.dev/guide/browser/interactivity-api.html#userevent-setup} */ setup: () => UserEvent - cleanup: () => Promise; + /** + * Cleans up the user event instance, releasing any resources or state it holds, + * such as keyboard press state. For the default `userEvent` instance, this method + * is automatically called after each test case. + */ + cleanup: () => Promise /** * Click on an element. Uses provider's API under the hood and supports all its options. * @see {@link https://playwright.dev/docs/api/class-locator#locator-click} Playwright API