@types/k6 0.48.0 → 0.49.1
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 +46 -69
- k6/experimental/grpc.d.ts +6 -0
- k6/net/grpc.d.ts +58 -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: Wed, 06
|
|
11
|
+
* Last updated: Wed, 06 Mar 2024 10:07:13 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
k6/experimental/browser.d.ts
CHANGED
|
@@ -1170,7 +1170,10 @@ export interface ElementHandle extends JSHandle {
|
|
|
1170
1170
|
* @param selector A selector to query for.
|
|
1171
1171
|
* @param options Wait options.
|
|
1172
1172
|
*/
|
|
1173
|
-
waitForSelector(
|
|
1173
|
+
waitForSelector(
|
|
1174
|
+
selector: string,
|
|
1175
|
+
options?: { state?: ElementState } & StrictnessOptions & TimeoutOptions,
|
|
1176
|
+
): ElementHandle;
|
|
1174
1177
|
}
|
|
1175
1178
|
|
|
1176
1179
|
/**
|
|
@@ -1469,7 +1472,7 @@ export interface Frame {
|
|
|
1469
1472
|
* @param options The options to use.
|
|
1470
1473
|
* @returns `true` if the element is hidden, `false` otherwise.
|
|
1471
1474
|
*/
|
|
1472
|
-
isHidden(selector: string, options?:
|
|
1475
|
+
isHidden(selector: string, options?: StrictnessOptions): boolean;
|
|
1473
1476
|
|
|
1474
1477
|
/**
|
|
1475
1478
|
* Get whether the first element found that matches the selector is visible or not.
|
|
@@ -1477,7 +1480,7 @@ export interface Frame {
|
|
|
1477
1480
|
* @param options The options to use.
|
|
1478
1481
|
* @returns `true` if the element is visible, `false` otherwise.
|
|
1479
1482
|
*/
|
|
1480
|
-
isVisible(selector: string, options?:
|
|
1483
|
+
isVisible(selector: string, options?: StrictnessOptions): boolean;
|
|
1481
1484
|
|
|
1482
1485
|
/**
|
|
1483
1486
|
* Wait for the given function to return a truthy value.
|
|
@@ -1624,37 +1627,51 @@ export interface Keyboard {
|
|
|
1624
1627
|
* React, Vue, etc.
|
|
1625
1628
|
*/
|
|
1626
1629
|
export interface Locator {
|
|
1630
|
+
/**
|
|
1631
|
+
* Clears text boxes and input fields of any existing values.
|
|
1632
|
+
*
|
|
1633
|
+
* **Usage**
|
|
1634
|
+
*
|
|
1635
|
+
* ```js
|
|
1636
|
+
* // Clears the input field matching the selector.
|
|
1637
|
+
* page.locator('input[name="login"]').clear();
|
|
1638
|
+
* ```
|
|
1639
|
+
*
|
|
1640
|
+
* @param options Options to use.
|
|
1641
|
+
*/
|
|
1642
|
+
clear(options?: ElementHandleOptions): void;
|
|
1643
|
+
|
|
1627
1644
|
/**
|
|
1628
1645
|
* Mouse click on the chosen element.
|
|
1629
1646
|
* @param options Options to use.
|
|
1630
1647
|
* @returns Promise which resolves when the element is successfully clicked.
|
|
1631
1648
|
*/
|
|
1632
|
-
click(options?: MouseMoveOptions & MouseMultiClickOptions
|
|
1649
|
+
click(options?: MouseMoveOptions & MouseMultiClickOptions): Promise<void>;
|
|
1633
1650
|
|
|
1634
1651
|
/**
|
|
1635
1652
|
* Mouse double click on the chosen element.
|
|
1636
1653
|
* @param options Options to use.
|
|
1637
1654
|
*/
|
|
1638
|
-
dblclick(options?: MouseMoveOptions & MouseMultiClickOptions
|
|
1655
|
+
dblclick(options?: MouseMoveOptions & MouseMultiClickOptions): void;
|
|
1639
1656
|
|
|
1640
1657
|
/**
|
|
1641
1658
|
* Use this method to select an `input type="checkbox"`.
|
|
1642
1659
|
* @param options Options to use.
|
|
1643
1660
|
*/
|
|
1644
|
-
check(options?: ElementClickOptions
|
|
1661
|
+
check(options?: ElementClickOptions): void;
|
|
1645
1662
|
|
|
1646
1663
|
/**
|
|
1647
1664
|
* Use this method to unselect an `input type="checkbox"`.
|
|
1648
1665
|
* @param options Options to use.
|
|
1649
1666
|
*/
|
|
1650
|
-
uncheck(options?: ElementClickOptions
|
|
1667
|
+
uncheck(options?: ElementClickOptions): void;
|
|
1651
1668
|
|
|
1652
1669
|
/**
|
|
1653
1670
|
* Checks to see if the `input type="checkbox"` is selected or not.
|
|
1654
1671
|
* @param options Options to use.
|
|
1655
1672
|
* @returns `true` if the element is checked, `false` otherwise.
|
|
1656
1673
|
*/
|
|
1657
|
-
isChecked(options?: TimeoutOptions
|
|
1674
|
+
isChecked(options?: TimeoutOptions): boolean;
|
|
1658
1675
|
|
|
1659
1676
|
/**
|
|
1660
1677
|
* Checks if the element is editable.
|
|
@@ -1668,41 +1685,39 @@ export interface Locator {
|
|
|
1668
1685
|
* @param options Options to use.
|
|
1669
1686
|
* @returns `true` if the element is enabled, `false` otherwise.
|
|
1670
1687
|
*/
|
|
1671
|
-
isEnabled(options?: TimeoutOptions
|
|
1688
|
+
isEnabled(options?: TimeoutOptions): boolean;
|
|
1672
1689
|
|
|
1673
1690
|
/**
|
|
1674
1691
|
* Checks if the element is `disabled`.
|
|
1675
1692
|
* @param options Options to use.
|
|
1676
1693
|
* @returns `true` if the element is disabled, `false` otherwise.
|
|
1677
1694
|
*/
|
|
1678
|
-
isDisabled(options?: TimeoutOptions
|
|
1695
|
+
isDisabled(options?: TimeoutOptions): boolean;
|
|
1679
1696
|
|
|
1680
1697
|
/**
|
|
1681
1698
|
* Checks if the element is `visible`.
|
|
1682
|
-
* @param options Options to use.
|
|
1683
1699
|
* @returns `true` if the element is visible, `false` otherwise.
|
|
1684
1700
|
*/
|
|
1685
|
-
isVisible(
|
|
1701
|
+
isVisible(): boolean;
|
|
1686
1702
|
|
|
1687
1703
|
/**
|
|
1688
1704
|
* Checks if the element is `hidden`.
|
|
1689
|
-
* @param options Options to use.
|
|
1690
1705
|
* @returns `true` if the element is hidden, `false` otherwise.
|
|
1691
1706
|
*/
|
|
1692
|
-
isHidden(
|
|
1707
|
+
isHidden(): boolean;
|
|
1693
1708
|
|
|
1694
1709
|
/**
|
|
1695
1710
|
* Fill an `input`, `textarea` or `contenteditable` element with the provided value.
|
|
1696
1711
|
* @param value Value to fill for the `input` or `textarea` element.
|
|
1697
1712
|
* @param options Options to use.
|
|
1698
1713
|
*/
|
|
1699
|
-
fill(value: string, options?: ElementHandleOptions
|
|
1714
|
+
fill(value: string, options?: ElementHandleOptions): void;
|
|
1700
1715
|
|
|
1701
1716
|
/**
|
|
1702
1717
|
* Focuses the element using locator's selector.
|
|
1703
1718
|
* @param options Options to use.
|
|
1704
1719
|
*/
|
|
1705
|
-
focus(options?: TimeoutOptions
|
|
1720
|
+
focus(options?: TimeoutOptions): void;
|
|
1706
1721
|
|
|
1707
1722
|
/**
|
|
1708
1723
|
* Returns the element attribute value for the given attribute name.
|
|
@@ -1710,35 +1725,35 @@ export interface Locator {
|
|
|
1710
1725
|
* @param options Options to use.
|
|
1711
1726
|
* @returns Attribute value.
|
|
1712
1727
|
*/
|
|
1713
|
-
getAttribute(name: string, options?: TimeoutOptions
|
|
1728
|
+
getAttribute(name: string, options?: TimeoutOptions): string | null;
|
|
1714
1729
|
|
|
1715
1730
|
/**
|
|
1716
1731
|
* Returns the `element.innerHTML`.
|
|
1717
1732
|
* @param options Options to use.
|
|
1718
1733
|
* @returns Element's innerHTML.
|
|
1719
1734
|
*/
|
|
1720
|
-
innerHTML(options?: TimeoutOptions
|
|
1735
|
+
innerHTML(options?: TimeoutOptions): string;
|
|
1721
1736
|
|
|
1722
1737
|
/**
|
|
1723
1738
|
* Returns the `element.innerText`.
|
|
1724
1739
|
* @param options Options to use.
|
|
1725
1740
|
* @returns Element's innerText.
|
|
1726
1741
|
*/
|
|
1727
|
-
innerText(options?: TimeoutOptions
|
|
1742
|
+
innerText(options?: TimeoutOptions): string;
|
|
1728
1743
|
|
|
1729
1744
|
/**
|
|
1730
1745
|
* Returns the `element.textContent`.
|
|
1731
1746
|
* @param options Options to use.
|
|
1732
1747
|
* @returns Element's textContent.
|
|
1733
1748
|
*/
|
|
1734
|
-
textContent(options?: TimeoutOptions
|
|
1749
|
+
textContent(options?: TimeoutOptions): string;
|
|
1735
1750
|
|
|
1736
1751
|
/**
|
|
1737
1752
|
* Returns `input.value` for the selected `input`, `textarea` or `select` element.
|
|
1738
1753
|
* @param options Options to use.
|
|
1739
1754
|
* @returns The input value of the element.
|
|
1740
1755
|
*/
|
|
1741
|
-
inputValue(options?: TimeoutOptions
|
|
1756
|
+
inputValue(options?: TimeoutOptions): string;
|
|
1742
1757
|
|
|
1743
1758
|
/**
|
|
1744
1759
|
* Select one or more options which match the values. If the select has the multiple attribute, all matching options are selected,
|
|
@@ -1749,7 +1764,7 @@ export interface Locator {
|
|
|
1749
1764
|
*/
|
|
1750
1765
|
selectOption(
|
|
1751
1766
|
values: string | string[] | { value?: string; label?: string; index?: number },
|
|
1752
|
-
options?: ElementHandleOptions
|
|
1767
|
+
options?: ElementHandleOptions,
|
|
1753
1768
|
): string[];
|
|
1754
1769
|
|
|
1755
1770
|
/**
|
|
@@ -1771,13 +1786,13 @@ export interface Locator {
|
|
|
1771
1786
|
* Hover over the element.
|
|
1772
1787
|
* @param options Options to use.
|
|
1773
1788
|
*/
|
|
1774
|
-
hover(options?: MouseMoveOptions
|
|
1789
|
+
hover(options?: MouseMoveOptions): void;
|
|
1775
1790
|
|
|
1776
1791
|
/**
|
|
1777
1792
|
* Tap on the chosen element.
|
|
1778
1793
|
* @param options Options to use.
|
|
1779
1794
|
*/
|
|
1780
|
-
tap(options?: MouseMoveOptions
|
|
1795
|
+
tap(options?: MouseMoveOptions): void;
|
|
1781
1796
|
|
|
1782
1797
|
/**
|
|
1783
1798
|
* Dispatches HTML DOM event types e.g. `click`.
|
|
@@ -1785,13 +1800,13 @@ export interface Locator {
|
|
|
1785
1800
|
* @param eventInit Event-specific properties.
|
|
1786
1801
|
* @param options Options to use.
|
|
1787
1802
|
*/
|
|
1788
|
-
dispatchEvent(type: string, eventInit?: EvaluationArgument, options?: TimeoutOptions
|
|
1803
|
+
dispatchEvent(type: string, eventInit?: EvaluationArgument, options?: TimeoutOptions): void;
|
|
1789
1804
|
|
|
1790
1805
|
/**
|
|
1791
1806
|
* Wait for the element to be in a particular state e.g. `visible`.
|
|
1792
1807
|
* @param options Wait options.
|
|
1793
1808
|
*/
|
|
1794
|
-
waitFor(options?: { state?: ElementState } & TimeoutOptions
|
|
1809
|
+
waitFor(options?: { state?: ElementState } & TimeoutOptions): void;
|
|
1795
1810
|
}
|
|
1796
1811
|
|
|
1797
1812
|
/**
|
|
@@ -2581,7 +2596,7 @@ export interface Page {
|
|
|
2581
2596
|
): boolean;
|
|
2582
2597
|
|
|
2583
2598
|
/**
|
|
2584
|
-
* **NOTE** Use locator-based locator.isHidden(
|
|
2599
|
+
* **NOTE** Use locator-based locator.isHidden() instead.
|
|
2585
2600
|
*
|
|
2586
2601
|
* Returns whether the element is hidden.
|
|
2587
2602
|
*
|
|
@@ -2589,29 +2604,10 @@ export interface Page {
|
|
|
2589
2604
|
* elements satisfying the selector, the first will be used.
|
|
2590
2605
|
* @param options
|
|
2591
2606
|
*/
|
|
2592
|
-
isHidden(
|
|
2593
|
-
selector: string,
|
|
2594
|
-
options?: {
|
|
2595
|
-
/**
|
|
2596
|
-
* When `true`, the call requires selector to resolve to a single element.
|
|
2597
|
-
* If given selector resolves to more than one element, the call throws
|
|
2598
|
-
* an exception. Defaults to `false`.
|
|
2599
|
-
*/
|
|
2600
|
-
strict?: boolean;
|
|
2601
|
-
|
|
2602
|
-
/**
|
|
2603
|
-
* Maximum time in milliseconds. Defaults to `30` seconds. Default is
|
|
2604
|
-
* overridden by the `setDefaultTimeout` option on `BrowserContext` or
|
|
2605
|
-
* `page` methods.
|
|
2606
|
-
*
|
|
2607
|
-
* Setting the value to `0` will disable the timeout.
|
|
2608
|
-
*/
|
|
2609
|
-
timeout?: number;
|
|
2610
|
-
},
|
|
2611
|
-
): boolean;
|
|
2607
|
+
isHidden(selector: string, options?: StrictnessOptions): boolean;
|
|
2612
2608
|
|
|
2613
2609
|
/**
|
|
2614
|
-
* **NOTE** Use locator-based locator.isVisible(
|
|
2610
|
+
* **NOTE** Use locator-based locator.isVisible() instead.
|
|
2615
2611
|
*
|
|
2616
2612
|
* Returns whether the element is visible.
|
|
2617
2613
|
*
|
|
@@ -2619,26 +2615,7 @@ export interface Page {
|
|
|
2619
2615
|
* elements satisfying the selector, the first will be used.
|
|
2620
2616
|
* @param options
|
|
2621
2617
|
*/
|
|
2622
|
-
isVisible(
|
|
2623
|
-
selector: string,
|
|
2624
|
-
options?: {
|
|
2625
|
-
/**
|
|
2626
|
-
* When `true`, the call requires selector to resolve to a single element.
|
|
2627
|
-
* If given selector resolves to more than one element, the call throws
|
|
2628
|
-
* an exception. Defaults to `false`.
|
|
2629
|
-
*/
|
|
2630
|
-
strict?: boolean;
|
|
2631
|
-
|
|
2632
|
-
/**
|
|
2633
|
-
* Maximum time in milliseconds. Defaults to `30` seconds. Default is
|
|
2634
|
-
* overridden by the `setDefaultTimeout` option on `BrowserContext` or
|
|
2635
|
-
* `page` methods.
|
|
2636
|
-
*
|
|
2637
|
-
* Setting the value to `0` will disable the timeout.
|
|
2638
|
-
*/
|
|
2639
|
-
timeout?: number;
|
|
2640
|
-
},
|
|
2641
|
-
): boolean;
|
|
2618
|
+
isVisible(selector: string, options?: StrictnessOptions): boolean;
|
|
2642
2619
|
|
|
2643
2620
|
/**
|
|
2644
2621
|
* Returns the keyboard instance to interact with a virtual keyboard on the
|
|
@@ -3396,7 +3373,7 @@ export interface Page {
|
|
|
3396
3373
|
* To wait for an element on the page, use locator.waitFor([options]).
|
|
3397
3374
|
* @param selector A selector to query for.
|
|
3398
3375
|
*/
|
|
3399
|
-
$(selector: string): ElementHandle;
|
|
3376
|
+
$(selector: string): ElementHandle | null;
|
|
3400
3377
|
|
|
3401
3378
|
/**
|
|
3402
3379
|
* **NOTE** Use locator-based page.locator(selector[, options]) instead.
|
k6/experimental/grpc.d.ts
CHANGED
|
@@ -98,11 +98,15 @@ export interface GrpcError {
|
|
|
98
98
|
/**
|
|
99
99
|
* This module provides classes for Remote Procedure Calls over HTTP/2.
|
|
100
100
|
* https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/grpc/
|
|
101
|
+
*
|
|
102
|
+
* @deprecated Use the `k6/net/grpc` module instead.
|
|
101
103
|
*/
|
|
102
104
|
declare namespace grpc {
|
|
103
105
|
/**
|
|
104
106
|
* gRPC client to interact with a gRPC server.
|
|
105
107
|
* https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/grpc/client/
|
|
108
|
+
*
|
|
109
|
+
* @deprecated Use the `k6/net/grpc` module instead.
|
|
106
110
|
*/
|
|
107
111
|
class Client {
|
|
108
112
|
protected __brand: never;
|
|
@@ -145,6 +149,8 @@ declare namespace grpc {
|
|
|
145
149
|
|
|
146
150
|
/**
|
|
147
151
|
* Stream allows you to use streaming RPCs.
|
|
152
|
+
*
|
|
153
|
+
* @deprecated Use the `k6/net/grpc` module instead.
|
|
148
154
|
*/
|
|
149
155
|
class Stream {
|
|
150
156
|
/**
|
k6/net/grpc.d.ts
CHANGED
|
@@ -89,6 +89,12 @@ export interface Params {
|
|
|
89
89
|
timeout?: string | number;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
export interface GrpcError {
|
|
93
|
+
code: number;
|
|
94
|
+
details: string[] | object[];
|
|
95
|
+
message: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
92
98
|
/**
|
|
93
99
|
* This module provides a gRPC client for Remote Procedure Calls over HTTP/2.
|
|
94
100
|
* https://grafana.com/docs/k6/latest/javascript-api/k6-net-grpc/
|
|
@@ -119,6 +125,58 @@ declare namespace grpc {
|
|
|
119
125
|
close(): void;
|
|
120
126
|
}
|
|
121
127
|
|
|
128
|
+
/**
|
|
129
|
+
* StreamEvent describes the possible events that can be emitted
|
|
130
|
+
* by a gRPC stream.
|
|
131
|
+
*/
|
|
132
|
+
type StreamEvent =
|
|
133
|
+
/**
|
|
134
|
+
* Event fired when data has been received from the server.
|
|
135
|
+
*/
|
|
136
|
+
| "data"
|
|
137
|
+
/**
|
|
138
|
+
* Event fired when a stream has been closed due to an error.
|
|
139
|
+
*/
|
|
140
|
+
| "error"
|
|
141
|
+
/**
|
|
142
|
+
* Event fired when the stream closes.
|
|
143
|
+
*/
|
|
144
|
+
| "end";
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Stream allows you to use streaming RPCs.
|
|
148
|
+
*/
|
|
149
|
+
class Stream {
|
|
150
|
+
/**
|
|
151
|
+
* The gRPC stream constructor, representing a single gRPC stream.
|
|
152
|
+
*
|
|
153
|
+
* @param client - the gRPC client to use, it must be connected.
|
|
154
|
+
* @param url - the RPC method to call.
|
|
155
|
+
* @param params - the parameters to use for the RPC call.
|
|
156
|
+
*/
|
|
157
|
+
constructor(client: Client, url: string, params?: Params);
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Set up handler functions for various events on the gRPC stream.
|
|
161
|
+
*
|
|
162
|
+
* @param event - the event to listen for
|
|
163
|
+
* @param listener - the callback to invoke when the event is emitted
|
|
164
|
+
*/
|
|
165
|
+
on(event: StreamEvent, listener: (data: object | GrpcError | undefined) => void): void;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Writes a request to the stream.
|
|
169
|
+
*
|
|
170
|
+
* @param request - the request (message) to send to the server
|
|
171
|
+
*/
|
|
172
|
+
write(request: object): void;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Signals to the server that the client has finished sending messages.
|
|
176
|
+
*/
|
|
177
|
+
end(): void;
|
|
178
|
+
}
|
|
179
|
+
|
|
122
180
|
const StatusOK: number;
|
|
123
181
|
const StatusCanceled: number;
|
|
124
182
|
const StatusUnknown: number;
|
k6/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/k6",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.1",
|
|
4
4
|
"description": "TypeScript definitions for k6",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/k6",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
},
|
|
66
66
|
"scripts": {},
|
|
67
67
|
"dependencies": {},
|
|
68
|
-
"typesPublisherContentHash": "
|
|
68
|
+
"typesPublisherContentHash": "38576bcdabaade63e1720f376727b3741430e6ab2b18f161782b50417e5b295f",
|
|
69
69
|
"typeScriptVersion": "4.6"
|
|
70
70
|
}
|