@types/k6 1.3.0 → 1.4.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 +205 -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:
|
|
11
|
+
* Last updated: Mon, 10 Nov 2025 13:11:26 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>]
|
|
@@ -414,6 +417,139 @@ export interface ElementStateFilter {
|
|
|
414
417
|
state?: ElementState;
|
|
415
418
|
}
|
|
416
419
|
|
|
420
|
+
/**
|
|
421
|
+
* The `devices` named export defines emulation settings for many end-user
|
|
422
|
+
* devices that can be used to simulate browser behavior on a mobile device.
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* ```js
|
|
426
|
+
* import { browser, devices } from 'k6/browser';
|
|
427
|
+
* ... // redacted
|
|
428
|
+
* const iphoneX = devices['iPhone X'];
|
|
429
|
+
* const context = await browser.newContext(iphoneX);
|
|
430
|
+
* ... // redacted
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
export const devices: Record<
|
|
434
|
+
| "Blackberry PlayBook"
|
|
435
|
+
| "Blackberry PlayBook landscape"
|
|
436
|
+
| "BlackBerry Z30"
|
|
437
|
+
| "BlackBerry Z30 landscape"
|
|
438
|
+
| "Galaxy Note 3"
|
|
439
|
+
| "Galaxy Note 3 landscape"
|
|
440
|
+
| "Galaxy Note II"
|
|
441
|
+
| "Galaxy Note II landscape"
|
|
442
|
+
| "Galaxy S III"
|
|
443
|
+
| "Galaxy S III landscape"
|
|
444
|
+
| "Galaxy S5"
|
|
445
|
+
| "Galaxy S5 landscape"
|
|
446
|
+
| "iPad"
|
|
447
|
+
| "iPad landscape"
|
|
448
|
+
| "iPad Mini"
|
|
449
|
+
| "iPad Mini landscape"
|
|
450
|
+
| "iPad Pro"
|
|
451
|
+
| "iPad Pro landscape"
|
|
452
|
+
| "iPhone 4"
|
|
453
|
+
| "iPhone 4 landscape"
|
|
454
|
+
| "iPhone 5"
|
|
455
|
+
| "iPhone 5 landscape"
|
|
456
|
+
| "iPhone 6"
|
|
457
|
+
| "iPhone 6 landscape"
|
|
458
|
+
| "iPhone 6 Plus"
|
|
459
|
+
| "iPhone 6 Plus landscape"
|
|
460
|
+
| "iPhone 7"
|
|
461
|
+
| "iPhone 7 landscape"
|
|
462
|
+
| "iPhone 7 Plus"
|
|
463
|
+
| "iPhone 7 Plus landscape"
|
|
464
|
+
| "iPhone 8"
|
|
465
|
+
| "iPhone 8 landscape"
|
|
466
|
+
| "iPhone 8 Plus"
|
|
467
|
+
| "iPhone 8 Plus landscape"
|
|
468
|
+
| "iPhone SE"
|
|
469
|
+
| "iPhone SE landscape"
|
|
470
|
+
| "iPhone X"
|
|
471
|
+
| "iPhone X landscape"
|
|
472
|
+
| "iPhone XR"
|
|
473
|
+
| "iPhone XR landscape"
|
|
474
|
+
| "JioPhone 2"
|
|
475
|
+
| "JioPhone 2 landscape"
|
|
476
|
+
| "Kindle Fire HDX"
|
|
477
|
+
| "Kindle Fire HDX landscape"
|
|
478
|
+
| "LG Optimus L70"
|
|
479
|
+
| "LG Optimus L70 landscape"
|
|
480
|
+
| "Microsoft Lumia 550"
|
|
481
|
+
| "Microsoft Lumia 950"
|
|
482
|
+
| "Microsoft Lumia 950 landscape"
|
|
483
|
+
| "Nexus 10"
|
|
484
|
+
| "Nexus 10 landscape"
|
|
485
|
+
| "Nexus 4"
|
|
486
|
+
| "Nexus 4 landscape"
|
|
487
|
+
| "Nexus 5"
|
|
488
|
+
| "Nexus 5 landscape"
|
|
489
|
+
| "Nexus 5X"
|
|
490
|
+
| "Nexus 5X landscape"
|
|
491
|
+
| "Nexus 6"
|
|
492
|
+
| "Nexus 6 landscape"
|
|
493
|
+
| "Nexus 6P"
|
|
494
|
+
| "Nexus 6P landscape"
|
|
495
|
+
| "Nexus 7"
|
|
496
|
+
| "Nexus 7 landscape"
|
|
497
|
+
| "Nokia Lumia 520"
|
|
498
|
+
| "Nokia Lumia 520 landscape"
|
|
499
|
+
| "Nokia N9"
|
|
500
|
+
| "Nokia N9 landscape"
|
|
501
|
+
| "Pixel 2"
|
|
502
|
+
| "Pixel 2 landscape"
|
|
503
|
+
| "Pixel 2 XL"
|
|
504
|
+
| "Pixel 2 XL landscape",
|
|
505
|
+
Device
|
|
506
|
+
>;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Device represents an end-user device (computer, tablet, phone etc.).
|
|
510
|
+
*/
|
|
511
|
+
export interface Device {
|
|
512
|
+
/**
|
|
513
|
+
* Name of the device.
|
|
514
|
+
*/
|
|
515
|
+
name: string;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* User agent of the device.
|
|
519
|
+
*/
|
|
520
|
+
userAgent: string;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Viewport size of the device.
|
|
524
|
+
*/
|
|
525
|
+
viewport: {
|
|
526
|
+
/**
|
|
527
|
+
* page width in pixels.
|
|
528
|
+
*/
|
|
529
|
+
width: number;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* page height in pixels.
|
|
533
|
+
*/
|
|
534
|
+
height: number;
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Device viewport scale factor.
|
|
539
|
+
*/
|
|
540
|
+
deviceScaleFactor: number;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Indicates whether the device is a mobile device.
|
|
544
|
+
*/
|
|
545
|
+
isMobile: boolean;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Indicates whether the device support touch events.
|
|
549
|
+
*/
|
|
550
|
+
hasTouch: boolean;
|
|
551
|
+
}
|
|
552
|
+
|
|
417
553
|
/**
|
|
418
554
|
* BrowserPermissions defines all the possible permissions that can be granted
|
|
419
555
|
* to the browser application.
|
|
@@ -2864,6 +3000,35 @@ export interface Locator {
|
|
|
2864
3000
|
*/
|
|
2865
3001
|
dblclick(options?: MouseMoveOptions & MouseMultiClickOptions): Promise<void>;
|
|
2866
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
|
+
|
|
2867
3032
|
/**
|
|
2868
3033
|
* Use this method to select an `input type="checkbox"`.
|
|
2869
3034
|
* @param options Options to use.
|
|
@@ -5291,6 +5456,16 @@ export interface Page {
|
|
|
5291
5456
|
},
|
|
5292
5457
|
): Promise<void>;
|
|
5293
5458
|
|
|
5459
|
+
/**
|
|
5460
|
+
* Removes all existing routes for the `url`.
|
|
5461
|
+
*/
|
|
5462
|
+
unroute(url: string | RegExp): Promise<void>;
|
|
5463
|
+
|
|
5464
|
+
/**
|
|
5465
|
+
* Removes all routes created with page.route().
|
|
5466
|
+
*/
|
|
5467
|
+
unrouteAll(): Promise<void>;
|
|
5468
|
+
|
|
5294
5469
|
/**
|
|
5295
5470
|
* Returns the page's URL.
|
|
5296
5471
|
*/
|
|
@@ -5488,6 +5663,36 @@ export interface Page {
|
|
|
5488
5663
|
},
|
|
5489
5664
|
): Promise<Response | null>;
|
|
5490
5665
|
|
|
5666
|
+
/**
|
|
5667
|
+
* Waits for the page to match against the URL for a Request object
|
|
5668
|
+
*
|
|
5669
|
+
* @example
|
|
5670
|
+
* ```js
|
|
5671
|
+
* const requestPromise = page.waitForRequest('https://example.com/resource');
|
|
5672
|
+
* await page.goto('https://example.com/resource');
|
|
5673
|
+
* const request = await requestPromise;
|
|
5674
|
+
* ```
|
|
5675
|
+
*
|
|
5676
|
+
* @param request Request URL string or regex to match against Request object.
|
|
5677
|
+
* @param options Options to use.
|
|
5678
|
+
*/
|
|
5679
|
+
waitForRequest(
|
|
5680
|
+
request: string | RegExp,
|
|
5681
|
+
options?: {
|
|
5682
|
+
/**
|
|
5683
|
+
* Maximum operation time in milliseconds. Defaults to `30` seconds.
|
|
5684
|
+
* The default value can be changed via the
|
|
5685
|
+
* browserContext.setDefaultNavigationTimeout(timeout),
|
|
5686
|
+
* browserContext.setDefaultTimeout(timeout),
|
|
5687
|
+
* page.setDefaultNavigationTimeout(timeout) or
|
|
5688
|
+
* page.setDefaultTimeout(timeout) methods.
|
|
5689
|
+
*
|
|
5690
|
+
* Setting the value to `0` will disable the timeout.
|
|
5691
|
+
*/
|
|
5692
|
+
timeout?: number;
|
|
5693
|
+
},
|
|
5694
|
+
): Promise<Request | null>;
|
|
5695
|
+
|
|
5491
5696
|
/**
|
|
5492
5697
|
* **NOTE** Use web assertions that assert visibility or a locator-based
|
|
5493
5698
|
* 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.4.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": "3389c07b59b7207b250360cc9a2fe81354853b03a9211c4cf5f0afb159dfa567",
|
|
78
78
|
"typeScriptVersion": "5.2"
|
|
79
79
|
}
|