@types/k6 0.44.2 → 0.45.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.
@@ -35,310 +35,328 @@ export type EvaluationArgument = object;
35
35
 
36
36
  export type PageFunction<Arg, R> = string | ((arg: Unboxed<Arg>) => R);
37
37
 
38
- export type Unboxed<Arg> =
39
- Arg extends [infer A0, infer A1] ? [Unboxed<A0>, Unboxed<A1>] :
40
- Arg extends [infer A0, infer A1, infer A2] ? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>] :
41
- Arg extends [infer A0, infer A1, infer A2, infer A3] ? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>, Unboxed<A3>] :
42
- Arg extends Array<infer T> ? Array<Unboxed<T>> :
43
- Arg extends object ? { [Key in keyof Arg]: Unboxed<Arg[Key]> } :
44
- Arg;
38
+ export type Unboxed<Arg> = Arg extends [infer A0, infer A1]
39
+ ? [Unboxed<A0>, Unboxed<A1>]
40
+ : Arg extends [infer A0, infer A1, infer A2]
41
+ ? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>]
42
+ : Arg extends [infer A0, infer A1, infer A2, infer A3]
43
+ ? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>, Unboxed<A3>]
44
+ : Arg extends Array<infer T>
45
+ ? Array<Unboxed<T>>
46
+ : Arg extends object
47
+ ? { [Key in keyof Arg]: Unboxed<Arg[Key]> }
48
+ : Arg;
45
49
 
46
50
  export interface SelectOptionsObject {
47
- /**
48
- * Matches by `option.value`.
49
- */
50
- value?: string;
51
-
52
- /**
53
- * Matches by `option.label`.
54
- */
55
- label?: string;
56
-
57
- /**
58
- * Matches by the index.
59
- */
60
- index?: number;
51
+ /**
52
+ * Matches by `option.value`.
53
+ */
54
+ value?: string;
55
+
56
+ /**
57
+ * Matches by `option.label`.
58
+ */
59
+ label?: string;
60
+
61
+ /**
62
+ * Matches by the index.
63
+ */
64
+ index?: number;
61
65
  }
62
66
 
63
- export type ResourceType = "document" | "stylesheet" | "image" | "media" | "font" | "script" | "texttrack" | "xhr" | "fetch" | "eventsource" | "websocket" | "manifest" | "other";
64
- export type MouseButton = "left" | "right" | "middle";
65
- export type KeyboardModifier = "Alt" | "Control" | "Meta" | "Shift";
66
- export type ElementState = "attached" | "detached" | "visible" | "hidden";
67
- export type InputElementState = ElementState | "enabled" | "disabled" | "editable";
68
- export type LifecycleEvent = "load" | "domcontentloaded" | "networkidle";
67
+ export type ResourceType =
68
+ | 'document'
69
+ | 'stylesheet'
70
+ | 'image'
71
+ | 'media'
72
+ | 'font'
73
+ | 'script'
74
+ | 'texttrack'
75
+ | 'xhr'
76
+ | 'fetch'
77
+ | 'eventsource'
78
+ | 'websocket'
79
+ | 'manifest'
80
+ | 'other';
81
+ export type MouseButton = 'left' | 'right' | 'middle';
82
+ export type KeyboardModifier = 'Alt' | 'Control' | 'Meta' | 'Shift';
83
+ export type ElementState = 'attached' | 'detached' | 'visible' | 'hidden';
84
+ export type InputElementState = ElementState | 'enabled' | 'disabled' | 'editable';
85
+ export type LifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle';
69
86
 
70
87
  export interface TimeoutOptions {
71
- /**
72
- * Maximum time in milliseconds. Pass 0 to disable the timeout. Default is overridden by the setDefaultTimeout option on `BrowserContext` or `Page`.
73
- * Defaults to 30000.
74
- */
75
- timeout?: number;
88
+ /**
89
+ * Maximum time in milliseconds. Pass 0 to disable the timeout. Default is overridden by the setDefaultTimeout option on `BrowserContext` or `Page`.
90
+ * Defaults to 30000.
91
+ */
92
+ timeout?: number;
76
93
  }
77
94
 
78
95
  export interface StrictnessOptions {
79
- /**
80
- * When `true`, the call requires selector to resolve to a single element.
81
- * If given selector resolves to more than one element, the call throws
82
- * an exception. Defaults to `false`.
83
- */
84
- strict?: boolean;
96
+ /**
97
+ * When `true`, the call requires selector to resolve to a single element.
98
+ * If given selector resolves to more than one element, the call throws
99
+ * an exception. Defaults to `false`.
100
+ */
101
+ strict?: boolean;
85
102
  }
86
103
 
87
104
  export interface EventSequenceOptions {
88
- /**
89
- * Delay between events in milliseconds. Defaults to 0.
90
- */
91
- delay?: number;
105
+ /**
106
+ * Delay between events in milliseconds. Defaults to 0.
107
+ */
108
+ delay?: number;
92
109
  }
93
110
 
94
111
  export type ElementHandleOptions = {
95
- /**
96
- * Setting this to `true` will bypass the actionability checks (visible,
97
- * stable, enabled). Defaults to `false`.
98
- */
99
- force?: boolean,
100
-
101
- /**
102
- * If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete.
103
- * Defaults to `false`.
104
- */
105
- noWaitAfter?: boolean,
112
+ /**
113
+ * Setting this to `true` will bypass the actionability checks (visible,
114
+ * stable, enabled). Defaults to `false`.
115
+ */
116
+ force?: boolean;
117
+
118
+ /**
119
+ * If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete.
120
+ * Defaults to `false`.
121
+ */
122
+ noWaitAfter?: boolean;
106
123
  } & TimeoutOptions;
107
124
 
108
125
  export type ElementHandlePointerOptions = ElementHandleOptions & {
109
- /**
110
- * Setting this to `true` will perform the actionability checks without
111
- * performing the action. Useful to wait until the element is ready for the
112
- * action without performing it. Defaults to `false`.
113
- */
114
- trial?: boolean,
126
+ /**
127
+ * Setting this to `true` will perform the actionability checks without
128
+ * performing the action. Useful to wait until the element is ready for the
129
+ * action without performing it. Defaults to `false`.
130
+ */
131
+ trial?: boolean;
115
132
  };
116
133
 
117
134
  export type ElementClickOptions = ElementHandlePointerOptions & {
118
- /**
119
- * A point to use relative to the top left corner of the element. If not supplied,
120
- * a visible point of the element is used.
121
- */
122
- position?: { x: number, y: number }
135
+ /**
136
+ * A point to use relative to the top left corner of the element. If not supplied,
137
+ * a visible point of the element is used.
138
+ */
139
+ position?: { x: number; y: number };
123
140
  };
124
141
 
125
142
  export interface KeyboardModifierOptions {
126
- /**
127
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action.
128
- * If not specified, currently pressed modifiers are used.
129
- */
130
- modifiers?: KeyboardModifier[];
143
+ /**
144
+ * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action.
145
+ * If not specified, currently pressed modifiers are used.
146
+ */
147
+ modifiers?: KeyboardModifier[];
131
148
  }
132
149
 
133
150
  export type KeyboardPressOptions = {
134
- /**
135
- * If set to `true` and a navigation occurs from performing this action, it
136
- * will not wait for it to complete. Defaults to `false`.
137
- */
138
- noWaitAfter?: boolean,
139
- } & EventSequenceOptions & TimeoutOptions;
151
+ /**
152
+ * If set to `true` and a navigation occurs from performing this action, it
153
+ * will not wait for it to complete. Defaults to `false`.
154
+ */
155
+ noWaitAfter?: boolean;
156
+ } & EventSequenceOptions &
157
+ TimeoutOptions;
140
158
 
141
159
  export type MouseMoveOptions = ElementClickOptions & KeyboardModifierOptions;
142
160
 
143
161
  export type MouseClickOptions = {
144
- /**
145
- * The mouse button to use during the action.
146
- * Defaults to `left`.
147
- */
148
- button?: MouseButton,
162
+ /**
163
+ * The mouse button to use during the action.
164
+ * Defaults to `left`.
165
+ */
166
+ button?: MouseButton;
149
167
  } & EventSequenceOptions;
150
168
 
151
169
  export type MouseMultiClickOptions = MouseClickOptions & {
152
- /**
153
- * The number of times the action is performed.
154
- * Defaults to 1.
155
- */
156
- clickCount?: number,
170
+ /**
171
+ * The number of times the action is performed.
172
+ * Defaults to 1.
173
+ */
174
+ clickCount?: number;
157
175
  };
158
176
 
159
177
  export interface MouseDownUpOptions {
160
- /**
161
- * The mouse button to use during the action.
162
- * Defaults to `left`.
163
- */
164
- button?: MouseButton;
165
-
166
- /**
167
- * Defaults to 1.
168
- */
169
- clickCount?: number;
178
+ /**
179
+ * The mouse button to use during the action.
180
+ * Defaults to `left`.
181
+ */
182
+ button?: MouseButton;
183
+
184
+ /**
185
+ * Defaults to 1.
186
+ */
187
+ clickCount?: number;
170
188
  }
171
189
 
172
190
  export type ContentLoadOptions = {
173
- /**
174
- * When to consider operation succeeded, defaults to `load`. Events can be
175
- * either:
176
- * - `'domcontentloaded'` - consider operation to be finished when the
177
- * `DOMContentLoaded` event is fired.
178
- * - `'load'` - consider operation to be finished when the `load` event is
179
- * fired.
180
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
181
- * when there are no network connections for at least `500` ms. Don't use
182
- * this method for testing especially with chatty websites where the event
183
- * may never fire, rely on web assertions to assess readiness instead.
184
- */
185
- waitUntil?: LifecycleEvent;
191
+ /**
192
+ * When to consider operation succeeded, defaults to `load`. Events can be
193
+ * either:
194
+ * - `'domcontentloaded'` - consider operation to be finished when the
195
+ * `DOMContentLoaded` event is fired.
196
+ * - `'load'` - consider operation to be finished when the `load` event is
197
+ * fired.
198
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
199
+ * when there are no network connections for at least `500` ms. Don't use
200
+ * this method for testing especially with chatty websites where the event
201
+ * may never fire, rely on web assertions to assess readiness instead.
202
+ */
203
+ waitUntil?: LifecycleEvent;
186
204
  } & TimeoutOptions;
187
205
 
188
206
  export type NavigationOptions = {
189
- /**
190
- * Referer header value.
191
- */
192
- referer?: string;
207
+ /**
208
+ * Referer header value.
209
+ */
210
+ referer?: string;
193
211
  } & ContentLoadOptions;
194
212
 
195
213
  export interface ResourceTiming {
196
- /**
197
- * Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC
198
- */
199
- startTime: number;
200
-
201
- /**
202
- * Time immediately before the browser starts the domain name lookup for the resource.
203
- * The value is given in milliseconds relative to `startTime`, -1 if not available.
204
- */
205
- domainLookupStart: number;
206
-
207
- /**
208
- * Time immediately after the browser ends the domain name lookup for the resource.
209
- * The value is given in milliseconds relative to `startTime`, -1 if not available.
210
- */
211
- domainLookupEnd: number;
212
-
213
- /**
214
- * Time immediately before the user agent starts establishing the connection to the server
215
- * to retrieve the resource. The value is given in milliseconds relative to `startTime`,
216
- * -1 if not available.
217
- */
218
- connectStart: number;
219
-
220
- /**
221
- * Time immediately before the browser starts the handshake process to secure the current
222
- * connection. The value is given in milliseconds relative to `startTime`, -1 if not available.
223
- */
224
- secureConnectionStart: number;
225
-
226
- /**
227
- * Time immediately after the user agent establishes the connection to the server
228
- * to retrieve the resource. The value is given in milliseconds relative to `startTime`,
229
- * -1 if not available.
230
- */
231
- connectEnd: number;
232
-
233
- /**
234
- * Time immediately before the browser starts requesting the resource from the server,
235
- * cache, or local resource. The value is given in milliseconds relative to `startTime`,
236
- * -1 if not available.
237
- */
238
- requestStart: number;
239
-
240
- /**
241
- * Time immediately after the browser receives the first byte of the response from the server,
242
- * cache, or local resource. The value is given in milliseconds relative to `startTime`,
243
- * -1 if not available.
244
- */
245
- responseStart: number;
246
-
247
- /**
248
- * Time immediately after the browser receives the last byte of the resource or immediately
249
- * before the transport connection is closed, whichever comes first. The value is given
250
- * in milliseconds relative to `startTime`, -1 if not available.
251
- */
252
- responseEnd: number;
214
+ /**
215
+ * Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC
216
+ */
217
+ startTime: number;
218
+
219
+ /**
220
+ * Time immediately before the browser starts the domain name lookup for the resource.
221
+ * The value is given in milliseconds relative to `startTime`, -1 if not available.
222
+ */
223
+ domainLookupStart: number;
224
+
225
+ /**
226
+ * Time immediately after the browser ends the domain name lookup for the resource.
227
+ * The value is given in milliseconds relative to `startTime`, -1 if not available.
228
+ */
229
+ domainLookupEnd: number;
230
+
231
+ /**
232
+ * Time immediately before the user agent starts establishing the connection to the server
233
+ * to retrieve the resource. The value is given in milliseconds relative to `startTime`,
234
+ * -1 if not available.
235
+ */
236
+ connectStart: number;
237
+
238
+ /**
239
+ * Time immediately before the browser starts the handshake process to secure the current
240
+ * connection. The value is given in milliseconds relative to `startTime`, -1 if not available.
241
+ */
242
+ secureConnectionStart: number;
243
+
244
+ /**
245
+ * Time immediately after the user agent establishes the connection to the server
246
+ * to retrieve the resource. The value is given in milliseconds relative to `startTime`,
247
+ * -1 if not available.
248
+ */
249
+ connectEnd: number;
250
+
251
+ /**
252
+ * Time immediately before the browser starts requesting the resource from the server,
253
+ * cache, or local resource. The value is given in milliseconds relative to `startTime`,
254
+ * -1 if not available.
255
+ */
256
+ requestStart: number;
257
+
258
+ /**
259
+ * Time immediately after the browser receives the first byte of the response from the server,
260
+ * cache, or local resource. The value is given in milliseconds relative to `startTime`,
261
+ * -1 if not available.
262
+ */
263
+ responseStart: number;
264
+
265
+ /**
266
+ * Time immediately after the browser receives the last byte of the resource or immediately
267
+ * before the transport connection is closed, whichever comes first. The value is given
268
+ * in milliseconds relative to `startTime`, -1 if not available.
269
+ */
270
+ responseEnd: number;
253
271
  }
254
272
 
255
273
  export interface SecurityDetailsObject {
256
- /**
257
- * Common Name component of the Issuer field. The value is extracted from the
258
- * certificate. This should only be used for informational purposes.
259
- */
260
- issuer?: string;
261
-
262
- /**
263
- * The specific TLS protocol used. For example `TLS 1.3`.
264
- */
265
- protocol?: string;
266
-
267
- /**
268
- * Common Name component of the Subject field. The value is extracted from the
269
- * certificate. This should only be used for informational purposes.
270
- */
271
- subjectName?: string;
272
-
273
- /**
274
- * Unix timestamp (in seconds) specifying the exact date/time when this cert
275
- * becomes valid.
276
- */
277
- validFrom?: number;
278
-
279
- /**
280
- * Unix timestamp (in seconds) specifying the exact date/time when this cert
281
- * becomes invalid.
282
- */
283
- validTo?: number;
284
-
285
- /**
286
- * String with hex encoded SHA256 fingerprint of the certificate. The value is
287
- * extracted from the certificate.
288
- */
289
- sanList?: string[];
274
+ /**
275
+ * Common Name component of the Issuer field. The value is extracted from the
276
+ * certificate. This should only be used for informational purposes.
277
+ */
278
+ issuer?: string;
279
+
280
+ /**
281
+ * The specific TLS protocol used. For example `TLS 1.3`.
282
+ */
283
+ protocol?: string;
284
+
285
+ /**
286
+ * Common Name component of the Subject field. The value is extracted from the
287
+ * certificate. This should only be used for informational purposes.
288
+ */
289
+ subjectName?: string;
290
+
291
+ /**
292
+ * Unix timestamp (in seconds) specifying the exact date/time when this cert
293
+ * becomes valid.
294
+ */
295
+ validFrom?: number;
296
+
297
+ /**
298
+ * Unix timestamp (in seconds) specifying the exact date/time when this cert
299
+ * becomes invalid.
300
+ */
301
+ validTo?: number;
302
+
303
+ /**
304
+ * String with hex encoded SHA256 fingerprint of the certificate. The value is
305
+ * extracted from the certificate.
306
+ */
307
+ sanList?: string[];
290
308
  }
291
309
 
292
310
  export interface Rect {
293
- /**
294
- * The x coordinate of the element in pixels.
295
- * (0, 0) is the top left corner of the viewport.
296
- */
297
- x: number;
298
-
299
- /**
300
- * The y coordinate of the element in pixels.
301
- * (0, 0) is the top left corner of the viewport.
302
- */
303
- y: number;
304
-
305
- /**
306
- * The width of the element in pixels.
307
- */
308
- width: number;
309
-
310
- /**
311
- * The height of the element in pixels.
312
- */
313
- height: number;
311
+ /**
312
+ * The x coordinate of the element in pixels.
313
+ * (0, 0) is the top left corner of the viewport.
314
+ */
315
+ x: number;
316
+
317
+ /**
318
+ * The y coordinate of the element in pixels.
319
+ * (0, 0) is the top left corner of the viewport.
320
+ */
321
+ y: number;
322
+
323
+ /**
324
+ * The width of the element in pixels.
325
+ */
326
+ width: number;
327
+
328
+ /**
329
+ * The height of the element in pixels.
330
+ */
331
+ height: number;
314
332
  }
315
333
 
316
334
  export type ImageFormat = 'jpeg' | 'png';
317
335
 
318
336
  export interface ScreenshotOptions {
319
- /**
320
- * The file path to save the image to. The screenshot type will be inferred from file extension.
321
- */
322
- path?: string;
323
-
324
- /**
325
- * The screenshot format.
326
- * @default 'png'
327
- */
328
- type?: ImageFormat;
329
-
330
- /**
331
- * Hide default white background and allow capturing screenshots with transparency.
332
- * Not applicable to `jpeg` images.
333
- * @default false
334
- */
335
- omitBackground?: boolean;
336
-
337
- /**
338
- * The quality of the image, between 0-100. Not applicable to `png` images.
339
- * @default 100
340
- */
341
- quality?: number;
337
+ /**
338
+ * The file path to save the image to. The screenshot type will be inferred from file extension.
339
+ */
340
+ path?: string;
341
+
342
+ /**
343
+ * The screenshot format.
344
+ * @default 'png'
345
+ */
346
+ type?: ImageFormat;
347
+
348
+ /**
349
+ * Hide default white background and allow capturing screenshots with transparency.
350
+ * Not applicable to `jpeg` images.
351
+ * @default false
352
+ */
353
+ omitBackground?: boolean;
354
+
355
+ /**
356
+ * The quality of the image, between 0-100. Not applicable to `png` images.
357
+ * @default 100
358
+ */
359
+ quality?: number;
342
360
  }
343
361
 
344
362
  /**
@@ -350,22 +368,22 @@ export interface ScreenshotOptions {
350
368
  export type PollingMethod = 'raf' | 'mutation' | 'interval';
351
369
 
352
370
  export interface PollingOptions {
353
- /**
354
- * Polling method to use.
355
- * @default 'raf'
356
- */
357
- polling?: 'raf' | 'mutation' | 'interval';
358
-
359
- /**
360
- * Polling interval in milliseconds if `polling` is set to `interval`.
361
- */
362
- interval?: number;
371
+ /**
372
+ * Polling method to use.
373
+ * @default 'raf'
374
+ */
375
+ polling?: 'raf' | 'mutation' | 'interval';
376
+
377
+ /**
378
+ * Polling interval in milliseconds if `polling` is set to `interval`.
379
+ */
380
+ interval?: number;
363
381
  }
364
382
 
365
383
  export interface ElementStateFilter {
366
- /**
367
- * The element state to filter for.
368
- * @default 'visible'
369
- */
370
- state?: ElementState;
384
+ /**
385
+ * The element state to filter for.
386
+ * @default 'visible'
387
+ */
388
+ state?: ElementState;
371
389
  }