@vitest/browser 4.1.5 → 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 +50 -1
- package/dist/client/.vite/manifest.json +15 -6
- package/dist/client/__vitest__/assets/index-Cd6On2Pm.js +136 -0
- package/dist/client/__vitest__/assets/index-Dw9P28Qt.css +1 -0
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-DM4mHHP0.js → orchestrator-BfoS0x4w.js} +55 -31
- package/dist/client/__vitest_browser__/rrweb-snapshot-xhvrgOHx.js +5476 -0
- package/dist/client/__vitest_browser__/{utils-DmkAiRYk.js → tester-BJtW9QqZ.js} +2674 -930
- 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 +54 -0
- package/dist/client.js +1 -0
- package/dist/context.js +155 -15
- package/dist/expect-element.js +30 -30
- package/dist/index.d.ts +6 -22
- package/dist/index.js +29 -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/dist/state.js +1 -0
- package/dist/vendor-types.d.ts +131 -0
- package/dist/vendor-types.ts +1 -0
- package/package.json +15 -7
- package/dist/client/__vitest__/assets/index-BPQdrqGZ.js +0 -94
- package/dist/client/__vitest__/assets/index-Da0hb3oU.css +0 -1
- package/dist/client/__vitest__/bg.png +0 -0
- package/dist/client/__vitest_browser__/tester-Bf18VQr2.js +0 -2288
- package/dist/index-D8jtZoIM.js +0 -5
package/context.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { SerializedConfig } from 'vitest'
|
|
|
2
2
|
import { StringifyOptions, CDPSession, BrowserCommands } from 'vitest/internal/browser'
|
|
3
3
|
import { ARIARole } from './aria-role.js'
|
|
4
4
|
import {} from './matchers.js'
|
|
5
|
+
import { __ivyaAriaTypes } from '@vitest/browser/internal/vendor-types'
|
|
5
6
|
|
|
6
7
|
export type BufferEncoding =
|
|
7
8
|
| 'ascii'
|
|
@@ -538,6 +539,11 @@ export interface LocatorSelectors {
|
|
|
538
539
|
|
|
539
540
|
export interface FrameLocator extends LocatorSelectors {}
|
|
540
541
|
|
|
542
|
+
export interface SerializedLocator {
|
|
543
|
+
selector: string
|
|
544
|
+
locator: string
|
|
545
|
+
}
|
|
546
|
+
|
|
541
547
|
export interface SelectorOptions {
|
|
542
548
|
/**
|
|
543
549
|
* How long to wait until a single element is found. By default, this has the same timeout as the test.
|
|
@@ -578,6 +584,32 @@ export interface Locator extends LocatorSelectors {
|
|
|
578
584
|
*/
|
|
579
585
|
readonly length: number
|
|
580
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
|
|
581
613
|
/**
|
|
582
614
|
* Click on an element. You can use the options to set the cursor position.
|
|
583
615
|
* @see {@link https://vitest.dev/api/browser/interactivity#userevent-click}
|
|
@@ -933,7 +965,24 @@ export const utils: {
|
|
|
933
965
|
/**
|
|
934
966
|
* Creates "Cannot find element" error. Useful for custom locators.
|
|
935
967
|
*/
|
|
936
|
-
getElementError(selector: string, container?: Element): Error
|
|
968
|
+
getElementError(selector: string | Locator, container?: Element): Error
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Utilities for generating and working with ARIA trees and templates.
|
|
972
|
+
* @experimental
|
|
973
|
+
*/
|
|
974
|
+
aria: {
|
|
975
|
+
/** Captures the ARIA tree for a DOM subtree. */
|
|
976
|
+
generateAriaTree: typeof __ivyaAriaTypes.generateAriaTree
|
|
977
|
+
/** Renders a captured ARIA tree to the textual snapshot format. */
|
|
978
|
+
renderAriaTree: typeof __ivyaAriaTypes.renderAriaTree
|
|
979
|
+
/** Renders an ARIA template back to text. */
|
|
980
|
+
renderAriaTemplate: typeof __ivyaAriaTypes.renderAriaTemplate
|
|
981
|
+
/** Parses textual ARIA snapshot syntax into a template tree. */
|
|
982
|
+
parseAriaTemplate: typeof __ivyaAriaTypes.parseAriaTemplate
|
|
983
|
+
/** Matches a captured ARIA tree against a parsed template. */
|
|
984
|
+
matchAriaTree: typeof __ivyaAriaTypes.matchAriaTree
|
|
985
|
+
}
|
|
937
986
|
}
|
|
938
987
|
|
|
939
988
|
export const locators: BrowserLocators
|
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"file": "__vitest_browser__/
|
|
2
|
+
"../../../../node_modules/.pnpm/rrweb-snapshot@2.0.0-alpha.20_patch_hash=d11ec9bd9b66247ba493ab5fd117fbf0b4cb6e5d0a6a7c600d1d844bfa3d3044/node_modules/rrweb-snapshot/dist/rrweb-snapshot.js": {
|
|
3
|
+
"file": "__vitest_browser__/rrweb-snapshot-xhvrgOHx.js",
|
|
4
|
+
"name": "rrweb-snapshot",
|
|
5
|
+
"src": "../../../../node_modules/.pnpm/rrweb-snapshot@2.0.0-alpha.20_patch_hash=d11ec9bd9b66247ba493ab5fd117fbf0b4cb6e5d0a6a7c600d1d844bfa3d3044/node_modules/rrweb-snapshot/dist/rrweb-snapshot.js",
|
|
6
|
+
"isDynamicEntry": true
|
|
7
|
+
},
|
|
8
|
+
"_utils-Nd8hqrhP.js": {
|
|
9
|
+
"file": "__vitest_browser__/utils-Nd8hqrhP.js",
|
|
4
10
|
"name": "utils"
|
|
5
11
|
},
|
|
6
12
|
"orchestrator.html": {
|
|
7
|
-
"file": "__vitest_browser__/orchestrator-
|
|
13
|
+
"file": "__vitest_browser__/orchestrator-BfoS0x4w.js",
|
|
8
14
|
"name": "orchestrator",
|
|
9
15
|
"src": "orchestrator.html",
|
|
10
16
|
"isEntry": true,
|
|
11
17
|
"imports": [
|
|
12
|
-
"_utils-
|
|
18
|
+
"_utils-Nd8hqrhP.js"
|
|
13
19
|
]
|
|
14
20
|
},
|
|
15
21
|
"tester/tester.html": {
|
|
16
|
-
"file": "__vitest_browser__/tester-
|
|
22
|
+
"file": "__vitest_browser__/tester-BJtW9QqZ.js",
|
|
17
23
|
"name": "tester",
|
|
18
24
|
"src": "tester/tester.html",
|
|
19
25
|
"isEntry": true,
|
|
20
26
|
"imports": [
|
|
21
|
-
"_utils-
|
|
27
|
+
"_utils-Nd8hqrhP.js"
|
|
28
|
+
],
|
|
29
|
+
"dynamicImports": [
|
|
30
|
+
"../../../../node_modules/.pnpm/rrweb-snapshot@2.0.0-alpha.20_patch_hash=d11ec9bd9b66247ba493ab5fd117fbf0b4cb6e5d0a6a7c600d1d844bfa3d3044/node_modules/rrweb-snapshot/dist/rrweb-snapshot.js"
|
|
22
31
|
]
|
|
23
32
|
}
|
|
24
33
|
}
|