@types/k6 1.3.1 → 1.5.0
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.
- k6/README.md +1 -1
- k6/browser/index.d.ts +209 -0
- k6/package.json +2 -2
k6/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for k6 (https://grafana.com/docs/k6/lates
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated: Tue,
|
|
11
|
+
* Last updated: Tue, 06 Jan 2026 15:02:33 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
k6/browser/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Represents event-specific properties. Refer to the events documentation for
|
|
3
5
|
* the lists of initial properties:
|
|
@@ -12,6 +14,7 @@
|
|
|
12
14
|
export type EvaluationArgument = object;
|
|
13
15
|
|
|
14
16
|
export type PageFunction<Arg, R> = string | ((arg: Unboxed<Arg>) => R);
|
|
17
|
+
export type PageFunctionOn<On, Arg2, R> = string | ((on: On, arg2: Unboxed<Arg2>) => R);
|
|
15
18
|
|
|
16
19
|
export type Unboxed<Arg> = Arg extends [infer A0, infer A1] ? [Unboxed<A0>, Unboxed<A1>]
|
|
17
20
|
: Arg extends [infer A0, infer A1, infer A2] ? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>]
|
|
@@ -2997,6 +3000,35 @@ export interface Locator {
|
|
|
2997
3000
|
*/
|
|
2998
3001
|
dblclick(options?: MouseMoveOptions & MouseMultiClickOptions): Promise<void>;
|
|
2999
3002
|
|
|
3003
|
+
/**
|
|
3004
|
+
* Evaluates the page function and returns its return value.
|
|
3005
|
+
* This method passes this locator's matching element as the first argument to the page function.
|
|
3006
|
+
*
|
|
3007
|
+
* @param pageFunction Function to be evaluated in the page context.
|
|
3008
|
+
* @param arg Optional argument to pass to `pageFunction`.
|
|
3009
|
+
* @returns Return value of `pageFunction`.
|
|
3010
|
+
*/
|
|
3011
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
3012
|
+
evaluate<R, E extends SVGElement | HTMLElement, Arg>(
|
|
3013
|
+
pageFunction: PageFunctionOn<E, Arg, R>,
|
|
3014
|
+
arg?: Arg,
|
|
3015
|
+
): Promise<R>;
|
|
3016
|
+
|
|
3017
|
+
/**
|
|
3018
|
+
* Evaluates the page function and returns its return value as a [JSHandle].
|
|
3019
|
+
* This method passes this locator's matching element as the first argument to the page function.
|
|
3020
|
+
* Unlike `evaluate`, `evaluateHandle` returns the value as a `JSHandle`
|
|
3021
|
+
*
|
|
3022
|
+
* @param pageFunction Function to be evaluated in the page context.
|
|
3023
|
+
* @param arg Optional argument to pass to `pageFunction`.
|
|
3024
|
+
* @returns JSHandle of the return value of `pageFunction`.
|
|
3025
|
+
*/
|
|
3026
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
3027
|
+
evaluateHandle<R, E extends SVGElement | HTMLElement, Arg>(
|
|
3028
|
+
pageFunction: PageFunctionOn<E, Arg, R>,
|
|
3029
|
+
arg?: Arg,
|
|
3030
|
+
): Promise<JSHandle<R>>;
|
|
3031
|
+
|
|
3000
3032
|
/**
|
|
3001
3033
|
* Use this method to select an `input type="checkbox"`.
|
|
3002
3034
|
* @param options Options to use.
|
|
@@ -3199,6 +3231,29 @@ export interface Locator {
|
|
|
3199
3231
|
*/
|
|
3200
3232
|
press(key: string, options?: KeyboardPressOptions): Promise<void>;
|
|
3201
3233
|
|
|
3234
|
+
/**
|
|
3235
|
+
* Focuses the element and then sends a `keydown`, `keypress`/`input`, and
|
|
3236
|
+
* `keyup` event for each character in the text.
|
|
3237
|
+
*
|
|
3238
|
+
* This method is useful for simulating real user typing behavior when the page
|
|
3239
|
+
* has special keyboard event handling, such as input validation or autocomplete.
|
|
3240
|
+
* For simple text input without special keyboard handling, use {@link fill | fill()}
|
|
3241
|
+
* instead as it's faster and more reliable.
|
|
3242
|
+
*
|
|
3243
|
+
* @example
|
|
3244
|
+
* ```js
|
|
3245
|
+
* // Type text instantly
|
|
3246
|
+
* await locator.pressSequentially('Hello World');
|
|
3247
|
+
*
|
|
3248
|
+
* // Type text with delay between keypresses (like a real user)
|
|
3249
|
+
* await locator.pressSequentially('Hello World', { delay: 100 });
|
|
3250
|
+
* ```
|
|
3251
|
+
*
|
|
3252
|
+
* @param text Text to type into the focused element character by character.
|
|
3253
|
+
* @param options Typing options.
|
|
3254
|
+
*/
|
|
3255
|
+
pressSequentially(text: string, options?: KeyboardPressOptions): Promise<void>;
|
|
3256
|
+
|
|
3202
3257
|
/**
|
|
3203
3258
|
* Type a text into the input field.
|
|
3204
3259
|
* @param text Text to type into the input field.
|
|
@@ -5424,6 +5479,16 @@ export interface Page {
|
|
|
5424
5479
|
},
|
|
5425
5480
|
): Promise<void>;
|
|
5426
5481
|
|
|
5482
|
+
/**
|
|
5483
|
+
* Removes all existing routes for the `url`.
|
|
5484
|
+
*/
|
|
5485
|
+
unroute(url: string | RegExp): Promise<void>;
|
|
5486
|
+
|
|
5487
|
+
/**
|
|
5488
|
+
* Removes all routes created with page.route().
|
|
5489
|
+
*/
|
|
5490
|
+
unrouteAll(): Promise<void>;
|
|
5491
|
+
|
|
5427
5492
|
/**
|
|
5428
5493
|
* Returns the page's URL.
|
|
5429
5494
|
*/
|
|
@@ -5621,6 +5686,150 @@ export interface Page {
|
|
|
5621
5686
|
},
|
|
5622
5687
|
): Promise<Response | null>;
|
|
5623
5688
|
|
|
5689
|
+
/**
|
|
5690
|
+
* Waits for the page to match against the URL for a Request object
|
|
5691
|
+
*
|
|
5692
|
+
* @example
|
|
5693
|
+
* ```js
|
|
5694
|
+
* const requestPromise = page.waitForRequest('https://example.com/resource');
|
|
5695
|
+
* await page.goto('https://example.com/resource');
|
|
5696
|
+
* const request = await requestPromise;
|
|
5697
|
+
* ```
|
|
5698
|
+
*
|
|
5699
|
+
* @param request Request URL string or regex to match against Request object.
|
|
5700
|
+
* @param options Options to use.
|
|
5701
|
+
*/
|
|
5702
|
+
waitForRequest(
|
|
5703
|
+
request: string | RegExp,
|
|
5704
|
+
options?: {
|
|
5705
|
+
/**
|
|
5706
|
+
* Maximum operation time in milliseconds. Defaults to `30` seconds.
|
|
5707
|
+
* The default value can be changed via the
|
|
5708
|
+
* browserContext.setDefaultNavigationTimeout(timeout),
|
|
5709
|
+
* browserContext.setDefaultTimeout(timeout),
|
|
5710
|
+
* page.setDefaultNavigationTimeout(timeout) or
|
|
5711
|
+
* page.setDefaultTimeout(timeout) methods.
|
|
5712
|
+
*
|
|
5713
|
+
* Setting the value to `0` will disable the timeout.
|
|
5714
|
+
*/
|
|
5715
|
+
timeout?: number;
|
|
5716
|
+
},
|
|
5717
|
+
): Promise<Request | null>;
|
|
5718
|
+
|
|
5719
|
+
/**
|
|
5720
|
+
* Waits for the specified event to be emitted.
|
|
5721
|
+
*
|
|
5722
|
+
* This method blocks until the event is captured or the timeout is reached.
|
|
5723
|
+
* Supported event types are `console`, `request`, or `response`.
|
|
5724
|
+
*
|
|
5725
|
+
* @example
|
|
5726
|
+
* ```js
|
|
5727
|
+
* // Wait for a console message containing 'hello'
|
|
5728
|
+
* const msgPromise = page.waitForEvent('console', msg => msg.text().includes('hello'));
|
|
5729
|
+
* await page.evaluate(() => console.log('hello world'));
|
|
5730
|
+
* const msg = await msgPromise;
|
|
5731
|
+
* ```
|
|
5732
|
+
*
|
|
5733
|
+
* @param event Event name to wait for: `'console'`.
|
|
5734
|
+
* @param optionsOrPredicate Either a predicate function or an options object.
|
|
5735
|
+
*/
|
|
5736
|
+
waitForEvent(
|
|
5737
|
+
event: "console",
|
|
5738
|
+
optionsOrPredicate?:
|
|
5739
|
+
| ((msg: ConsoleMessage) => boolean)
|
|
5740
|
+
| {
|
|
5741
|
+
/**
|
|
5742
|
+
* Predicate function that returns `true` when the expected event is received.
|
|
5743
|
+
*/
|
|
5744
|
+
predicate?: (msg: ConsoleMessage) => boolean;
|
|
5745
|
+
/**
|
|
5746
|
+
* Maximum time to wait in milliseconds. Defaults to `30` seconds.
|
|
5747
|
+
* The default value can be changed via the
|
|
5748
|
+
* browserContext.setDefaultTimeout(timeout) or
|
|
5749
|
+
* page.setDefaultTimeout(timeout) methods.
|
|
5750
|
+
*
|
|
5751
|
+
* Setting the value to `0` will disable the timeout.
|
|
5752
|
+
*/
|
|
5753
|
+
timeout?: number;
|
|
5754
|
+
},
|
|
5755
|
+
): Promise<ConsoleMessage>;
|
|
5756
|
+
|
|
5757
|
+
/**
|
|
5758
|
+
* Waits for the specified event to be emitted.
|
|
5759
|
+
*
|
|
5760
|
+
* This method blocks until the event is captured or the timeout is reached.
|
|
5761
|
+
* It can wait for any page event such as `console`, `request`, or `response`.
|
|
5762
|
+
*
|
|
5763
|
+
* @example
|
|
5764
|
+
* ```js
|
|
5765
|
+
* // Wait for a request to a specific URL
|
|
5766
|
+
* const reqPromise = page.waitForEvent('request', req => req.url().includes('/api'));
|
|
5767
|
+
* await page.click('button');
|
|
5768
|
+
* const req = await reqPromise;
|
|
5769
|
+
* ```
|
|
5770
|
+
*
|
|
5771
|
+
* @param event Event name to wait for: `'request'`.
|
|
5772
|
+
* @param optionsOrPredicate Either a predicate function or an options object.
|
|
5773
|
+
*/
|
|
5774
|
+
waitForEvent(
|
|
5775
|
+
event: "request",
|
|
5776
|
+
optionsOrPredicate?:
|
|
5777
|
+
| ((req: Request) => boolean)
|
|
5778
|
+
| {
|
|
5779
|
+
/**
|
|
5780
|
+
* Predicate function that returns `true` when the expected event is received.
|
|
5781
|
+
*/
|
|
5782
|
+
predicate?: (req: Request) => boolean;
|
|
5783
|
+
/**
|
|
5784
|
+
* Maximum time to wait in milliseconds. Defaults to `30` seconds.
|
|
5785
|
+
* The default value can be changed via the
|
|
5786
|
+
* browserContext.setDefaultTimeout(timeout) or
|
|
5787
|
+
* page.setDefaultTimeout(timeout) methods.
|
|
5788
|
+
*
|
|
5789
|
+
* Setting the value to `0` will disable the timeout.
|
|
5790
|
+
*/
|
|
5791
|
+
timeout?: number;
|
|
5792
|
+
},
|
|
5793
|
+
): Promise<Request>;
|
|
5794
|
+
|
|
5795
|
+
/**
|
|
5796
|
+
* Waits for the specified event to be emitted.
|
|
5797
|
+
*
|
|
5798
|
+
* This method blocks until the event is captured or the timeout is reached.
|
|
5799
|
+
* It can wait for any page event such as `console`, `request`, or `response`.
|
|
5800
|
+
*
|
|
5801
|
+
* @example
|
|
5802
|
+
* ```js
|
|
5803
|
+
* // Wait for a response from a specific URL
|
|
5804
|
+
* const resPromise = page.waitForEvent('response', res => res.url().includes('/api'));
|
|
5805
|
+
* await page.click('button');
|
|
5806
|
+
* const res = await resPromise;
|
|
5807
|
+
* ```
|
|
5808
|
+
*
|
|
5809
|
+
* @param event Event name to wait for: `'response'`.
|
|
5810
|
+
* @param optionsOrPredicate Either a predicate function or an options object.
|
|
5811
|
+
*/
|
|
5812
|
+
waitForEvent(
|
|
5813
|
+
event: "response",
|
|
5814
|
+
optionsOrPredicate?:
|
|
5815
|
+
| ((res: Response) => boolean)
|
|
5816
|
+
| {
|
|
5817
|
+
/**
|
|
5818
|
+
* Predicate function that returns `true` when the expected event is received.
|
|
5819
|
+
*/
|
|
5820
|
+
predicate?: (res: Response) => boolean;
|
|
5821
|
+
/**
|
|
5822
|
+
* Maximum time to wait in milliseconds. Defaults to `30` seconds.
|
|
5823
|
+
* The default value can be changed via the
|
|
5824
|
+
* browserContext.setDefaultTimeout(timeout) or
|
|
5825
|
+
* page.setDefaultTimeout(timeout) methods.
|
|
5826
|
+
*
|
|
5827
|
+
* Setting the value to `0` will disable the timeout.
|
|
5828
|
+
*/
|
|
5829
|
+
timeout?: number;
|
|
5830
|
+
},
|
|
5831
|
+
): Promise<Response>;
|
|
5832
|
+
|
|
5624
5833
|
/**
|
|
5625
5834
|
* **NOTE** Use web assertions that assert visibility or a locator-based
|
|
5626
5835
|
* locator.waitFor([options]) instead.
|
k6/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/k6",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "TypeScript definitions for k6",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6",
|
|
6
6
|
"license": "MIT",
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"scripts": {},
|
|
75
75
|
"dependencies": {},
|
|
76
76
|
"peerDependencies": {},
|
|
77
|
-
"typesPublisherContentHash": "
|
|
77
|
+
"typesPublisherContentHash": "a6dd0fd28d0c1034db421495569cea7137705632506c7da47654859755ccd052",
|
|
78
78
|
"typeScriptVersion": "5.2"
|
|
79
79
|
}
|