@vitest/browser 2.0.0-beta.11 → 2.0.0-beta.13

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
@@ -19,12 +19,20 @@ export interface FsOptions {
19
19
  flag?: string | number
20
20
  }
21
21
 
22
+ export interface CDPSession {
23
+ // methods are defined by the provider type augmentation
24
+ }
25
+
22
26
  export interface ScreenshotOptions {
23
27
  element?: Element
24
28
  /**
25
29
  * Path relative to the `screenshotDirectory` in the test config.
26
30
  */
27
31
  path?: string
32
+ /**
33
+ * Will also return the base64 encoded screenshot alongside the path.
34
+ */
35
+ base64?: boolean
28
36
  }
29
37
 
30
38
  export interface BrowserCommands {
@@ -56,6 +64,13 @@ export interface UserEvent {
56
64
  * @see {@link https://testing-library.com/docs/user-event/convenience/#dblClick} testing-library API
57
65
  */
58
66
  dblClick: (element: Element, options?: UserEventDoubleClickOptions) => Promise<void>
67
+ /**
68
+ * Triggers a triple click event on an element. Uses provider's API under the hood.
69
+ * @see {@link https://playwright.dev/docs/api/class-locator#locator-click} Playwright API: using `click` with `clickCount: 3`
70
+ * @see {@link https://webdriver.io/docs/api/browser/actions/} WebdriverIO API: using actions api with `move` plus three `down + up + pause` events in a row
71
+ * @see {@link https://testing-library.com/docs/user-event/convenience/#tripleclick} testing-library API
72
+ */
73
+ tripleClick: (element: Element, options?: UserEventTripleClickOptions) => Promise<void>
59
74
  /**
60
75
  * Choose one or more values from a select element. Uses provider's API under the hood.
61
76
  * If select doesn't have `multiple` attribute, only the first value will be selected.
@@ -161,6 +176,7 @@ export interface UserEventHoverOptions {}
161
176
  export interface UserEventSelectOptions {}
162
177
  export interface UserEventClickOptions {}
163
178
  export interface UserEventDoubleClickOptions {}
179
+ export interface UserEventTripleClickOptions {}
164
180
  export interface UserEventDragAndDropOptions {}
165
181
 
166
182
  export interface UserEventTabOptions {
@@ -206,7 +222,7 @@ export const server: {
206
222
  browser: string
207
223
  /**
208
224
  * Available commands for the browser.
209
- * @see {@link https://vitest.dev/guide/browser#commands}
225
+ * @see {@link https://vitest.dev/guide/browser/commands}
210
226
  */
211
227
  commands: BrowserCommands
212
228
  }
@@ -221,7 +237,7 @@ export const userEvent: UserEvent
221
237
  /**
222
238
  * Available commands for the browser.
223
239
  * A shortcut to `server.commands`.
224
- * @see {@link https://vitest.dev/guide/browser#commands}
240
+ * @see {@link https://vitest.dev/guide/browser/commands}
225
241
  */
226
242
  export const commands: BrowserCommands
227
243
 
@@ -233,12 +249,17 @@ export interface BrowserPage {
233
249
  /**
234
250
  * Change the size of iframe's viewport.
235
251
  */
236
- viewport: (width: number, height: number) => Promise<void>
252
+ viewport(width: number, height: number): Promise<void>
237
253
  /**
238
254
  * Make a screenshot of the test iframe or a specific element.
239
- * @returns Path to the screenshot file.
255
+ * @returns Path to the screenshot file or path and base64.
240
256
  */
241
- screenshot: (options?: ScreenshotOptions) => Promise<string>
257
+ screenshot(options: Omit<ScreenshotOptions, 'base64'> & { base64: true }): Promise<{
258
+ path: string
259
+ base64: string
260
+ }>
261
+ screenshot(options?: ScreenshotOptions): Promise<string>
242
262
  }
243
263
 
244
264
  export const page: BrowserPage
265
+ export const cdp: () => CDPSession
@@ -1,24 +1,24 @@
1
1
  {
2
- "_rpc-D6HtJ5Rb.js": {
3
- "file": "__vitest_browser__/rpc-D6HtJ5Rb.js",
4
- "name": "rpc"
2
+ "_client-dLyjuL0K.js": {
3
+ "file": "__vitest_browser__/client-dLyjuL0K.js",
4
+ "name": "client"
5
5
  },
6
6
  "orchestrator.html": {
7
- "file": "__vitest_browser__/orchestrator-DQ4hbmZ_.js",
7
+ "file": "__vitest_browser__/orchestrator-x0A1t8rC.js",
8
8
  "name": "orchestrator",
9
9
  "src": "orchestrator.html",
10
10
  "isEntry": true,
11
11
  "imports": [
12
- "_rpc-D6HtJ5Rb.js"
12
+ "_client-dLyjuL0K.js"
13
13
  ]
14
14
  },
15
15
  "tester/tester.html": {
16
- "file": "__vitest_browser__/tester-IF8AbWCS.js",
16
+ "file": "__vitest_browser__/tester-BdcP5piS.js",
17
17
  "name": "tester",
18
18
  "src": "tester/tester.html",
19
19
  "isEntry": true,
20
20
  "imports": [
21
- "_rpc-D6HtJ5Rb.js"
21
+ "_client-dLyjuL0K.js"
22
22
  ]
23
23
  }
24
24
  }