@types/k6 0.44.2 → 0.44.3

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.
@@ -1,51 +1,51 @@
1
- import { PageFunction } from ".";
2
- import { ElementHandle } from "./element_handle";
1
+ import { PageFunction } from '.';
2
+ import { ElementHandle } from './element_handle';
3
3
 
4
4
  /**
5
5
  * JSHandle represents an in-page JavaScript object.
6
6
  */
7
7
  export class JSHandle<T = any> {
8
- /**
9
- * Returns either `null` or the object handle itself, if the object handle is
10
- * an instance of `ElementHandle`.
11
- * @returns The ElementHandle if available.
12
- */
13
- asElement(): ElementHandle | null;
8
+ /**
9
+ * Returns either `null` or the object handle itself, if the object handle is
10
+ * an instance of `ElementHandle`.
11
+ * @returns The ElementHandle if available.
12
+ */
13
+ asElement(): ElementHandle | null;
14
14
 
15
- /**
16
- * Stops referencing the element handle.
17
- */
18
- dispose(): void;
15
+ /**
16
+ * Stops referencing the element handle.
17
+ */
18
+ dispose(): void;
19
19
 
20
- /**
21
- * Evaluates the page function and returns its return value.
22
- * This method passes this handle as the first argument to the page function.
23
- * @param pageFunction The function to be evaluated.
24
- * @param args The arguments to pass to the page function.
25
- * @returns The return value of `pageFunction`.
26
- */
27
- evaluate<R, Arg>(pageFunction: PageFunction<R, Arg>, ...args: any): any;
20
+ /**
21
+ * Evaluates the page function and returns its return value.
22
+ * This method passes this handle as the first argument to the page function.
23
+ * @param pageFunction The function to be evaluated.
24
+ * @param args The arguments to pass to the page function.
25
+ * @returns The return value of `pageFunction`.
26
+ */
27
+ evaluate<R, Arg>(pageFunction: PageFunction<R, Arg>, ...args: any): any;
28
28
 
29
- /**
30
- * Evaluates the page function and returns a `JSHandle`.
31
- * This method passes this handle as the first argument to the page function.
32
- * Unlike `evaluate`, `evaluateHandle` returns the value as a `JSHandle`
33
- * @param pageFunction The function to be evaluated.
34
- * @param args The arguments to pass to the page function.
35
- * @returns A JSHandle of the return value of `pageFunction`.
36
- */
37
- evaluateHandle<R, Arg>(pageFunction: PageFunction<R, Arg>, ...args: any): JSHandle<R>;
29
+ /**
30
+ * Evaluates the page function and returns a `JSHandle`.
31
+ * This method passes this handle as the first argument to the page function.
32
+ * Unlike `evaluate`, `evaluateHandle` returns the value as a `JSHandle`
33
+ * @param pageFunction The function to be evaluated.
34
+ * @param args The arguments to pass to the page function.
35
+ * @returns A JSHandle of the return value of `pageFunction`.
36
+ */
37
+ evaluateHandle<R, Arg>(pageFunction: PageFunction<R, Arg>, ...args: any): JSHandle<R>;
38
38
 
39
- /**
40
- * Fethes a map with own property names of of the `JSHandle` with their values as
41
- * `JSHandle` instances.
42
- * @returns A map with property names as keys and `JSHandle` instances for the property values.
43
- */
44
- getProperties(): Map<string, JSHandle>;
39
+ /**
40
+ * Fethes a map with own property names of of the `JSHandle` with their values as
41
+ * `JSHandle` instances.
42
+ * @returns A map with property names as keys and `JSHandle` instances for the property values.
43
+ */
44
+ getProperties(): Map<string, JSHandle>;
45
45
 
46
- /**
47
- * Fetches a JSON representation of the object.
48
- * @returns A JSON representation of the object.
49
- */
50
- jsonValue(): any;
46
+ /**
47
+ * Fetches a JSON representation of the object.
48
+ * @returns A JSON representation of the object.
49
+ */
50
+ jsonValue(): any;
51
51
  }
@@ -2,42 +2,42 @@
2
2
  * Keyboard provides an API for managing a virtual keyboard.
3
3
  */
4
4
  export class Keyboard {
5
- /**
6
- * Sends a key down message to a session target.
7
- * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
8
- * @param key Name of key to press, such as `ArrowLeft`.
9
- */
10
- down(key: string): void;
5
+ /**
6
+ * Sends a key down message to a session target.
7
+ * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
8
+ * @param key Name of key to press, such as `ArrowLeft`.
9
+ */
10
+ down(key: string): void;
11
11
 
12
- /**
13
- * Dispatches an `input` event with the given `text`.
14
- * This method does not emit `keyDown`, `keyUp` or `keyPress` events.
15
- * @param text Event text.
16
- */
17
- insertText(text: string): void;
12
+ /**
13
+ * Dispatches an `input` event with the given `text`.
14
+ * This method does not emit `keyDown`, `keyUp` or `keyPress` events.
15
+ * @param text Event text.
16
+ */
17
+ insertText(text: string): void;
18
18
 
19
- /**
20
- * Sends a key press message to a session target.
21
- * A press message consists of successive key down and up messages.
22
- * @param key Sequence of keys to press.
23
- * @param options Specifies the typing options.
24
- */
25
- press(key: string, options?: { delay?: number }): void;
19
+ /**
20
+ * Sends a key press message to a session target.
21
+ * A press message consists of successive key down and up messages.
22
+ * @param key Sequence of keys to press.
23
+ * @param options Specifies the typing options.
24
+ */
25
+ press(key: string, options?: { delay?: number }): void;
26
26
 
27
- /**
28
- * Type sends a `press` message to a session target for each character in text.
29
- * It sends an insertText message if a character is not among
30
- * valid characters in the keyboard's layout.
31
- * Modifier keys `Shift`, `Control`, `Alt`, `Meta` are _not_ respected.
32
- * @param text A text to type into a focused element.
33
- * @param options Specifies the typing options.
34
- */
35
- type(text: string, options?: { delay?: number }): void;
27
+ /**
28
+ * Type sends a `press` message to a session target for each character in text.
29
+ * It sends an insertText message if a character is not among
30
+ * valid characters in the keyboard's layout.
31
+ * Modifier keys `Shift`, `Control`, `Alt`, `Meta` are _not_ respected.
32
+ * @param text A text to type into a focused element.
33
+ * @param options Specifies the typing options.
34
+ */
35
+ type(text: string, options?: { delay?: number }): void;
36
36
 
37
- /**
38
- * Sends a key up message to a session target.
39
- * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
40
- * @param key Name of key to release, such as `ArrowLeft`.
41
- */
42
- up(key: string): void;
37
+ /**
38
+ * Sends a key up message to a session target.
39
+ * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
40
+ * @param key Name of key to release, such as `ArrowLeft`.
41
+ */
42
+ up(key: string): void;
43
43
  }
@@ -10,7 +10,7 @@ import {
10
10
  ElementState,
11
11
  MouseMultiClickOptions,
12
12
  StrictnessOptions,
13
- } from "./";
13
+ } from './';
14
14
 
15
15
  /**
16
16
  * The Locator API makes it easier to work with dynamically changing elements.
@@ -23,169 +23,172 @@ import {
23
23
  * React, Vue, etc.
24
24
  */
25
25
  export class Locator {
26
- /**
27
- * Mouse click on the chosen element.
28
- * @param options Options to use.
29
- * @returns Promise which resolves when the element is successfully clicked.
30
- */
31
- click(options?: MouseMoveOptions & MouseMultiClickOptions & StrictnessOptions): Promise<void>;
32
-
33
- /**
34
- * Mouse double click on the chosen element.
35
- * @param options Options to use.
36
- */
37
- dblclick(options?: MouseMoveOptions & MouseMultiClickOptions & StrictnessOptions): void;
38
-
39
- /**
40
- * Use this method to select an `input type="checkbox"`.
41
- * @param options Options to use.
42
- */
43
- check(options?: ElementClickOptions & StrictnessOptions): void;
44
-
45
- /**
46
- * Use this method to unselect an `input type="checkbox"`.
47
- * @param options Options to use.
48
- */
49
- uncheck(options?: ElementClickOptions & StrictnessOptions): void;
50
-
51
- /**
52
- * Checks to see if the `input type="checkbox"` is selected or not.
53
- * @param options Options to use.
54
- * @returns `true` if the element is checked, `false` otherwise.
55
- */
56
- isChecked(options?: TimeoutOptions & StrictnessOptions): boolean;
57
-
58
- /**
59
- * Checks if the element is editable.
60
- * @param options Options to use.
61
- * @returns `true` if the element is editable, `false` otherwise.
62
- */
63
- isEditable(options?: TimeoutOptions): boolean;
64
-
65
- /**
66
- * Checks if the element is `enabled`.
67
- * @param options Options to use.
68
- * @returns `true` if the element is enabled, `false` otherwise.
69
- */
70
- isEnabled(options?: TimeoutOptions & StrictnessOptions): boolean;
71
-
72
- /**
73
- * Checks if the element is `disabled`.
74
- * @param options Options to use.
75
- * @returns `true` if the element is disabled, `false` otherwise.
76
- */
77
- isDisabled(options?: TimeoutOptions & StrictnessOptions): boolean;
78
-
79
- /**
80
- * Checks if the element is `visible`.
81
- * @param options Options to use.
82
- * @returns `true` if the element is visible, `false` otherwise.
83
- */
84
- isVisible(options?: TimeoutOptions & StrictnessOptions): boolean;
85
-
86
- /**
87
- * Checks if the element is `hidden`.
88
- * @param options Options to use.
89
- * @returns `true` if the element is hidden, `false` otherwise.
90
- */
91
- isHidden(options?: TimeoutOptions & StrictnessOptions): boolean;
92
-
93
- /**
94
- * Fill an `input`, `textarea` or `contenteditable` element with the provided value.
95
- * @param value Value to fill for the `input` or `textarea` element.
96
- * @param options Options to use.
97
- */
98
- fill(value: string, options?: ElementHandleOptions & StrictnessOptions): void;
99
-
100
- /**
101
- * Focuses the element using locator's selector.
102
- * @param options Options to use.
103
- */
104
- focus(options?: TimeoutOptions & StrictnessOptions): void;
105
-
106
- /**
107
- * Returns the element attribute value for the given attribute name.
108
- * @param name Attribute name to retrieve value for.
109
- * @param options Options to use.
110
- * @returns Attribute value.
111
- */
112
- getAttribute(name: string, options?: TimeoutOptions & StrictnessOptions): string|null;
113
-
114
- /**
115
- * Returns the `element.innerHTML`.
116
- * @param options Options to use.
117
- * @returns Element's innerHTML.
118
- */
119
- innerHTML(options?: TimeoutOptions & StrictnessOptions): string;
120
-
121
- /**
122
- * Returns the `element.innerText`.
123
- * @param options Options to use.
124
- * @returns Element's innerText.
125
- */
126
- innerText(options?: TimeoutOptions & StrictnessOptions): string;
127
-
128
- /**
129
- * Returns the `element.textContent`.
130
- * @param options Options to use.
131
- * @returns Element's textContent.
132
- */
133
- textContent(options?: TimeoutOptions & StrictnessOptions): string;
134
-
135
- /**
136
- * Returns `input.value` for the selected `input`, `textarea` or `select` element.
137
- * @param options Options to use.
138
- * @returns The input value of the element.
139
- */
140
- inputValue(options?: TimeoutOptions & StrictnessOptions): string;
141
-
142
- /**
143
- * Select one or more options which match the values. If the select has the multiple attribute, all matching options are selected,
144
- * otherwise only the first option matching one of the passed options is selected.
145
- * @param values Values of options to select.
146
- * @param options Options to use.
147
- * @returns List of selected options.
148
- */
149
- selectOption(values: string|string[]|{ value?: string; label?: string; index?: number }, options?: ElementHandleOptions & StrictnessOptions): string[];
150
-
151
- /**
152
- * Press a single key on the keyboard or a combination of keys.
153
- * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
154
- * @param key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
155
- * @param options Keyboard press options.
156
- */
157
- press(key: string, options?: KeyboardPressOptions): void;
158
-
159
- /**
160
- * Type a text into the input field.
161
- * @param text Text to type into the input field.
162
- * @param options Typing options.
163
- */
164
- type(text: string, options?: KeyboardPressOptions): void;
165
-
166
- /**
167
- * Hover over the element.
168
- * @param options Options to use.
169
- */
170
- hover(options?: MouseMoveOptions & StrictnessOptions): void;
171
-
172
- /**
173
- * Tap on the chosen element.
174
- * @param options Options to use.
175
- */
176
- tap(options?: MouseMoveOptions & StrictnessOptions): void;
177
-
178
- /**
179
- * Dispatches HTML DOM event types e.g. `click`.
180
- * @param type DOM event type.
181
- * @param eventInit Event-specific properties.
182
- * @param options Options to use.
183
- */
184
- dispatchEvent(type: string, eventInit?: EvaluationArgument, options?: TimeoutOptions & StrictnessOptions): void;
185
-
186
- /**
187
- * Wait for the element to be in a particular state e.g. `visible`.
188
- * @param options Wait options.
189
- */
190
- waitFor(options?: { state?: ElementState } & TimeoutOptions & StrictnessOptions): void;
26
+ /**
27
+ * Mouse click on the chosen element.
28
+ * @param options Options to use.
29
+ * @returns Promise which resolves when the element is successfully clicked.
30
+ */
31
+ click(options?: MouseMoveOptions & MouseMultiClickOptions & StrictnessOptions): Promise<void>;
32
+
33
+ /**
34
+ * Mouse double click on the chosen element.
35
+ * @param options Options to use.
36
+ */
37
+ dblclick(options?: MouseMoveOptions & MouseMultiClickOptions & StrictnessOptions): void;
38
+
39
+ /**
40
+ * Use this method to select an `input type="checkbox"`.
41
+ * @param options Options to use.
42
+ */
43
+ check(options?: ElementClickOptions & StrictnessOptions): void;
44
+
45
+ /**
46
+ * Use this method to unselect an `input type="checkbox"`.
47
+ * @param options Options to use.
48
+ */
49
+ uncheck(options?: ElementClickOptions & StrictnessOptions): void;
50
+
51
+ /**
52
+ * Checks to see if the `input type="checkbox"` is selected or not.
53
+ * @param options Options to use.
54
+ * @returns `true` if the element is checked, `false` otherwise.
55
+ */
56
+ isChecked(options?: TimeoutOptions & StrictnessOptions): boolean;
57
+
58
+ /**
59
+ * Checks if the element is editable.
60
+ * @param options Options to use.
61
+ * @returns `true` if the element is editable, `false` otherwise.
62
+ */
63
+ isEditable(options?: TimeoutOptions): boolean;
64
+
65
+ /**
66
+ * Checks if the element is `enabled`.
67
+ * @param options Options to use.
68
+ * @returns `true` if the element is enabled, `false` otherwise.
69
+ */
70
+ isEnabled(options?: TimeoutOptions & StrictnessOptions): boolean;
71
+
72
+ /**
73
+ * Checks if the element is `disabled`.
74
+ * @param options Options to use.
75
+ * @returns `true` if the element is disabled, `false` otherwise.
76
+ */
77
+ isDisabled(options?: TimeoutOptions & StrictnessOptions): boolean;
78
+
79
+ /**
80
+ * Checks if the element is `visible`.
81
+ * @param options Options to use.
82
+ * @returns `true` if the element is visible, `false` otherwise.
83
+ */
84
+ isVisible(options?: TimeoutOptions & StrictnessOptions): boolean;
85
+
86
+ /**
87
+ * Checks if the element is `hidden`.
88
+ * @param options Options to use.
89
+ * @returns `true` if the element is hidden, `false` otherwise.
90
+ */
91
+ isHidden(options?: TimeoutOptions & StrictnessOptions): boolean;
92
+
93
+ /**
94
+ * Fill an `input`, `textarea` or `contenteditable` element with the provided value.
95
+ * @param value Value to fill for the `input` or `textarea` element.
96
+ * @param options Options to use.
97
+ */
98
+ fill(value: string, options?: ElementHandleOptions & StrictnessOptions): void;
99
+
100
+ /**
101
+ * Focuses the element using locator's selector.
102
+ * @param options Options to use.
103
+ */
104
+ focus(options?: TimeoutOptions & StrictnessOptions): void;
105
+
106
+ /**
107
+ * Returns the element attribute value for the given attribute name.
108
+ * @param name Attribute name to retrieve value for.
109
+ * @param options Options to use.
110
+ * @returns Attribute value.
111
+ */
112
+ getAttribute(name: string, options?: TimeoutOptions & StrictnessOptions): string | null;
113
+
114
+ /**
115
+ * Returns the `element.innerHTML`.
116
+ * @param options Options to use.
117
+ * @returns Element's innerHTML.
118
+ */
119
+ innerHTML(options?: TimeoutOptions & StrictnessOptions): string;
120
+
121
+ /**
122
+ * Returns the `element.innerText`.
123
+ * @param options Options to use.
124
+ * @returns Element's innerText.
125
+ */
126
+ innerText(options?: TimeoutOptions & StrictnessOptions): string;
127
+
128
+ /**
129
+ * Returns the `element.textContent`.
130
+ * @param options Options to use.
131
+ * @returns Element's textContent.
132
+ */
133
+ textContent(options?: TimeoutOptions & StrictnessOptions): string;
134
+
135
+ /**
136
+ * Returns `input.value` for the selected `input`, `textarea` or `select` element.
137
+ * @param options Options to use.
138
+ * @returns The input value of the element.
139
+ */
140
+ inputValue(options?: TimeoutOptions & StrictnessOptions): string;
141
+
142
+ /**
143
+ * Select one or more options which match the values. If the select has the multiple attribute, all matching options are selected,
144
+ * otherwise only the first option matching one of the passed options is selected.
145
+ * @param values Values of options to select.
146
+ * @param options Options to use.
147
+ * @returns List of selected options.
148
+ */
149
+ selectOption(
150
+ values: string | string[] | { value?: string; label?: string; index?: number },
151
+ options?: ElementHandleOptions & StrictnessOptions,
152
+ ): string[];
153
+
154
+ /**
155
+ * Press a single key on the keyboard or a combination of keys.
156
+ * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
157
+ * @param key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
158
+ * @param options Keyboard press options.
159
+ */
160
+ press(key: string, options?: KeyboardPressOptions): void;
161
+
162
+ /**
163
+ * Type a text into the input field.
164
+ * @param text Text to type into the input field.
165
+ * @param options Typing options.
166
+ */
167
+ type(text: string, options?: KeyboardPressOptions): void;
168
+
169
+ /**
170
+ * Hover over the element.
171
+ * @param options Options to use.
172
+ */
173
+ hover(options?: MouseMoveOptions & StrictnessOptions): void;
174
+
175
+ /**
176
+ * Tap on the chosen element.
177
+ * @param options Options to use.
178
+ */
179
+ tap(options?: MouseMoveOptions & StrictnessOptions): void;
180
+
181
+ /**
182
+ * Dispatches HTML DOM event types e.g. `click`.
183
+ * @param type DOM event type.
184
+ * @param eventInit Event-specific properties.
185
+ * @param options Options to use.
186
+ */
187
+ dispatchEvent(type: string, eventInit?: EvaluationArgument, options?: TimeoutOptions & StrictnessOptions): void;
188
+
189
+ /**
190
+ * Wait for the element to be in a particular state e.g. `visible`.
191
+ * @param options Wait options.
192
+ */
193
+ waitFor(options?: { state?: ElementState } & TimeoutOptions & StrictnessOptions): void;
191
194
  }
@@ -1,43 +1,43 @@
1
- import { MouseClickOptions, MouseDownUpOptions, MouseMultiClickOptions } from "./";
1
+ import { MouseClickOptions, MouseDownUpOptions, MouseMultiClickOptions } from './';
2
2
 
3
3
  /**
4
4
  * Mouse provides an API for managing a virtual mouse.
5
5
  */
6
6
  export class Mouse {
7
- /**
8
- * Shortcut for `mouse.move(x, y)`, `mouse.down()`, `mouse.up()`.
9
- * @param x The x position.
10
- * @param y The y position.
11
- * @param options The click options.
12
- */
13
- click(x: number, y: number, options?: MouseMultiClickOptions): void;
7
+ /**
8
+ * Shortcut for `mouse.move(x, y)`, `mouse.down()`, `mouse.up()`.
9
+ * @param x The x position.
10
+ * @param y The y position.
11
+ * @param options The click options.
12
+ */
13
+ click(x: number, y: number, options?: MouseMultiClickOptions): void;
14
14
 
15
- /**
16
- * Shortcut for `mouse.move(x, y)`, `mouse.down()`, `mouse.up()`, `mouse.down()`,
17
- * `mouse.up()`.
18
- * @param x The x position.
19
- * @param y The y position.
20
- * @param options The click options.
21
- */
22
- dblclick(x: number, y: number, options?: MouseClickOptions): void;
15
+ /**
16
+ * Shortcut for `mouse.move(x, y)`, `mouse.down()`, `mouse.up()`, `mouse.down()`,
17
+ * `mouse.up()`.
18
+ * @param x The x position.
19
+ * @param y The y position.
20
+ * @param options The click options.
21
+ */
22
+ dblclick(x: number, y: number, options?: MouseClickOptions): void;
23
23
 
24
- /**
25
- * Dispatches a `mousedown` event.
26
- * @param options The mouse down options.
27
- */
28
- down(options?: MouseDownUpOptions): void;
24
+ /**
25
+ * Dispatches a `mousedown` event.
26
+ * @param options The mouse down options.
27
+ */
28
+ down(options?: MouseDownUpOptions): void;
29
29
 
30
- /**
31
- * Dispatches a `mousemove` event.
32
- * @param x The x position.
33
- * @param y The y position.
34
- * @param options The mouse move options.
35
- */
36
- move(x: number, y: number, options?: { steps?: number }): void;
30
+ /**
31
+ * Dispatches a `mousemove` event.
32
+ * @param x The x position.
33
+ * @param y The y position.
34
+ * @param options The mouse move options.
35
+ */
36
+ move(x: number, y: number, options?: { steps?: number }): void;
37
37
 
38
- /**
39
- * Dispatches a `mouseup` event.
40
- * @param options The mouse up options.
41
- */
42
- up(options?: MouseDownUpOptions): void;
38
+ /**
39
+ * Dispatches a `mouseup` event.
40
+ * @param options The mouse up options.
41
+ */
42
+ up(options?: MouseDownUpOptions): void;
43
43
  }