@types/k6 0.49.3 → 0.50.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/experimental/browser.d.ts +131 -0
- k6/experimental/timers.d.ts +3 -3
- k6/experimental/webcrypto.d.ts +18 -5
- k6/index.d.ts +1 -0
- k6/options.d.ts +10 -0
- k6/package.json +2 -2
- k6/timers.d.ts +47 -0
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:
|
|
11
|
+
* Last updated: Mon, 25 Mar 2024 14:35:33 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
k6/experimental/browser.d.ts
CHANGED
|
@@ -115,6 +115,23 @@ export interface EventSequenceOptions {
|
|
|
115
115
|
delay?: number;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
export interface File {
|
|
119
|
+
/**
|
|
120
|
+
* File name
|
|
121
|
+
*/
|
|
122
|
+
name: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* File type
|
|
126
|
+
*/
|
|
127
|
+
mimeType: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* File content
|
|
131
|
+
*/
|
|
132
|
+
buffer: ArrayBuffer;
|
|
133
|
+
}
|
|
134
|
+
|
|
118
135
|
export type ElementHandleOptions = {
|
|
119
136
|
/**
|
|
120
137
|
* Setting this to `true` will bypass the actionability checks (visible,
|
|
@@ -637,6 +654,33 @@ export interface Browser {
|
|
|
637
654
|
* separate pages, cache, and cookies.
|
|
638
655
|
*/
|
|
639
656
|
export interface BrowserContext {
|
|
657
|
+
/**
|
|
658
|
+
* Adds a script which will be evaluated in one of the following scenarios:
|
|
659
|
+
* - Whenever a page is created in the browser context or is navigated.
|
|
660
|
+
* - Whenever a child frame is attached or navigated in any page in the
|
|
661
|
+
* browser context. In this case, the script is evaluated in the context
|
|
662
|
+
* of the newly attached frame.
|
|
663
|
+
*
|
|
664
|
+
* The script is evaluated after the document is created but before any of
|
|
665
|
+
* its scripts were run. This is useful to amend the JavaScript environment,
|
|
666
|
+
* e.g. to override `Math.random`.
|
|
667
|
+
*
|
|
668
|
+
* **Usage**
|
|
669
|
+
*
|
|
670
|
+
* An example of overriding `Math.random` before the page loads:
|
|
671
|
+
*
|
|
672
|
+
* ```js
|
|
673
|
+
* const browserContext = browser.newContext();
|
|
674
|
+
* browserContext.addInitScript("Math.random = function(){return 0}");
|
|
675
|
+
*
|
|
676
|
+
* const page = browserContext.newPage();
|
|
677
|
+
* await page.goto(url);
|
|
678
|
+
* ```
|
|
679
|
+
*
|
|
680
|
+
* @param script Script to be evaluated in all pages in the browser context.
|
|
681
|
+
*/
|
|
682
|
+
addInitScript(script: string | { content?: string }): void;
|
|
683
|
+
|
|
640
684
|
/**
|
|
641
685
|
* Returns the `Browser` instance that this `BrowserContext` belongs to.
|
|
642
686
|
*/
|
|
@@ -1131,6 +1175,33 @@ export interface ElementHandle extends JSHandle {
|
|
|
1131
1175
|
*/
|
|
1132
1176
|
selectText(options?: ElementHandleOptions): void;
|
|
1133
1177
|
|
|
1178
|
+
/**
|
|
1179
|
+
* Sets the file input element's value to the specified files.
|
|
1180
|
+
*
|
|
1181
|
+
* To work with local files on the file system, use the experimental
|
|
1182
|
+
* fs module to load and read the file contents.
|
|
1183
|
+
*
|
|
1184
|
+
* The {@link ElementHandle | element handle} must be an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
1185
|
+
* @param files
|
|
1186
|
+
* @param options
|
|
1187
|
+
*/
|
|
1188
|
+
setInputFiles(files: File | File[], options?: {
|
|
1189
|
+
/**
|
|
1190
|
+
* Maximum time in milliseconds. Pass 0 to disable the timeout. Default
|
|
1191
|
+
* is overridden by the setDefaultTimeout option on {@link BrowserContext} or
|
|
1192
|
+
* {@link Page}.
|
|
1193
|
+
* @default 30000
|
|
1194
|
+
*/
|
|
1195
|
+
timeout?: number;
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* If set to `true` and a navigation occurs from performing this action, it
|
|
1199
|
+
* does not wait for it to complete.
|
|
1200
|
+
* @default false
|
|
1201
|
+
*/
|
|
1202
|
+
noWaitAfter?: boolean;
|
|
1203
|
+
}): void;
|
|
1204
|
+
|
|
1134
1205
|
/**
|
|
1135
1206
|
* Scrolls element into view if needed, and then uses `page.tapscreen` to tap in the center of the element
|
|
1136
1207
|
* or at the specified position.
|
|
@@ -1482,6 +1553,36 @@ export interface Frame {
|
|
|
1482
1553
|
*/
|
|
1483
1554
|
isVisible(selector: string, options?: StrictnessOptions): boolean;
|
|
1484
1555
|
|
|
1556
|
+
/**
|
|
1557
|
+
* Sets the file input element's value to the specified files.
|
|
1558
|
+
*
|
|
1559
|
+
* To work with local files on the file system, use the experimental
|
|
1560
|
+
* fs module to load and read the file contents.
|
|
1561
|
+
*
|
|
1562
|
+
* This method expects a `selector` to point to an
|
|
1563
|
+
* [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
1564
|
+
* @param selector A selector to search for an element. If there are multiple
|
|
1565
|
+
* elements satisfying the selector, the first will be used.
|
|
1566
|
+
* @param files
|
|
1567
|
+
* @param options
|
|
1568
|
+
*/
|
|
1569
|
+
setInputFiles(selector: string, files: File | File[], options?: {
|
|
1570
|
+
/**
|
|
1571
|
+
* Maximum time in milliseconds. Pass 0 to disable the timeout. Default
|
|
1572
|
+
* is overridden by the setDefaultTimeout option on {@link BrowserContext} or
|
|
1573
|
+
* {@link Page}
|
|
1574
|
+
* @default 30000
|
|
1575
|
+
*/
|
|
1576
|
+
timeout?: number;
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* If set to `true` and a navigation occurs from performing this action, it
|
|
1580
|
+
* will not wait for it to complete.
|
|
1581
|
+
* @default false
|
|
1582
|
+
*/
|
|
1583
|
+
noWaitAfter?: boolean;
|
|
1584
|
+
}): void;
|
|
1585
|
+
|
|
1485
1586
|
/**
|
|
1486
1587
|
* Wait for the given function to return a truthy value.
|
|
1487
1588
|
* @param predicate The function to call and wait for.
|
|
@@ -2917,6 +3018,36 @@ export interface Page {
|
|
|
2917
3018
|
*/
|
|
2918
3019
|
setExtraHTTPHeaders(headers: { [key: string]: string }): void;
|
|
2919
3020
|
|
|
3021
|
+
/**
|
|
3022
|
+
* Sets the file input element's value to the specified files.
|
|
3023
|
+
*
|
|
3024
|
+
* To work with local files on the file system, use the experimental
|
|
3025
|
+
* fs module to load and read the file contents.
|
|
3026
|
+
*
|
|
3027
|
+
* This method expects a `selector` to point to an
|
|
3028
|
+
* [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
3029
|
+
* @param selector A selector to search for an element. If there are multiple
|
|
3030
|
+
* elements satisfying the selector, the first will be used.
|
|
3031
|
+
* @param files
|
|
3032
|
+
* @param options
|
|
3033
|
+
*/
|
|
3034
|
+
setInputFiles(selector: string, files: File | File[], options?: {
|
|
3035
|
+
/**
|
|
3036
|
+
* Maximum time in milliseconds. Pass 0 to disable the timeout. Default
|
|
3037
|
+
* is overridden by the setDefaultTimeout option on {@link BrowserContext} or
|
|
3038
|
+
* {@link Page}
|
|
3039
|
+
* @default 30000
|
|
3040
|
+
*/
|
|
3041
|
+
timeout?: number;
|
|
3042
|
+
|
|
3043
|
+
/**
|
|
3044
|
+
* If set to `true` and a navigation occurs from performing this action, it
|
|
3045
|
+
* will not wait for it to complete.
|
|
3046
|
+
* @default false
|
|
3047
|
+
*/
|
|
3048
|
+
noWaitAfter?: boolean;
|
|
3049
|
+
}): void;
|
|
3050
|
+
|
|
2920
3051
|
/**
|
|
2921
3052
|
* This will update the page's width and height.
|
|
2922
3053
|
*
|
k6/experimental/timers.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Set a timer
|
|
6
|
+
* Set a timer that executes a function once the timer expires.
|
|
7
7
|
*
|
|
8
8
|
* @param functionRef - The function to be executed.
|
|
9
9
|
* @param delay - The delay in milliseconds.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
export function setTimeout(functionRef: (...args: any[]) => void, delay: number, ...args: any[]): TimeoutID;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Cancels a
|
|
16
|
+
* Cancels a timer previously set with setTimeout().
|
|
17
17
|
*
|
|
18
18
|
* @param timeoutID - The timer id to be cancelled.
|
|
19
19
|
*/
|
|
@@ -30,7 +30,7 @@ export function clearTimeout(timeoutID: TimeoutID): void;
|
|
|
30
30
|
export function setInterval(functionRef: (...args: any[]) => void, delay: number, ...args: any[]): IntervalID;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Cancels
|
|
33
|
+
* Cancels an interval previously set with setInterval().
|
|
34
34
|
*
|
|
35
35
|
* @param intervalID - The interval id to be cancelled.
|
|
36
36
|
*/
|
k6/experimental/webcrypto.d.ts
CHANGED
|
@@ -91,14 +91,14 @@ export interface SubtleCrypto {
|
|
|
91
91
|
*
|
|
92
92
|
* To export a key, the key must have `CryptoKey.extractable` set to `true`.
|
|
93
93
|
*
|
|
94
|
-
* @param format the format in which to export the key. Currently, only "raw"
|
|
94
|
+
* @param format the format in which to export the key. Currently, only "raw" and "jwk" are supported.
|
|
95
95
|
* @param key the key to export.
|
|
96
96
|
* @throws {InvalidAccessError} - if the key is not extractable.
|
|
97
97
|
* @throws {NotSupportedError} - if the format is not supported.
|
|
98
98
|
* @throws {TypeError} - when trying to use an invalid format.
|
|
99
99
|
* @returns A promise that resolves with the exported key.
|
|
100
100
|
*/
|
|
101
|
-
exportKey(format: "raw", key: CryptoKey): Promise<ArrayBuffer>;
|
|
101
|
+
exportKey(format: "raw" | "jwk", key: CryptoKey): Promise<ArrayBuffer | JWK>;
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* Use the `generateKey()` method to generate a new key (for symmetric
|
|
@@ -121,7 +121,7 @@ export interface SubtleCrypto {
|
|
|
121
121
|
* It takes as input a key in an external, portable format and gives you
|
|
122
122
|
* a `CryptoKey` object that can be used in the Web Crypto API.
|
|
123
123
|
*
|
|
124
|
-
* @param format the format of the key to import. Currently, only "raw"
|
|
124
|
+
* @param format the format of the key to import. Currently, only "raw" and "jwk" are supported.
|
|
125
125
|
* @param keyData the key data to import.
|
|
126
126
|
* @param algorithm defines the algorithm to use and any extra-parameters.
|
|
127
127
|
* @param extractable indicates whether it will be possible to export the key using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey`.
|
|
@@ -131,8 +131,8 @@ export interface SubtleCrypto {
|
|
|
131
131
|
* @returns A promise that resolves with the imported `CryptoKey`.
|
|
132
132
|
*/
|
|
133
133
|
importKey(
|
|
134
|
-
format: "raw",
|
|
135
|
-
keyData: ArrayBuffer | ArrayBufferView | DataView,
|
|
134
|
+
format: "raw" | "jwk",
|
|
135
|
+
keyData: ArrayBuffer | ArrayBufferView | DataView | JWK,
|
|
136
136
|
algorithm: "AES-CBC" | "AES-CTR" | "AES-GCM" | Algorithm<"AES-CBC" | "AES-CTR" | "AES-GCM"> | HmacImportParams,
|
|
137
137
|
extractable: boolean,
|
|
138
138
|
keyUsages: Array<"encrypt" | "decrypt" | "sign" | "verify">,
|
|
@@ -395,3 +395,16 @@ export type TypedArray =
|
|
|
395
395
|
| Uint16Array
|
|
396
396
|
| Int32Array
|
|
397
397
|
| Uint32Array;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* JSON Web Key Value.
|
|
401
|
+
* JWKs are not supported for now, since webcrypto doesn't support exporting key/pairs
|
|
402
|
+
*/
|
|
403
|
+
export type JWKValue = null | boolean | number | string | string[] | JWK;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Object representable with JSON Web Key.
|
|
407
|
+
*/
|
|
408
|
+
export interface JWK {
|
|
409
|
+
[key: string]: JWKValue;
|
|
410
|
+
}
|
k6/index.d.ts
CHANGED
k6/options.d.ts
CHANGED
|
@@ -47,6 +47,9 @@ export interface Options {
|
|
|
47
47
|
/** Third party collector configuration. */
|
|
48
48
|
ext?: { [name: string]: CollectorOptions };
|
|
49
49
|
|
|
50
|
+
/** Cloud options */
|
|
51
|
+
cloud?: CloudOptions;
|
|
52
|
+
|
|
50
53
|
/** Static hostname mapping. */
|
|
51
54
|
hosts?: { [name: string]: string };
|
|
52
55
|
|
|
@@ -139,6 +142,13 @@ export interface CollectorOptions {
|
|
|
139
142
|
[name: string]: any;
|
|
140
143
|
}
|
|
141
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Options for the cloud.
|
|
147
|
+
*/
|
|
148
|
+
export interface CloudOptions {
|
|
149
|
+
[name: string]: any;
|
|
150
|
+
}
|
|
151
|
+
|
|
142
152
|
/**
|
|
143
153
|
* Test stage.
|
|
144
154
|
*/
|
k6/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/k6",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"description": "TypeScript definitions for k6",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
},
|
|
61
61
|
"scripts": {},
|
|
62
62
|
"dependencies": {},
|
|
63
|
-
"typesPublisherContentHash": "
|
|
63
|
+
"typesPublisherContentHash": "4ce3b8afa738b9a5dc17ab2f6215988fae6db390db3e895f7517086b6d109983",
|
|
64
64
|
"typeScriptVersion": "4.7"
|
|
65
65
|
}
|
k6/timers.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides setInterval, setTimeout and co.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Set a timer that executes a function once the timer expires.
|
|
7
|
+
*
|
|
8
|
+
* @param functionRef - The function to be executed.
|
|
9
|
+
* @param delay - The delay in milliseconds.
|
|
10
|
+
* @param args - The arguments to be passed to the function.
|
|
11
|
+
* @returns The timer id.
|
|
12
|
+
*/
|
|
13
|
+
export function setTimeout(functionRef: (...args: any[]) => void, delay: number, ...args: any[]): TimeoutID;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Cancels a timer previously set with setTimeout().
|
|
17
|
+
*
|
|
18
|
+
* @param timeoutID - The timer id to be cancelled.
|
|
19
|
+
*/
|
|
20
|
+
export function clearTimeout(timeoutID: TimeoutID): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Repeatedly execute a function, with a fixed time delay between each call.
|
|
24
|
+
*
|
|
25
|
+
* @param functionRef - The function to be executed.
|
|
26
|
+
* @param delay - The delay in milliseconds.
|
|
27
|
+
* @param args - The arguments to be passed to the function.
|
|
28
|
+
* @returns The interval id.
|
|
29
|
+
*/
|
|
30
|
+
export function setInterval(functionRef: (...args: any[]) => void, delay: number, ...args: any[]): IntervalID;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Cancels an interval previously set with setInterval().
|
|
34
|
+
*
|
|
35
|
+
* @param intervalID - The interval id to be cancelled.
|
|
36
|
+
*/
|
|
37
|
+
export function clearInterval(intervalID: IntervalID): void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Type alias for a timer id.
|
|
41
|
+
*/
|
|
42
|
+
export type TimeoutID = number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Type alias for a interval id.
|
|
46
|
+
*/
|
|
47
|
+
export type IntervalID = number;
|