@vitest/browser 5.0.0-beta.1 → 5.0.0-beta.2
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 +32 -1
- package/dist/client/.vite/manifest.json +6 -6
- package/dist/client/__vitest__/assets/{index-BmuVn2L3.js → index-Cd6On2Pm.js} +58 -58
- package/dist/client/__vitest__/assets/{index-CxYquQyv.css → index-Dw9P28Qt.css} +1 -1
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-pTEf6o0n.js → orchestrator-BfoS0x4w.js} +31 -3
- package/dist/client/__vitest_browser__/{utils-BYUpz6v6.js → tester-BJtW9QqZ.js} +2551 -342
- package/dist/client/__vitest_browser__/utils-Nd8hqrhP.js +189 -0
- package/dist/client/orchestrator.html +2 -2
- package/dist/client/tester/locators.d.ts +69 -0
- package/dist/client/tester/tester.html +2 -2
- package/dist/client/tester/trace.d.ts +2 -1
- package/dist/context.js +21 -22
- package/dist/expect-element.js +30 -30
- package/dist/index.d.ts +6 -22
- package/dist/index.js +8 -4551
- package/dist/locators-CesZ2RSY.js +5 -0
- package/dist/locators.d.ts +9 -1
- package/dist/locators.js +1 -1
- package/dist/shared/screenshotMatcher/types.d.ts +3 -3
- package/package.json +10 -7
- package/dist/client/__vitest__/bg.png +0 -0
- package/dist/client/__vitest_browser__/tester-CIKiUsoz.js +0 -2431
- package/dist/index-BlWsE3ij.js +0 -5
package/context.d.ts
CHANGED
|
@@ -539,6 +539,11 @@ export interface LocatorSelectors {
|
|
|
539
539
|
|
|
540
540
|
export interface FrameLocator extends LocatorSelectors {}
|
|
541
541
|
|
|
542
|
+
export interface SerializedLocator {
|
|
543
|
+
selector: string
|
|
544
|
+
locator: string
|
|
545
|
+
}
|
|
546
|
+
|
|
542
547
|
export interface SelectorOptions {
|
|
543
548
|
/**
|
|
544
549
|
* How long to wait until a single element is found. By default, this has the same timeout as the test.
|
|
@@ -579,6 +584,32 @@ export interface Locator extends LocatorSelectors {
|
|
|
579
584
|
*/
|
|
580
585
|
readonly length: number
|
|
581
586
|
|
|
587
|
+
/**
|
|
588
|
+
* Returns a JSON-serializable representation of the locator with two fields:
|
|
589
|
+
* - `selector`: the provider-specific selector string used to query the element at runtime.
|
|
590
|
+
* - `locator`: a human-readable description of the locator (e.g. `getByRole('button')`),
|
|
591
|
+
* used for error messages and tracing.
|
|
592
|
+
*
|
|
593
|
+
* Use this to forward a locator to a [browser command](https://vitest.dev/api/browser/commands),
|
|
594
|
+
* which runs in Node and cannot receive a live `Locator` instance. Vitest also auto-serializes
|
|
595
|
+
* any `Locator` argument passed to a command, so calling `serialize()` explicitly is rarely necessary.
|
|
596
|
+
*
|
|
597
|
+
* @see {@link https://vitest.dev/api/browser/locators#serialize}
|
|
598
|
+
*/
|
|
599
|
+
serialize(): SerializedLocator
|
|
600
|
+
/**
|
|
601
|
+
* Alias of {@link serialize}. Defined so that `JSON.stringify(locator)` and
|
|
602
|
+
* structured-clone-based transports return a {@link SerializedLocator} object.
|
|
603
|
+
*
|
|
604
|
+
* @see {@link https://vitest.dev/api/browser/locators#tojson}
|
|
605
|
+
*/
|
|
606
|
+
toJSON(): SerializedLocator
|
|
607
|
+
/**
|
|
608
|
+
* A human-readable description of the locator (e.g. `getByRole('button')`).
|
|
609
|
+
*
|
|
610
|
+
* @see {@link https://vitest.dev/api/browser/locators#aslocator}
|
|
611
|
+
*/
|
|
612
|
+
asLocator(): string
|
|
582
613
|
/**
|
|
583
614
|
* Click on an element. You can use the options to set the cursor position.
|
|
584
615
|
* @see {@link https://vitest.dev/api/browser/interactivity#userevent-click}
|
|
@@ -934,7 +965,7 @@ export const utils: {
|
|
|
934
965
|
/**
|
|
935
966
|
* Creates "Cannot find element" error. Useful for custom locators.
|
|
936
967
|
*/
|
|
937
|
-
getElementError(selector: string, container?: Element): Error
|
|
968
|
+
getElementError(selector: string | Locator, container?: Element): Error
|
|
938
969
|
|
|
939
970
|
/**
|
|
940
971
|
* Utilities for generating and working with ARIA trees and templates.
|
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
"src": "../../../../node_modules/.pnpm/rrweb-snapshot@2.0.0-alpha.20_patch_hash=d11ec9bd9b66247ba493ab5fd117fbf0b4cb6e5d0a6a7c600d1d844bfa3d3044/node_modules/rrweb-snapshot/dist/rrweb-snapshot.js",
|
|
6
6
|
"isDynamicEntry": true
|
|
7
7
|
},
|
|
8
|
-
"_utils-
|
|
9
|
-
"file": "__vitest_browser__/utils-
|
|
8
|
+
"_utils-Nd8hqrhP.js": {
|
|
9
|
+
"file": "__vitest_browser__/utils-Nd8hqrhP.js",
|
|
10
10
|
"name": "utils"
|
|
11
11
|
},
|
|
12
12
|
"orchestrator.html": {
|
|
13
|
-
"file": "__vitest_browser__/orchestrator-
|
|
13
|
+
"file": "__vitest_browser__/orchestrator-BfoS0x4w.js",
|
|
14
14
|
"name": "orchestrator",
|
|
15
15
|
"src": "orchestrator.html",
|
|
16
16
|
"isEntry": true,
|
|
17
17
|
"imports": [
|
|
18
|
-
"_utils-
|
|
18
|
+
"_utils-Nd8hqrhP.js"
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
21
|
"tester/tester.html": {
|
|
22
|
-
"file": "__vitest_browser__/tester-
|
|
22
|
+
"file": "__vitest_browser__/tester-BJtW9QqZ.js",
|
|
23
23
|
"name": "tester",
|
|
24
24
|
"src": "tester/tester.html",
|
|
25
25
|
"isEntry": true,
|
|
26
26
|
"imports": [
|
|
27
|
-
"_utils-
|
|
27
|
+
"_utils-Nd8hqrhP.js"
|
|
28
28
|
],
|
|
29
29
|
"dynamicImports": [
|
|
30
30
|
"../../../../node_modules/.pnpm/rrweb-snapshot@2.0.0-alpha.20_patch_hash=d11ec9bd9b66247ba493ab5fd117fbf0b4cb6e5d0a6a7c600d1d844bfa3d3044/node_modules/rrweb-snapshot/dist/rrweb-snapshot.js"
|