@vitest/browser 2.0.0-beta.12 → 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
@@ -29,6 +29,10 @@ export interface ScreenshotOptions {
29
29
  * Path relative to the `screenshotDirectory` in the test config.
30
30
  */
31
31
  path?: string
32
+ /**
33
+ * Will also return the base64 encoded screenshot alongside the path.
34
+ */
35
+ base64?: boolean
32
36
  }
33
37
 
34
38
  export interface BrowserCommands {
@@ -60,6 +64,13 @@ export interface UserEvent {
60
64
  * @see {@link https://testing-library.com/docs/user-event/convenience/#dblClick} testing-library API
61
65
  */
62
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>
63
74
  /**
64
75
  * Choose one or more values from a select element. Uses provider's API under the hood.
65
76
  * If select doesn't have `multiple` attribute, only the first value will be selected.
@@ -165,6 +176,7 @@ export interface UserEventHoverOptions {}
165
176
  export interface UserEventSelectOptions {}
166
177
  export interface UserEventClickOptions {}
167
178
  export interface UserEventDoubleClickOptions {}
179
+ export interface UserEventTripleClickOptions {}
168
180
  export interface UserEventDragAndDropOptions {}
169
181
 
170
182
  export interface UserEventTabOptions {
@@ -210,7 +222,7 @@ export const server: {
210
222
  browser: string
211
223
  /**
212
224
  * Available commands for the browser.
213
- * @see {@link https://vitest.dev/guide/browser#commands}
225
+ * @see {@link https://vitest.dev/guide/browser/commands}
214
226
  */
215
227
  commands: BrowserCommands
216
228
  }
@@ -225,7 +237,7 @@ export const userEvent: UserEvent
225
237
  /**
226
238
  * Available commands for the browser.
227
239
  * A shortcut to `server.commands`.
228
- * @see {@link https://vitest.dev/guide/browser#commands}
240
+ * @see {@link https://vitest.dev/guide/browser/commands}
229
241
  */
230
242
  export const commands: BrowserCommands
231
243
 
@@ -237,12 +249,16 @@ export interface BrowserPage {
237
249
  /**
238
250
  * Change the size of iframe's viewport.
239
251
  */
240
- viewport: (width: number, height: number) => Promise<void>
252
+ viewport(width: number, height: number): Promise<void>
241
253
  /**
242
254
  * Make a screenshot of the test iframe or a specific element.
243
- * @returns Path to the screenshot file.
255
+ * @returns Path to the screenshot file or path and base64.
244
256
  */
245
- 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>
246
262
  }
247
263
 
248
264
  export const page: BrowserPage
@@ -1,24 +1,24 @@
1
1
  {
2
- "_client-Dz5Ebwug.js": {
3
- "file": "__vitest_browser__/client-Dz5Ebwug.js",
2
+ "_client-dLyjuL0K.js": {
3
+ "file": "__vitest_browser__/client-dLyjuL0K.js",
4
4
  "name": "client"
5
5
  },
6
6
  "orchestrator.html": {
7
- "file": "__vitest_browser__/orchestrator-DJ6H4qlM.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
- "_client-Dz5Ebwug.js"
12
+ "_client-dLyjuL0K.js"
13
13
  ]
14
14
  },
15
15
  "tester/tester.html": {
16
- "file": "__vitest_browser__/tester-DHXll_4H.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
- "_client-Dz5Ebwug.js"
21
+ "_client-dLyjuL0K.js"
22
22
  ]
23
23
  }
24
24
  }