@vitest/browser 2.2.0-beta.2 → 3.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 +17 -0
- package/dist/client/.vite/manifest.json +1 -1
- package/dist/client/__vitest__/assets/index-BgsOOCCp.js +52 -0
- package/dist/client/__vitest__/assets/{index-CVf0zraX.css → index-D1v_Nqq1.css} +1 -1
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{tester-BaiNqOPw.js → tester-BdwA4c5U.js} +9 -7
- package/dist/client/tester/tester.html +1 -1
- package/dist/context.js +85 -20
- package/dist/{index-CKtADM3n.js → index-CMAn5ZST.js} +7 -1
- package/dist/index.js +14 -30
- package/dist/locators/index.d.ts +2 -0
- package/dist/locators/index.js +1 -1
- package/dist/locators/playwright.js +1 -1
- package/dist/locators/preview.js +11 -34
- package/dist/locators/webdriverio.js +1 -1
- package/dist/providers.js +1 -1
- package/dist/{webdriver-D0J8HSNX.js → webdriver-JzwxG3Ek.js} +6 -2
- package/matchers.d.ts +6 -1
- package/package.json +20 -17
- package/providers/playwright.d.ts +14 -8
- package/dist/client/__vitest__/assets/index-XquuyCWh.js +0 -52
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import MagicString from 'magic-string';
|
|
|
8
8
|
import sirv from 'sirv';
|
|
9
9
|
import { coverageConfigDefaults } from 'vitest/config';
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
|
-
import { P as PlaywrightBrowserProvider, W as WebdriverBrowserProvider } from './webdriver-
|
|
11
|
+
import { P as PlaywrightBrowserProvider, W as WebdriverBrowserProvider } from './webdriver-JzwxG3Ek.js';
|
|
12
12
|
import { resolve as resolve$1, dirname as dirname$1, basename as basename$1, normalize as normalize$1 } from 'node:path';
|
|
13
13
|
import { mkdir, readFile as readFile$1 } from 'node:fs/promises';
|
|
14
14
|
import crypto from 'node:crypto';
|
|
@@ -16,7 +16,7 @@ import { WebSocketServer } from 'ws';
|
|
|
16
16
|
import { parseErrorStacktrace, parseStacktrace } from '@vitest/utils/source-map';
|
|
17
17
|
import * as nodeos from 'node:os';
|
|
18
18
|
|
|
19
|
-
var version = "
|
|
19
|
+
var version = "3.0.0-beta.2";
|
|
20
20
|
|
|
21
21
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
22
22
|
function normalizeWindowsPath(input = "") {
|
|
@@ -204,9 +204,7 @@ const clear = async (context, selector) => {
|
|
|
204
204
|
if (context.provider instanceof PlaywrightBrowserProvider) {
|
|
205
205
|
const { iframe } = context;
|
|
206
206
|
const element = iframe.locator(selector);
|
|
207
|
-
await element.clear(
|
|
208
|
-
timeout: 1e3
|
|
209
|
-
});
|
|
207
|
+
await element.clear();
|
|
210
208
|
} else if (context.provider instanceof WebdriverBrowserProvider) {
|
|
211
209
|
const browser = context.browser;
|
|
212
210
|
const element = await browser.$(selector);
|
|
@@ -220,10 +218,7 @@ const click = async (context, selector, options = {}) => {
|
|
|
220
218
|
const provider = context.provider;
|
|
221
219
|
if (provider instanceof PlaywrightBrowserProvider) {
|
|
222
220
|
const tester = context.iframe;
|
|
223
|
-
await tester.locator(selector).click(
|
|
224
|
-
timeout: 1e3,
|
|
225
|
-
...options
|
|
226
|
-
});
|
|
221
|
+
await tester.locator(selector).click(options);
|
|
227
222
|
} else if (provider instanceof WebdriverBrowserProvider) {
|
|
228
223
|
const browser = context.browser;
|
|
229
224
|
await browser.$(selector).click(options);
|
|
@@ -248,7 +243,6 @@ const tripleClick = async (context, selector, options = {}) => {
|
|
|
248
243
|
if (provider instanceof PlaywrightBrowserProvider) {
|
|
249
244
|
const tester = context.iframe;
|
|
250
245
|
await tester.locator(selector).click({
|
|
251
|
-
timeout: 1e3,
|
|
252
246
|
...options,
|
|
253
247
|
clickCount: 3
|
|
254
248
|
});
|
|
@@ -266,10 +260,7 @@ const dragAndDrop = async (context, source, target, options_) => {
|
|
|
266
260
|
await frame.dragAndDrop(
|
|
267
261
|
source,
|
|
268
262
|
target,
|
|
269
|
-
|
|
270
|
-
timeout: 1e3,
|
|
271
|
-
...options_
|
|
272
|
-
}
|
|
263
|
+
options_
|
|
273
264
|
);
|
|
274
265
|
} else if (context.provider instanceof WebdriverBrowserProvider) {
|
|
275
266
|
const $source = context.browser.$(source);
|
|
@@ -286,7 +277,7 @@ const fill = async (context, selector, text, options = {}) => {
|
|
|
286
277
|
if (context.provider instanceof PlaywrightBrowserProvider) {
|
|
287
278
|
const { iframe } = context;
|
|
288
279
|
const element = iframe.locator(selector);
|
|
289
|
-
await element.fill(text,
|
|
280
|
+
await element.fill(text, options);
|
|
290
281
|
} else if (context.provider instanceof WebdriverBrowserProvider) {
|
|
291
282
|
const browser = context.browser;
|
|
292
283
|
await browser.$(selector).setValue(text);
|
|
@@ -426,10 +417,7 @@ const _fileInfo = async ({ project, testPath = process.cwd() }, path, encoding)
|
|
|
426
417
|
|
|
427
418
|
const hover = async (context, selector, options = {}) => {
|
|
428
419
|
if (context.provider instanceof PlaywrightBrowserProvider) {
|
|
429
|
-
await context.iframe.locator(selector).hover(
|
|
430
|
-
timeout: 1e3,
|
|
431
|
-
...options
|
|
432
|
-
});
|
|
420
|
+
await context.iframe.locator(selector).hover(options);
|
|
433
421
|
} else if (context.provider instanceof WebdriverBrowserProvider) {
|
|
434
422
|
const browser = context.browser;
|
|
435
423
|
await browser.$(selector).moveTo(options);
|
|
@@ -935,7 +923,6 @@ const screenshot = async (context, name, options = {}) => {
|
|
|
935
923
|
const { element: selector, ...config } = options;
|
|
936
924
|
const element = context.iframe.locator(`${selector}`);
|
|
937
925
|
const buffer2 = await element.screenshot({
|
|
938
|
-
timeout: 1e3,
|
|
939
926
|
...config,
|
|
940
927
|
path: savePath
|
|
941
928
|
});
|
|
@@ -997,10 +984,7 @@ const selectOptions = async (context, selector, userValues, options = {}) => {
|
|
|
997
984
|
}
|
|
998
985
|
return elementHandler;
|
|
999
986
|
}));
|
|
1000
|
-
await selectElement.selectOption(values,
|
|
1001
|
-
timeout: 1e3,
|
|
1002
|
-
...options
|
|
1003
|
-
});
|
|
987
|
+
await selectElement.selectOption(values, options);
|
|
1004
988
|
} else if (context.provider instanceof WebdriverBrowserProvider) {
|
|
1005
989
|
const values = userValues;
|
|
1006
990
|
if (!values.length) {
|
|
@@ -1225,7 +1209,7 @@ async function getBrowserProvider(options, project) {
|
|
|
1225
1209
|
}
|
|
1226
1210
|
let customProviderModule;
|
|
1227
1211
|
try {
|
|
1228
|
-
customProviderModule = await project.
|
|
1212
|
+
customProviderModule = await project.import(
|
|
1229
1213
|
options.provider
|
|
1230
1214
|
);
|
|
1231
1215
|
} catch (error) {
|
|
@@ -1779,7 +1763,7 @@ var BrowserPlugin = (browserServer, base = "/") => {
|
|
|
1779
1763
|
{
|
|
1780
1764
|
name: "vitest:browser:in-source-tests",
|
|
1781
1765
|
transform(code, id) {
|
|
1782
|
-
if (!project.
|
|
1766
|
+
if (!project.isCachedTestFile(id) || !code.includes("import.meta.vitest")) {
|
|
1783
1767
|
return;
|
|
1784
1768
|
}
|
|
1785
1769
|
const s = new MagicString(code, { filename: cleanUrl(id) });
|
|
@@ -2493,13 +2477,13 @@ class BrowserServer {
|
|
|
2493
2477
|
const browser = this.project.config.browser.name;
|
|
2494
2478
|
if (!browser) {
|
|
2495
2479
|
throw new Error(
|
|
2496
|
-
`[${this.project.
|
|
2480
|
+
`[${this.project.name}] Browser name is required. Please, set \`test.browser.name\` option manually.`
|
|
2497
2481
|
);
|
|
2498
2482
|
}
|
|
2499
2483
|
const supportedBrowsers = this.provider.getSupportedBrowsers();
|
|
2500
2484
|
if (supportedBrowsers.length && !supportedBrowsers.includes(browser)) {
|
|
2501
2485
|
throw new Error(
|
|
2502
|
-
`[${this.project.
|
|
2486
|
+
`[${this.project.name}] Browser "${browser}" is not supported by the browser provider "${this.provider.name}". Supported browsers: ${supportedBrowsers.join(", ")}.`
|
|
2503
2487
|
);
|
|
2504
2488
|
}
|
|
2505
2489
|
const providerOptions = this.project.config.browser.providerOptions;
|
|
@@ -2578,7 +2562,7 @@ function createBrowserPool(ctx) {
|
|
|
2578
2562
|
const origin = resolvedUrls?.local[0] ?? resolvedUrls?.network[0];
|
|
2579
2563
|
if (!origin) {
|
|
2580
2564
|
throw new Error(
|
|
2581
|
-
`Can't find browser origin URL for project "${project.
|
|
2565
|
+
`Can't find browser origin URL for project "${project.name}" when running tests for files "${files.join('", "')}"`
|
|
2582
2566
|
);
|
|
2583
2567
|
}
|
|
2584
2568
|
async function setBreakpoint(contextId, file) {
|
|
@@ -2603,7 +2587,7 @@ function createBrowserPool(ctx) {
|
|
|
2603
2587
|
}
|
|
2604
2588
|
debug?.(
|
|
2605
2589
|
`[%s] Running %s tests in %s chunks (%s threads)`,
|
|
2606
|
-
project.
|
|
2590
|
+
project.name || "core",
|
|
2607
2591
|
files.length,
|
|
2608
2592
|
chunks.length,
|
|
2609
2593
|
threadsCount
|
package/dist/locators/index.d.ts
CHANGED
package/dist/locators/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { page, server } from '@vitest/browser/context';
|
|
2
2
|
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector } from '../public-utils-D6S2-5kI.js';
|
|
3
|
-
import { s as selectorEngine, L as Locator } from '../index-
|
|
3
|
+
import { s as selectorEngine, L as Locator } from '../index-CMAn5ZST.js';
|
|
4
4
|
import 'vitest/utils';
|
|
5
5
|
|
|
6
6
|
page.extend({
|
package/dist/locators/preview.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { userEvent } from '@
|
|
2
|
-
import { page, server } from '@vitest/browser/context';
|
|
1
|
+
import { page, server, userEvent } from '@vitest/browser/context';
|
|
3
2
|
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector, h as getElementError } from '../public-utils-D6S2-5kI.js';
|
|
4
|
-
import { s as selectorEngine, L as Locator, c as convertElementToCssSelector
|
|
3
|
+
import { s as selectorEngine, L as Locator, c as convertElementToCssSelector } from '../index-CMAn5ZST.js';
|
|
5
4
|
import 'vitest/utils';
|
|
6
5
|
|
|
7
6
|
page.extend({
|
|
@@ -47,53 +46,31 @@ class PreviewLocator extends Locator {
|
|
|
47
46
|
return selectors.join(", ");
|
|
48
47
|
}
|
|
49
48
|
click() {
|
|
50
|
-
return
|
|
49
|
+
return userEvent.click(this.element());
|
|
51
50
|
}
|
|
52
51
|
dblClick() {
|
|
53
|
-
return
|
|
52
|
+
return userEvent.dblClick(this.element());
|
|
54
53
|
}
|
|
55
54
|
tripleClick() {
|
|
56
|
-
return
|
|
55
|
+
return userEvent.tripleClick(this.element());
|
|
57
56
|
}
|
|
58
57
|
hover() {
|
|
59
|
-
return
|
|
58
|
+
return userEvent.hover(this.element());
|
|
60
59
|
}
|
|
61
60
|
unhover() {
|
|
62
|
-
return
|
|
61
|
+
return userEvent.unhover(this.element());
|
|
63
62
|
}
|
|
64
63
|
async fill(text) {
|
|
65
|
-
|
|
66
|
-
return ensureAwaited(() => userEvent.type(this.element(), text));
|
|
64
|
+
return userEvent.fill(this.element(), text);
|
|
67
65
|
}
|
|
68
66
|
async upload(file) {
|
|
69
|
-
|
|
70
|
-
if (typeof file2 !== "string") {
|
|
71
|
-
return file2;
|
|
72
|
-
}
|
|
73
|
-
const { content: base64, basename, mime } = await this.triggerCommand("__vitest_fileInfo", file2, "base64");
|
|
74
|
-
const fileInstance = fetch(`data:${mime};base64,${base64}`).then((r) => r.blob()).then((blob) => new File([blob], basename, { type: mime }));
|
|
75
|
-
return fileInstance;
|
|
76
|
-
});
|
|
77
|
-
const uploadFiles = await Promise.all(uploadPromise);
|
|
78
|
-
return ensureAwaited(() => userEvent.upload(this.element(), uploadFiles));
|
|
67
|
+
return userEvent.upload(this.element(), file);
|
|
79
68
|
}
|
|
80
69
|
selectOptions(options_) {
|
|
81
|
-
|
|
82
|
-
if (typeof option !== "string" && "element" in option) {
|
|
83
|
-
return option.element();
|
|
84
|
-
}
|
|
85
|
-
return option;
|
|
86
|
-
});
|
|
87
|
-
return ensureAwaited(() => userEvent.selectOptions(this.element(), options));
|
|
88
|
-
}
|
|
89
|
-
async dropTo() {
|
|
90
|
-
throw new Error('The "preview" provider doesn\'t support `dropTo` method.');
|
|
70
|
+
return userEvent.selectOptions(this.element(), options_);
|
|
91
71
|
}
|
|
92
72
|
clear() {
|
|
93
|
-
return
|
|
94
|
-
}
|
|
95
|
-
async screenshot() {
|
|
96
|
-
throw new Error('The "preview" provider doesn\'t support `screenshot` method.');
|
|
73
|
+
return userEvent.clear(this.element());
|
|
97
74
|
}
|
|
98
75
|
locator(selector) {
|
|
99
76
|
return new PreviewLocator(`${this._pwSelector} >> ${selector}`, this._container);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { page, server } from '@vitest/browser/context';
|
|
2
2
|
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector, h as getElementError } from '../public-utils-D6S2-5kI.js';
|
|
3
|
-
import { s as selectorEngine, L as Locator, c as convertElementToCssSelector } from '../index-
|
|
3
|
+
import { s as selectorEngine, L as Locator, c as convertElementToCssSelector } from '../index-CMAn5ZST.js';
|
|
4
4
|
import 'vitest/utils';
|
|
5
5
|
|
|
6
6
|
page.extend({
|
package/dist/providers.js
CHANGED
|
@@ -59,8 +59,9 @@ class PlaywrightBrowserProvider {
|
|
|
59
59
|
return this.contexts.get(contextId);
|
|
60
60
|
}
|
|
61
61
|
const browser = await this.openBrowser();
|
|
62
|
+
const { actionTimeout, ...contextOptions } = this.options?.context ?? {};
|
|
62
63
|
const options = {
|
|
63
|
-
...
|
|
64
|
+
...contextOptions,
|
|
64
65
|
ignoreHTTPSErrors: true,
|
|
65
66
|
serviceWorkers: "allow"
|
|
66
67
|
};
|
|
@@ -68,6 +69,9 @@ class PlaywrightBrowserProvider {
|
|
|
68
69
|
options.viewport = null;
|
|
69
70
|
}
|
|
70
71
|
const context = await browser.newContext(options);
|
|
72
|
+
if (actionTimeout) {
|
|
73
|
+
context.setDefaultTimeout(actionTimeout);
|
|
74
|
+
}
|
|
71
75
|
this.contexts.set(contextId, context);
|
|
72
76
|
return context;
|
|
73
77
|
}
|
|
@@ -130,7 +134,7 @@ class PlaywrightBrowserProvider {
|
|
|
130
134
|
async openPage(contextId, url, beforeNavigate) {
|
|
131
135
|
const browserPage = await this.openBrowserPage(contextId);
|
|
132
136
|
await beforeNavigate?.();
|
|
133
|
-
await browserPage.goto(url);
|
|
137
|
+
await browserPage.goto(url, { timeout: 0 });
|
|
134
138
|
}
|
|
135
139
|
async getCDPSession(contextId) {
|
|
136
140
|
const page = this.getPage(contextId);
|
package/matchers.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Locator } from '@vitest/browser/context'
|
|
2
2
|
import type jsdomMatchers from './jest-dom.js'
|
|
3
|
-
import type { Assertion } from 'vitest'
|
|
3
|
+
import type { Assertion, ExpectPollOptions } from 'vitest'
|
|
4
4
|
|
|
5
5
|
declare module 'vitest' {
|
|
6
6
|
interface JestAssertion<T = any> extends jsdomMatchers.default.TestingLibraryMatchers<void, T> {}
|
|
7
|
+
interface AsymmetricMatchersContaining extends jsdomMatchers.default.TestingLibraryMatchers<void, void> {}
|
|
7
8
|
|
|
8
9
|
type Promisify<O> = {
|
|
9
10
|
[K in keyof O]: O[K] extends (...args: infer A) => infer R
|
|
@@ -16,6 +17,10 @@ declare module 'vitest' {
|
|
|
16
17
|
type PromisifyDomAssertion<T> = Promisify<Assertion<T>>
|
|
17
18
|
|
|
18
19
|
interface ExpectStatic {
|
|
20
|
+
/**
|
|
21
|
+
* `expect.element(locator)` is a shorthand for `expect.poll(() => locator.element())`.
|
|
22
|
+
* You can set default timeout via `expect.poll.timeout` config.
|
|
23
|
+
*/
|
|
19
24
|
element: <T extends Element | Locator>(element: T, options?: ExpectPollOptions) => PromisifyDomAssertion<Awaited<Element | null>>
|
|
20
25
|
}
|
|
21
26
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0-beta.2",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -32,13 +32,16 @@
|
|
|
32
32
|
"default": "./dist/client.js"
|
|
33
33
|
},
|
|
34
34
|
"./matchers": {
|
|
35
|
-
"types": "./matchers.d.ts"
|
|
35
|
+
"types": "./matchers.d.ts",
|
|
36
|
+
"default": "./dummy.js"
|
|
36
37
|
},
|
|
37
38
|
"./providers/webdriverio": {
|
|
38
|
-
"types": "./providers/webdriverio.d.ts"
|
|
39
|
+
"types": "./providers/webdriverio.d.ts",
|
|
40
|
+
"default": "./dummy.js"
|
|
39
41
|
},
|
|
40
42
|
"./providers/playwright": {
|
|
41
|
-
"types": "./providers/playwright.d.ts"
|
|
43
|
+
"types": "./providers/playwright.d.ts",
|
|
44
|
+
"default": "./dummy.js"
|
|
42
45
|
},
|
|
43
46
|
"./locator": {
|
|
44
47
|
"types": "./dist/locators/index.d.ts",
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
"peerDependencies": {
|
|
63
66
|
"playwright": "*",
|
|
64
67
|
"webdriverio": "*",
|
|
65
|
-
"vitest": "
|
|
68
|
+
"vitest": "3.0.0-beta.2"
|
|
66
69
|
},
|
|
67
70
|
"peerDependenciesMeta": {
|
|
68
71
|
"playwright": {
|
|
@@ -78,32 +81,32 @@
|
|
|
78
81
|
"dependencies": {
|
|
79
82
|
"@testing-library/dom": "^10.4.0",
|
|
80
83
|
"@testing-library/user-event": "^14.5.2",
|
|
81
|
-
"magic-string": "^0.30.
|
|
82
|
-
"msw": "^2.6.
|
|
84
|
+
"magic-string": "^0.30.14",
|
|
85
|
+
"msw": "^2.6.8",
|
|
83
86
|
"sirv": "^3.0.0",
|
|
84
87
|
"tinyrainbow": "^1.2.0",
|
|
85
88
|
"ws": "^8.18.0",
|
|
86
|
-
"@vitest/mocker": "
|
|
87
|
-
"@vitest/utils": "
|
|
89
|
+
"@vitest/mocker": "3.0.0-beta.2",
|
|
90
|
+
"@vitest/utils": "3.0.0-beta.2"
|
|
88
91
|
},
|
|
89
92
|
"devDependencies": {
|
|
90
93
|
"@testing-library/jest-dom": "^6.6.3",
|
|
91
94
|
"@types/ws": "^8.5.13",
|
|
92
95
|
"@wdio/protocols": "^8.40.3",
|
|
93
96
|
"birpc": "0.2.19",
|
|
94
|
-
"flatted": "^3.3.
|
|
97
|
+
"flatted": "^3.3.2",
|
|
95
98
|
"ivya": "^1.1.1",
|
|
96
99
|
"mime": "^4.0.4",
|
|
97
100
|
"pathe": "^1.1.2",
|
|
98
101
|
"periscopic": "^4.0.2",
|
|
99
|
-
"playwright": "^1.
|
|
100
|
-
"playwright-core": "^1.
|
|
101
|
-
"safaridriver": "^0.
|
|
102
|
+
"playwright": "^1.49.0",
|
|
103
|
+
"playwright-core": "^1.49.0",
|
|
104
|
+
"safaridriver": "^1.0.0",
|
|
102
105
|
"webdriverio": "^8.40.6",
|
|
103
|
-
"@vitest/
|
|
104
|
-
"vitest": "
|
|
105
|
-
"@vitest/
|
|
106
|
-
"
|
|
106
|
+
"@vitest/ui": "3.0.0-beta.2",
|
|
107
|
+
"@vitest/ws-client": "3.0.0-beta.2",
|
|
108
|
+
"@vitest/runner": "3.0.0-beta.2",
|
|
109
|
+
"vitest": "3.0.0-beta.2"
|
|
107
110
|
},
|
|
108
111
|
"scripts": {
|
|
109
112
|
"build": "rimraf dist && pnpm build:node && pnpm build:client",
|
|
@@ -16,7 +16,13 @@ declare module 'vitest/node' {
|
|
|
16
16
|
context?: Omit<
|
|
17
17
|
BrowserContextOptions,
|
|
18
18
|
'ignoreHTTPSErrors' | 'serviceWorkers'
|
|
19
|
-
>
|
|
19
|
+
> & {
|
|
20
|
+
/**
|
|
21
|
+
* The maximum time in milliseconds to wait for `userEvent` action to complete.
|
|
22
|
+
* @default 0 (no timeout)
|
|
23
|
+
*/
|
|
24
|
+
actionTimeout?: number
|
|
25
|
+
}
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
export interface BrowserCommandContext {
|
|
@@ -27,13 +33,13 @@ declare module 'vitest/node' {
|
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
type PWHoverOptions = Parameters<Page['hover']>[1]
|
|
31
|
-
type PWClickOptions = Parameters<Page['click']>[1]
|
|
32
|
-
type PWDoubleClickOptions = Parameters<Page['dblclick']>[1]
|
|
33
|
-
type PWFillOptions = Parameters<Page['fill']>[2]
|
|
34
|
-
type PWScreenshotOptions = Parameters<Page['screenshot']>[0]
|
|
35
|
-
type PWSelectOptions = Parameters<Page['selectOption']>[2]
|
|
36
|
-
type PWDragAndDropOptions = Parameters<Page['dragAndDrop']>[2]
|
|
36
|
+
type PWHoverOptions = NonNullable<Parameters<Page['hover']>[1]>
|
|
37
|
+
type PWClickOptions = NonNullable<Parameters<Page['click']>[1]>
|
|
38
|
+
type PWDoubleClickOptions = NonNullable<Parameters<Page['dblclick']>[1]>
|
|
39
|
+
type PWFillOptions = NonNullable<Parameters<Page['fill']>[2]>
|
|
40
|
+
type PWScreenshotOptions = NonNullable<Parameters<Page['screenshot']>[0]>
|
|
41
|
+
type PWSelectOptions = NonNullable<Parameters<Page['selectOption']>[2]>
|
|
42
|
+
type PWDragAndDropOptions = NonNullable<Parameters<Page['dragAndDrop']>[2]>
|
|
37
43
|
|
|
38
44
|
declare module '@vitest/browser/context' {
|
|
39
45
|
export interface UserEventHoverOptions extends PWHoverOptions {}
|