@vitest/browser 2.0.0-beta.5 → 2.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/context.d.ts CHANGED
@@ -33,6 +33,20 @@ export interface BrowserCommands {
33
33
  sendKeys: (payload: SendKeysPayload) => Promise<void>
34
34
  }
35
35
 
36
+ export interface UserEvent {
37
+ /**
38
+ * Click on an element. Uses provider's API under the hood and supports all its options.
39
+ * @see {@link https://playwright.dev/docs/api/class-locator#locator-click} Playwright API
40
+ * @see {@link https://webdriver.io/docs/api/element/click/} WebdriverIO API
41
+ * @see {@link https://testing-library.com/docs/user-event/convenience/#click} testing-library API
42
+ */
43
+ click: (element: Element, options?: UserEventClickOptions) => Promise<void>
44
+ }
45
+
46
+ export interface UserEventClickOptions {
47
+ [key: string]: any
48
+ }
49
+
36
50
  type Platform =
37
51
  | 'aix'
38
52
  | 'android'
@@ -72,6 +86,13 @@ export const server: {
72
86
  commands: BrowserCommands
73
87
  }
74
88
 
89
+ /**
90
+ * Handler for user interactions. The support is provided by the browser provider (`playwright` or `webdriverio`).
91
+ * If used with `preview` provider, fallbacks to simulated events via `@testing-library/user-event`.
92
+ * @experimental
93
+ */
94
+ export const userEvent: UserEvent
95
+
75
96
  /**
76
97
  * Available commands for the browser.
77
98
  * A shortcut to `server.commands`.
@@ -87,5 +108,5 @@ export const page: {
87
108
  /**
88
109
  * Change the size of iframe's viewport.
89
110
  */
90
- viewport: (width: number | string, height: number | string) => Promise<void>
111
+ viewport: (width: number, height: number) => Promise<void>
91
112
  }
@@ -4,7 +4,7 @@
4
4
  "name": "rpc"
5
5
  },
6
6
  "orchestrator.html": {
7
- "file": "__vitest_browser__/orchestrator-CEB54dI4.js",
7
+ "file": "__vitest_browser__/orchestrator-CTfJ7g35.js",
8
8
  "name": "orchestrator",
9
9
  "src": "orchestrator.html",
10
10
  "isEntry": true,
@@ -13,7 +13,7 @@
13
13
  ]
14
14
  },
15
15
  "tester.html": {
16
- "file": "__vitest_browser__/tester-C3Mchfpf.js",
16
+ "file": "__vitest_browser__/tester-Bo1gw1oi.js",
17
17
  "name": "tester",
18
18
  "src": "tester.html",
19
19
  "isEntry": true,