@types/k6 1.3.1 → 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.
Files changed (3) hide show
  1. k6/README.md +1 -1
  2. k6/browser/index.d.ts +72 -0
  3. 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, 07 Oct 2025 08:04:38 GMT
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>]
@@ -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.
@@ -5424,6 +5456,16 @@ export interface Page {
5424
5456
  },
5425
5457
  ): Promise<void>;
5426
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
+
5427
5469
  /**
5428
5470
  * Returns the page's URL.
5429
5471
  */
@@ -5621,6 +5663,36 @@ export interface Page {
5621
5663
  },
5622
5664
  ): Promise<Response | null>;
5623
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
+
5624
5696
  /**
5625
5697
  * **NOTE** Use web assertions that assert visibility or a locator-based
5626
5698
  * locator.waitFor([options]) instead.
k6/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/k6",
3
- "version": "1.3.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": "4e3d691be26c1b5fe506bd632f40bf102f9cde3dd34525430b19487481e24b56",
77
+ "typesPublisherContentHash": "3389c07b59b7207b250360cc9a2fe81354853b03a9211c4cf5f0afb159dfa567",
78
78
  "typeScriptVersion": "5.2"
79
79
  }