@vitest/browser 3.2.0-beta.1 → 3.2.0-beta.3
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 +23 -2
- package/context.js +1 -0
- package/dist/client/.vite/manifest.json +2 -2
- package/dist/client/__vitest__/assets/index-C03hLyIS.js +52 -0
- package/dist/client/__vitest__/assets/{index-DJfrXR3P.css → index-CVSF215x.css} +1 -1
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-CuTjqoE1.js → orchestrator-Bsc_nLaw.js} +6 -2
- package/dist/client/__vitest_browser__/{tester-D-yxPeOx.js → tester-BV-CSJ5v.js} +7 -3
- package/dist/client/orchestrator.html +1 -1
- package/dist/client/tester/tester.html +1 -1
- package/dist/client.js +5 -0
- package/dist/context.js +48 -2
- package/dist/expect-element.js +1 -1
- package/dist/{index-C3ICQ6zz.js → index-D0pxULUR.js} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +125 -23
- package/dist/locators/index.d.ts +1 -0
- package/dist/locators/index.js +1 -1
- package/dist/locators/playwright.js +1 -1
- package/dist/locators/preview.js +1 -1
- package/dist/locators/webdriverio.js +1 -1
- package/dist/providers.js +2 -1
- package/dist/{public-utils-DUr23h1p.js → public-utils-DJ-T0CfF.js} +1 -1
- package/dist/state.js +3 -0
- package/dist/utils.js +1 -1
- package/dist/{webdriver-D7k26Na7.js → webdriver-B1QbgqhC.js} +52 -13
- package/package.json +12 -12
- package/utils.d.ts +1 -1
- package/dist/client/__vitest__/assets/index-BZjudRZr.js +0 -52
package/context.d.ts
CHANGED
|
@@ -29,12 +29,19 @@ export interface ScreenshotOptions {
|
|
|
29
29
|
element?: Element | Locator
|
|
30
30
|
/**
|
|
31
31
|
* Path relative to the current test file.
|
|
32
|
+
* @default `__screenshots__/${testFileName}/${testName}.png`
|
|
32
33
|
*/
|
|
33
34
|
path?: string
|
|
34
35
|
/**
|
|
35
36
|
* Will also return the base64 encoded screenshot alongside the path.
|
|
36
37
|
*/
|
|
37
38
|
base64?: boolean
|
|
39
|
+
/**
|
|
40
|
+
* Keep the screenshot on the file system. If file is not saved,
|
|
41
|
+
* `page.screenshot` always returns `base64` screenshot.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
save?: boolean
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
export interface BrowserCommands {
|
|
@@ -373,7 +380,7 @@ export interface Locator extends LocatorSelectors {
|
|
|
373
380
|
*/
|
|
374
381
|
unhover(options?: UserEventHoverOptions): Promise<void>
|
|
375
382
|
/**
|
|
376
|
-
* Sets the value of the current `input`, `textarea` or `
|
|
383
|
+
* Sets the value of the current `input`, `textarea` or `contenteditable` element.
|
|
377
384
|
* @see {@link https://vitest.dev/guide/browser/interactivity-api#userevent-fill}
|
|
378
385
|
*/
|
|
379
386
|
fill(text: string, options?: UserEventFillOptions): Promise<void>
|
|
@@ -552,11 +559,16 @@ export interface BrowserPage extends LocatorSelectors {
|
|
|
552
559
|
* Make a screenshot of the test iframe or a specific element.
|
|
553
560
|
* @returns Path to the screenshot file or path and base64.
|
|
554
561
|
*/
|
|
562
|
+
screenshot(options: Omit<ScreenshotOptions, 'save'> & { save: false }): Promise<string>
|
|
555
563
|
screenshot(options: Omit<ScreenshotOptions, 'base64'> & { base64: true }): Promise<{
|
|
556
564
|
path: string
|
|
557
565
|
base64: string
|
|
558
566
|
}>
|
|
559
|
-
screenshot(options?: ScreenshotOptions): Promise<string>
|
|
567
|
+
screenshot(options?: Omit<ScreenshotOptions, 'base64'>): Promise<string>
|
|
568
|
+
screenshot(options?: ScreenshotOptions): Promise<string | {
|
|
569
|
+
path: string
|
|
570
|
+
base64: string
|
|
571
|
+
}>
|
|
560
572
|
/**
|
|
561
573
|
* Extend default `page` object with custom methods.
|
|
562
574
|
*/
|
|
@@ -568,5 +580,14 @@ export interface BrowserPage extends LocatorSelectors {
|
|
|
568
580
|
elementLocator(element: Element): Locator
|
|
569
581
|
}
|
|
570
582
|
|
|
583
|
+
export interface BrowserLocators {
|
|
584
|
+
createElementLocators(element: Element): LocatorSelectors
|
|
585
|
+
extend(methods: {
|
|
586
|
+
[K in keyof LocatorSelectors]?: (...args: Parameters<LocatorSelectors[K]>) => ReturnType<LocatorSelectors[K]> | string
|
|
587
|
+
}): void
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export const locators: BrowserLocators
|
|
591
|
+
|
|
571
592
|
export const page: BrowserPage
|
|
572
593
|
export const cdp: () => CDPSession
|
package/context.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "utils"
|
|
5
5
|
},
|
|
6
6
|
"orchestrator.html": {
|
|
7
|
-
"file": "__vitest_browser__/orchestrator-
|
|
7
|
+
"file": "__vitest_browser__/orchestrator-Bsc_nLaw.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/tester.html": {
|
|
16
|
-
"file": "__vitest_browser__/tester-
|
|
16
|
+
"file": "__vitest_browser__/tester-BV-CSJ5v.js",
|
|
17
17
|
"name": "tester",
|
|
18
18
|
"src": "tester/tester.html",
|
|
19
19
|
"isEntry": true,
|