@types/k6 1.4.0 → 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.
Files changed (3) hide show
  1. k6/README.md +1 -1
  2. k6/browser/index.d.ts +137 -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: Mon, 10 Nov 2025 13:11:26 GMT
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
@@ -3231,6 +3231,29 @@ export interface Locator {
3231
3231
  */
3232
3232
  press(key: string, options?: KeyboardPressOptions): Promise<void>;
3233
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
+
3234
3257
  /**
3235
3258
  * Type a text into the input field.
3236
3259
  * @param text Text to type into the input field.
@@ -5693,6 +5716,120 @@ export interface Page {
5693
5716
  },
5694
5717
  ): Promise<Request | null>;
5695
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
+
5696
5833
  /**
5697
5834
  * **NOTE** Use web assertions that assert visibility or a locator-based
5698
5835
  * locator.waitFor([options]) instead.
k6/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/k6",
3
- "version": "1.4.0",
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": "3389c07b59b7207b250360cc9a2fe81354853b03a9211c4cf5f0afb159dfa567",
77
+ "typesPublisherContentHash": "a6dd0fd28d0c1034db421495569cea7137705632506c7da47654859755ccd052",
78
78
  "typeScriptVersion": "5.2"
79
79
  }