| 187 | } |
| 188 | |
| 189 | export interface UserEvent { |
| 190 | /** |
| 191 | * Creates a new user event instance. This is useful if you need to keep the |
| 192 | * state of keyboard to press and release buttons correctly. |
| 193 | * |
| 194 | * **Note:** Unlike `@testing-library/user-event`, the default `userEvent` instance |
| 195 | * from `vitest/browser` is created once, not every time its methods are called! |
| 196 | * @see {@link https:class="cm">//vitest.dev/api/browser/interactivity.html#userevent-setup} |
| 197 | */ |
| 198 | setup: () => UserEvent |
| 199 | /** |
| 200 | * Cleans up the user event instance, releasing any resources or state it holds, |
| 201 | * such as keyboard press state. For the default `userEvent` instance, this method |
| 202 | * is automatically called after each test case. |
| 203 | */ |
| 204 | cleanup: () => Promise<void> |
| 205 | /** |
| 206 | * Click on an element. Uses provider's API under the hood and supports all its options. |
| 207 | * @see {@link https:class="cm">//playwright.dev/docs/api/class-locator#locator-click} Playwright API |
| 208 | * @see {@link https:class="cm">//webdriver.io/docs/api/element/click/} WebdriverIO API |
| 209 | * @see {@link https:class="cm">//testing-library.com/docs/user-event/convenience/#click} testing-library API |
| 210 | */ |
| 211 | click: (element: Element | Locator, options?: UserEventClickOptions) => Promise<void> |
| 212 | /** |
| 213 | * Triggers a double click event on an element. Uses provider's API under the hood. |
| 214 | * @see {@link https:class="cm">//playwright.dev/docs/api/class-locator#locator-dblclick} Playwright API |
| 215 | * @see {@link https:class="cm">//webdriver.io/docs/api/element/doubleClick/} WebdriverIO API |
| 216 | * @see {@link https:class="cm">//testing-library.com/docs/user-event/convenience/#dblClick} testing-library API |
| 217 | */ |
| 218 | dblClick: (element: Element | Locator, options?: UserEventDoubleClickOptions) => Promise<void> |
| 219 | /** |
| 220 | * Triggers a triple click event on an element. Uses provider's API under the hood. |
| 221 | * @see {@link https:class="cm">//playwright.dev/docs/api/class-locator#locator-click} Playwright API: using `click` with `clickCount: 3` |
| 222 | * @see {@link https:class="cm">//webdriver.io/docs/api/browser/actions/} WebdriverIO API: using actions api with `move` plus three `down + up + pause` events in a row |
| 223 | * @see {@link https:class="cm">//testing-library.com/docs/user-event/convenience/#tripleclick} testing-library API |
| 224 | */ |
| 225 | tripleClick: (element: Element | Locator, options?: UserEventTripleClickOptions) => Promise<void> |
| 226 | /** |
| 227 | * Triggers a {@link https:class="cm">//developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event|`wheel` event} on an element. |
| 228 | * |
| 229 | * @param element - The target element to receive wheel events. |
| 230 | * @param options - Scroll configuration using `delta` or `direction`. |
| 231 | * @returns A promise that resolves when all wheel events have been dispatched. |
| 232 | * |
| 233 | * @since 4.1.0 |
| 234 | * @see {@link https:class="cm">//vitest.dev/api/browser/interactivity#userevent-wheel} |
| 235 | * |
| 236 | * @example |
| 237 | * class="cm">// Scroll down by 100 pixels |
| 238 | * await userEvent.wheel(container, { delta: { y: 100 } }) |
| 239 | * |
| 240 | * @example |
| 241 | * class="cm">// Scroll up 5 times |
| 242 | * await userEvent.wheel(container, { direction: class="st">'up', times: 5 }) |
| 243 | */ |
| 244 | wheel(element: Element | Locator, options: UserEventWheelOptions): Promise<void> |
| 245 | /** |
| 246 | * Choose one or more values from a select element. Uses provider's API under the hood. |
nothing calls this directly
no outgoing calls
no test coverage detected