vasu-playwright-utils 0.11.4 → 0.12.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.
- package/dist/src/vasu-playwright-lib/utils/action-utils.d.ts +33 -7
- package/dist/src/vasu-playwright-lib/utils/action-utils.d.ts.map +1 -1
- package/dist/src/vasu-playwright-lib/utils/action-utils.js +72 -13
- package/dist/src/vasu-playwright-lib/utils/action-utils.js.map +1 -1
- package/dist/src/vasu-playwright-lib/utils/api-utils.d.ts +7 -0
- package/dist/src/vasu-playwright-lib/utils/api-utils.d.ts.map +1 -0
- package/dist/src/vasu-playwright-lib/utils/api-utils.js +34 -0
- package/dist/src/vasu-playwright-lib/utils/api-utils.js.map +1 -0
- package/dist/src/vasu-playwright-lib/utils/page-utils.d.ts +1 -0
- package/dist/src/vasu-playwright-lib/utils/page-utils.d.ts.map +1 -1
- package/dist/src/vasu-playwright-lib/utils/page-utils.js +5 -1
- package/dist/src/vasu-playwright-lib/utils/page-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/vasu-playwright-lib/utils/action-utils.ts +62 -11
- package/src/vasu-playwright-lib/utils/api-utils.ts +28 -0
- package/src/vasu-playwright-lib/utils/page-utils.ts +4 -0
|
@@ -34,6 +34,13 @@ export declare function fill(input: string | Locator, value: string, options?: F
|
|
|
34
34
|
* @param {FillOptions} options - The fill options.
|
|
35
35
|
*/
|
|
36
36
|
export declare function fillAndEnter(input: string | Locator, value: string, options?: FillOptions): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Fills a specified element with a value and press Tab.
|
|
39
|
+
* @param {string | Locator} input - The element to fill.
|
|
40
|
+
* @param {string} value - The value to fill the element with.
|
|
41
|
+
* @param {FillOptions} options - The fill options.
|
|
42
|
+
*/
|
|
43
|
+
export declare function fillAndTab(input: string | Locator, value: string, options?: FillOptions): Promise<void>;
|
|
37
44
|
/**
|
|
38
45
|
* Types a value into a specified element, simulating keystrokes character by character.
|
|
39
46
|
* @param {string | Locator} input - The element into which the value will be typed. This can be either a string representing the selector or a Locator object.
|
|
@@ -42,13 +49,20 @@ export declare function fillAndEnter(input: string | Locator, value: string, opt
|
|
|
42
49
|
*/
|
|
43
50
|
export declare function pressSequentially(input: string | Locator, value: string, options?: PressSequentiallyOptions): Promise<void>;
|
|
44
51
|
/**
|
|
45
|
-
* Simulates the action of pressing a key or a combination of keys on the
|
|
46
|
-
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc
|
|
47
|
-
* @param {string | Locator} input - The element on which the key press action will be performed. This can be either a string representing the selector or a Locator object.
|
|
52
|
+
* Simulates the action of pressing a key or a combination of keys on the page.
|
|
53
|
+
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc on the page..
|
|
48
54
|
* @param {string} key - The key or combination of keys to be pressed. For example, 'Enter', 'Tab', or 'Control+A'.
|
|
49
55
|
* @param {PressSequentiallyOptions} [options] - Optional configuration for the key press action. This can include options like delay between key presses.
|
|
50
56
|
*/
|
|
51
|
-
export declare function
|
|
57
|
+
export declare function pressPageKeyboard(key: string, options?: PressSequentiallyOptions): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Simulates the action of pressing a key or a combination of keys on a specified element.
|
|
60
|
+
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc on a specified element..
|
|
61
|
+
* @param {string} key - The key or combination of keys to be pressed. For example, 'Enter', 'Tab', or 'Control+A'.
|
|
62
|
+
* @param {string | Locator} input - The element on which the key press action will be performed. This can be either a string representing the selector or a Locator object.
|
|
63
|
+
* @param {PressSequentiallyOptions} [options] - Optional configuration for the key press action. This can include options like delay between key presses.
|
|
64
|
+
*/
|
|
65
|
+
export declare function pressLocatorKeyboard(input: string | Locator, key: string, options?: PressSequentiallyOptions): Promise<void>;
|
|
52
66
|
/**
|
|
53
67
|
* Clears the value of a specified element.
|
|
54
68
|
* @param {string | Locator} input - The element to clear.
|
|
@@ -173,9 +187,21 @@ export declare function scrollLocatorIntoView(input: string | Locator, options?:
|
|
|
173
187
|
* These functions include clicking on an element using JavaScript.
|
|
174
188
|
*/
|
|
175
189
|
/**
|
|
176
|
-
* Clicks on a specified element using JavaScript.
|
|
177
|
-
*
|
|
178
|
-
*
|
|
190
|
+
* Clicks on a specified element using JavaScript execution.
|
|
191
|
+
* This method is particularly useful in tests where the standard Playwright `click` function fails to trigger the click event properly.
|
|
192
|
+
* It directly invokes the `click` method on the HTMLElement, bypassing any potential issues with CSS, visibility, or DOM events.
|
|
193
|
+
* @param {string | Locator} input - The element to click on. Can be a string selector or a Playwright `Locator` object.
|
|
194
|
+
* @param {TimeoutOptions} options - Currently the timeout options for evaluate is not taking effect.
|
|
179
195
|
*/
|
|
180
196
|
export declare function clickByJS(input: string | Locator, options?: TimeoutOption): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Clears the value of an input element and triggers an input event.
|
|
199
|
+
* This method is particularly useful in tests where the standard clear or fill functions fail to clear the text.
|
|
200
|
+
* The `input` event is dispatched with the `bubbles` option set to true,
|
|
201
|
+
* allowing the event to bubble up through the DOM, which can trigger event
|
|
202
|
+
* listeners attached to parent elements, ensuring the application reacts as expected.
|
|
203
|
+
* @param {string | Locator} input - The element whose input value is to be cleared. Can be a string selector or a Playwright Locator.
|
|
204
|
+
* * @param {TimeoutOptions} options - Currently the timeout options for evaluate is not taking effect.
|
|
205
|
+
*/
|
|
206
|
+
export declare function clearByJS(input: string | Locator, options?: TimeoutOption): Promise<void>;
|
|
181
207
|
//# sourceMappingURL=action-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-utils.d.ts","sourceRoot":"","sources":["../../../../src/vasu-playwright-lib/utils/action-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAK3C;;;GAGG;AAEH;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1F;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"action-utils.d.ts","sourceRoot":"","sources":["../../../../src/vasu-playwright-lib/utils/action-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAK3C;;;GAGG;AAEH;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1F;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAerG;AAED;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvG;AAED;;;;;GAKG;AACH,wBAAs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@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clickByJS = exports.scrollLocatorIntoView = exports.uploadFiles = exports.downloadFile = exports.doubleClick = exports.dragAndDrop = exports.focus = exports.hover = exports.getAlertText = exports.dismissAlert = exports.acceptAlert = exports.selectByIndex = exports.selectByText = exports.selectByValues = exports.selectByValue = exports.uncheck = exports.check = exports.clear = exports.
|
|
3
|
+
exports.clearByJS = exports.clickByJS = exports.scrollLocatorIntoView = exports.uploadFiles = exports.downloadFile = exports.doubleClick = exports.dragAndDrop = exports.focus = exports.hover = exports.getAlertText = exports.dismissAlert = exports.acceptAlert = exports.selectByIndex = exports.selectByText = exports.selectByValues = exports.selectByValue = exports.uncheck = exports.check = exports.clear = exports.pressLocatorKeyboard = exports.pressPageKeyboard = exports.pressSequentially = exports.fillAndTab = exports.fillAndEnter = exports.fill = exports.clickAndNavigate = exports.click = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const page_utils_1 = require("./page-utils");
|
|
6
6
|
const timeouts_1 = require("../constants/timeouts");
|
|
@@ -30,10 +30,21 @@ exports.click = click;
|
|
|
30
30
|
function clickAndNavigate(input, options) {
|
|
31
31
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
const timeout = (options === null || options === void 0 ? void 0 : options.timeout) || timeouts_1.STANDARD_TIMEOUT;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
timeout: timeout
|
|
36
|
-
|
|
33
|
+
try {
|
|
34
|
+
// Adding 100 ms to the framenavigated timeout prioritizes locator error during click over navigation error, aiding in accurate debugging.
|
|
35
|
+
yield Promise.all([click(input, options), (0, page_utils_1.getPage)().waitForEvent('framenavigated', { timeout: timeout + 100 })]);
|
|
36
|
+
yield (0, page_utils_1.getPage)().waitForLoadState((options === null || options === void 0 ? void 0 : options.loadState) || (0, loadstate_1.getDefaultLoadState)(), {
|
|
37
|
+
timeout: timeout,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof Error && error.name === 'TimeoutError' && error.message.includes('framenavigated')) {
|
|
42
|
+
throw new Error(`After the click action, the page did not navigate to a new page\n ${error.message}`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
37
48
|
});
|
|
38
49
|
}
|
|
39
50
|
exports.clickAndNavigate = clickAndNavigate;
|
|
@@ -64,6 +75,20 @@ function fillAndEnter(input, value, options) {
|
|
|
64
75
|
});
|
|
65
76
|
}
|
|
66
77
|
exports.fillAndEnter = fillAndEnter;
|
|
78
|
+
/**
|
|
79
|
+
* Fills a specified element with a value and press Tab.
|
|
80
|
+
* @param {string | Locator} input - The element to fill.
|
|
81
|
+
* @param {string} value - The value to fill the element with.
|
|
82
|
+
* @param {FillOptions} options - The fill options.
|
|
83
|
+
*/
|
|
84
|
+
function fillAndTab(input, value, options) {
|
|
85
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const locator = (0, locator_utils_1.getLocator)(input, Object.assign(Object.assign({}, loadstate_1.defaultVisibleOnlyOption), options));
|
|
87
|
+
yield locator.fill(value, options);
|
|
88
|
+
yield locator.press('Tab');
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
exports.fillAndTab = fillAndTab;
|
|
67
92
|
/**
|
|
68
93
|
* Types a value into a specified element, simulating keystrokes character by character.
|
|
69
94
|
* @param {string | Locator} input - The element into which the value will be typed. This can be either a string representing the selector or a Locator object.
|
|
@@ -78,19 +103,31 @@ function pressSequentially(input, value, options) {
|
|
|
78
103
|
}
|
|
79
104
|
exports.pressSequentially = pressSequentially;
|
|
80
105
|
/**
|
|
81
|
-
* Simulates the action of pressing a key or a combination of keys on the
|
|
82
|
-
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc
|
|
83
|
-
* @param {string
|
|
106
|
+
* Simulates the action of pressing a key or a combination of keys on the page.
|
|
107
|
+
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc on the page..
|
|
108
|
+
* @param {string} key - The key or combination of keys to be pressed. For example, 'Enter', 'Tab', or 'Control+A'.
|
|
109
|
+
* @param {PressSequentiallyOptions} [options] - Optional configuration for the key press action. This can include options like delay between key presses.
|
|
110
|
+
*/
|
|
111
|
+
function pressPageKeyboard(key, options) {
|
|
112
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
yield (0, page_utils_1.getPage)().keyboard.press(key, options);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
exports.pressPageKeyboard = pressPageKeyboard;
|
|
117
|
+
/**
|
|
118
|
+
* Simulates the action of pressing a key or a combination of keys on a specified element.
|
|
119
|
+
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc on a specified element..
|
|
84
120
|
* @param {string} key - The key or combination of keys to be pressed. For example, 'Enter', 'Tab', or 'Control+A'.
|
|
121
|
+
* @param {string | Locator} input - The element on which the key press action will be performed. This can be either a string representing the selector or a Locator object.
|
|
85
122
|
* @param {PressSequentiallyOptions} [options] - Optional configuration for the key press action. This can include options like delay between key presses.
|
|
86
123
|
*/
|
|
87
|
-
function
|
|
124
|
+
function pressLocatorKeyboard(input, key, options) {
|
|
88
125
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
89
126
|
const locator = (0, locator_utils_1.getLocator)(input, Object.assign(Object.assign({}, loadstate_1.defaultVisibleOnlyOption), options));
|
|
90
127
|
yield locator.press(key, options);
|
|
91
128
|
});
|
|
92
129
|
}
|
|
93
|
-
exports.
|
|
130
|
+
exports.pressLocatorKeyboard = pressLocatorKeyboard;
|
|
94
131
|
/**
|
|
95
132
|
* Clears the value of a specified element.
|
|
96
133
|
* @param {string | Locator} input - The element to clear.
|
|
@@ -374,9 +411,11 @@ exports.scrollLocatorIntoView = scrollLocatorIntoView;
|
|
|
374
411
|
* These functions include clicking on an element using JavaScript.
|
|
375
412
|
*/
|
|
376
413
|
/**
|
|
377
|
-
* Clicks on a specified element using JavaScript.
|
|
378
|
-
*
|
|
379
|
-
*
|
|
414
|
+
* Clicks on a specified element using JavaScript execution.
|
|
415
|
+
* This method is particularly useful in tests where the standard Playwright `click` function fails to trigger the click event properly.
|
|
416
|
+
* It directly invokes the `click` method on the HTMLElement, bypassing any potential issues with CSS, visibility, or DOM events.
|
|
417
|
+
* @param {string | Locator} input - The element to click on. Can be a string selector or a Playwright `Locator` object.
|
|
418
|
+
* @param {TimeoutOptions} options - Currently the timeout options for evaluate is not taking effect.
|
|
380
419
|
*/
|
|
381
420
|
function clickByJS(input, options) {
|
|
382
421
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -385,4 +424,24 @@ function clickByJS(input, options) {
|
|
|
385
424
|
});
|
|
386
425
|
}
|
|
387
426
|
exports.clickByJS = clickByJS;
|
|
427
|
+
/**
|
|
428
|
+
* Clears the value of an input element and triggers an input event.
|
|
429
|
+
* This method is particularly useful in tests where the standard clear or fill functions fail to clear the text.
|
|
430
|
+
* The `input` event is dispatched with the `bubbles` option set to true,
|
|
431
|
+
* allowing the event to bubble up through the DOM, which can trigger event
|
|
432
|
+
* listeners attached to parent elements, ensuring the application reacts as expected.
|
|
433
|
+
* @param {string | Locator} input - The element whose input value is to be cleared. Can be a string selector or a Playwright Locator.
|
|
434
|
+
* * @param {TimeoutOptions} options - Currently the timeout options for evaluate is not taking effect.
|
|
435
|
+
*/
|
|
436
|
+
function clearByJS(input, options) {
|
|
437
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
438
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
439
|
+
yield locator.evaluate(element => {
|
|
440
|
+
element.value = '';
|
|
441
|
+
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
442
|
+
element.dispatchEvent(new Event('change', { bubbles: true }));
|
|
443
|
+
}, options);
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
exports.clearByJS = clearByJS;
|
|
388
447
|
//# sourceMappingURL=action-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-utils.js","sourceRoot":"","sources":["../../../../src/vasu-playwright-lib/utils/action-utils.ts"],"names":[],"mappings":";;;;AAKA,6CAAuC;AAgBvC,oDAAwE;AACxE,mDAA6C;AAC7C,sDAAuF;AAEvF;;;GAGG;AAEH;;;;GAIG;AACH,SAAsB,KAAK,CAAC,KAAuB,EAAE,OAAsB;;QACzE,MAAM,OAAO,GAAG,IAAA,0BAAU,EAAC,KAAK,kCAAO,oCAAwB,GAAK,OAAO,EAAG,CAAC;QAC/E,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CAAA;AAHD,sBAGC;AAED;;;;GAIG;AACH,SAAsB,gBAAgB,CAAC,KAAuB,EAAE,OAAsB;;QACpF,MAAM,OAAO,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,2BAAgB,CAAC;QACrD,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,IAAA,oBAAO,GAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"action-utils.js","sourceRoot":"","sources":["../../../../src/vasu-playwright-lib/utils/action-utils.ts"],"names":[],"mappings":";;;;AAKA,6CAAuC;AAgBvC,oDAAwE;AACxE,mDAA6C;AAC7C,sDAAuF;AAEvF;;;GAGG;AAEH;;;;GAIG;AACH,SAAsB,KAAK,CAAC,KAAuB,EAAE,OAAsB;;QACzE,MAAM,OAAO,GAAG,IAAA,0BAAU,EAAC,KAAK,kCAAO,oCAAwB,GAAK,OAAO,EAAG,CAAC;QAC/E,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CA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E,OAAO,CAAC,CAAC;IAC7C,CAAC;CAAA;AAHD,kCAGC;AAED;;;;GAIG;AACH,SAAsB,qBAAqB,CAAC,KAAuB,EAAE,OAAuB;;QAC1F,MAAM,OAAO,GAAG,IAAA,0BAAU,EAAC,KAAK,CAAC,CAAC;QAClC,MAAM,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CAAA;AAHD,sDAGC;AAED;;;GAGG;AAEH;;;;;;GAMG;AACH,SAAsB,SAAS,CAAC,KAAuB,EAAE,OAAuB;;QAC9E,MAAM,OAAO,GAAG,IAAA,0BAAU,EAAC,KAAK,CAAC,CAAC;QAClC,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAe,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;CAAA;AAHD,8BAGC;AAED;;;;;;;;GAQG;AACH,SAAsB,SAAS,CAAC,KAAuB,EAAE,OAAuB;;QAC9E,MAAM,OAAO,GAAG,IAAA,0BAAU,EAAC,KAAK,CAAC,CAAC;QAClC,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC9B,OAA4B,CAAC,KAAK,GAAG,EAAE,CAAC;YACzC,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAC7D,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAChE,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;CAAA;AAPD,8BAOC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { APIRequestContext, APIResponse } from '@playwright/test';
|
|
2
|
+
export declare function getAPIRequestContext(): APIRequestContext;
|
|
3
|
+
export declare function getRequest(url: string, options?: Parameters<APIRequestContext['get']>[1]): Promise<APIResponse>;
|
|
4
|
+
export declare function postRequest(url: string, options?: Parameters<APIRequestContext['post']>[1]): Promise<APIResponse>;
|
|
5
|
+
export declare function putRequest(url: string, options?: Parameters<APIRequestContext['put']>[1]): Promise<APIResponse>;
|
|
6
|
+
export declare function deleteRequest(url: string, options?: Parameters<APIRequestContext['delete']>[1]): Promise<APIResponse>;
|
|
7
|
+
//# sourceMappingURL=api-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-utils.d.ts","sourceRoot":"","sources":["../../../../src/vasu-playwright-lib/utils/api-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAElE,wBAAgB,oBAAoB,IAAI,iBAAiB,CAExD;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAErH;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GACjD,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAErH;AAED,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GACnD,OAAO,CAAC,WAAW,CAAC,CAEtB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteRequest = exports.putRequest = exports.postRequest = exports.getRequest = exports.getAPIRequestContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const page_utils_1 = require("./page-utils");
|
|
6
|
+
function getAPIRequestContext() {
|
|
7
|
+
return (0, page_utils_1.getPage)().request;
|
|
8
|
+
}
|
|
9
|
+
exports.getAPIRequestContext = getAPIRequestContext;
|
|
10
|
+
function getRequest(url, options) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
return yield getAPIRequestContext().get(url, options);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
exports.getRequest = getRequest;
|
|
16
|
+
function postRequest(url, options) {
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return yield getAPIRequestContext().post(url, options);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.postRequest = postRequest;
|
|
22
|
+
function putRequest(url, options) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return yield getAPIRequestContext().put(url, options);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.putRequest = putRequest;
|
|
28
|
+
function deleteRequest(url, options) {
|
|
29
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield getAPIRequestContext().delete(url, options);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.deleteRequest = deleteRequest;
|
|
34
|
+
//# sourceMappingURL=api-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-utils.js","sourceRoot":"","sources":["../../../../src/vasu-playwright-lib/utils/api-utils.ts"],"names":[],"mappings":";;;;AAAA,6CAAuC;AAGvC,SAAgB,oBAAoB;IAClC,OAAO,IAAA,oBAAO,GAAE,CAAC,OAAO,CAAC;AAC3B,CAAC;AAFD,oDAEC;AAED,SAAsB,UAAU,CAAC,GAAW,EAAE,OAAiD;;QAC7F,OAAO,MAAM,oBAAoB,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CAAA;AAFD,gCAEC;AAED,SAAsB,WAAW,CAC/B,GAAW,EACX,OAAkD;;QAElD,OAAO,MAAM,oBAAoB,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CAAA;AALD,kCAKC;AAED,SAAsB,UAAU,CAAC,GAAW,EAAE,OAAiD;;QAC7F,OAAO,MAAM,oBAAoB,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CAAA;AAFD,gCAEC;AAED,SAAsB,aAAa,CACjC,GAAW,EACX,OAAoD;;QAEpD,OAAO,MAAM,oBAAoB,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CAAA;AALD,sCAKC"}
|
|
@@ -11,6 +11,7 @@ import { GotoOptions, NavigationOptions, SwitchPageOptions } from '../types/opti
|
|
|
11
11
|
* @returns {Page} The current Page.
|
|
12
12
|
*/
|
|
13
13
|
export declare function getPage(): Page;
|
|
14
|
+
export declare function getContext(): BrowserContext;
|
|
14
15
|
/**
|
|
15
16
|
* Sets the current Page.
|
|
16
17
|
* @param {Page} pageInstance - The Page instance to set as the current Page.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-utils.d.ts","sourceRoot":"","sources":["../../../../src/vasu-playwright-lib/utils/page-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EAElB,MAAM,mCAAmC,CAAC;AAK3C;;;GAGG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAE9B;AAED;;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C,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrF;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3E;AAED;;;GAGG;AACH,wBAAsB,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;AAED;;;GAGG;AACH,wBAAsB,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGpD;AAED;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAOhF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAEzG"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* It also includes functions for switching between pages, closing pages, and reverting to the default page.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.saveStorageState = exports.getWindowSize = exports.wait = exports.goBack = exports.reloadPage = exports.waitForPageLoadState = exports.getURL = exports.gotoURL = exports.closePage = exports.switchToDefaultPage = exports.switchPage = exports.getAllPages = exports.setPage = exports.getPage = void 0;
|
|
9
|
+
exports.saveStorageState = exports.getWindowSize = exports.wait = exports.goBack = exports.reloadPage = exports.waitForPageLoadState = exports.getURL = exports.gotoURL = exports.closePage = exports.switchToDefaultPage = exports.switchPage = exports.getAllPages = exports.setPage = exports.getContext = exports.getPage = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const timeouts_1 = require("../constants/timeouts");
|
|
12
12
|
const test_1 = require("@playwright/test");
|
|
@@ -20,6 +20,10 @@ function getPage() {
|
|
|
20
20
|
return page;
|
|
21
21
|
}
|
|
22
22
|
exports.getPage = getPage;
|
|
23
|
+
function getContext() {
|
|
24
|
+
return page.context();
|
|
25
|
+
}
|
|
26
|
+
exports.getContext = getContext;
|
|
23
27
|
/**
|
|
24
28
|
* Sets the current Page.
|
|
25
29
|
* @param {Page} pageInstance - The Page instance to set as the current Page.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-utils.js","sourceRoot":"","sources":["../../../../src/vasu-playwright-lib/utils/page-utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,oDAAsD;AACtD,2CAA0E;AAO1E,4CAAmD;AAEnD,IAAI,IAAU,CAAC;AAEf;;;GAGG;AACH,SAAgB,OAAO;IACrB,OAAO,IAAI,CAAC;AACd,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,YAAkB;IACxC,IAAI,GAAG,YAAY,CAAC;AACtB,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,WAAW;IACzB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC;AAChC,CAAC;AAFD,kCAEC;AAED;;;;;GAKG;AACH,SAAsB,UAAU,CAAC,MAAc,EAAE,OAA2B;;QAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,wBAAa,CAAC;QACtD,kEAAkE;QAClE,OAAO,WAAW,EAAE,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,WAAW,EAAE,CAAC;YAC7E,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QACzD,CAAC;QAED,6CAA6C;QAC7C,IA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C,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACzF,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CAAA;AAHD,wBAGC;AAED;;;GAGG;AACH,SAAsB,IAAI,CAAC,EAAU;;QACnC,0DAA0D;QAC1D,MAAM,OAAO,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CAAA;AAHD,oBAGC;AAED;;;;GAIG;AACH,SAAsB,aAAa;;QACjC,OAAO,MAAM,OAAO,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE;YACnC,OAAO;gBACL,KAAK,EAAE,MAAM,CAAC,UAAU;gBACxB,MAAM,EAAE,MAAM,CAAC,WAAW;aAC3B,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AAPD,sCAOC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAsB,gBAAgB,CAAC,IAAa;;QAClD,OAAO,MAAM,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;CAAA;AAFD,4CAEC"}
|
package/package.json
CHANGED
|
@@ -45,10 +45,19 @@ export async function click(input: string | Locator, options?: ClickOptions): Pr
|
|
|
45
45
|
*/
|
|
46
46
|
export async function clickAndNavigate(input: string | Locator, options?: ClickOptions): Promise<void> {
|
|
47
47
|
const timeout = options?.timeout || STANDARD_TIMEOUT;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
timeout: timeout
|
|
51
|
-
|
|
48
|
+
try {
|
|
49
|
+
// Adding 100 ms to the framenavigated timeout prioritizes locator error during click over navigation error, aiding in accurate debugging.
|
|
50
|
+
await Promise.all([click(input, options), getPage().waitForEvent('framenavigated', { timeout: timeout + 100 })]);
|
|
51
|
+
await getPage().waitForLoadState(options?.loadState || getDefaultLoadState(), {
|
|
52
|
+
timeout: timeout,
|
|
53
|
+
});
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (error instanceof Error && error.name === 'TimeoutError' && error.message.includes('framenavigated')) {
|
|
56
|
+
throw new Error(`After the click action, the page did not navigate to a new page\n ${error.message}`);
|
|
57
|
+
} else {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
/**
|
|
@@ -74,6 +83,18 @@ export async function fillAndEnter(input: string | Locator, value: string, optio
|
|
|
74
83
|
await locator.press('Enter');
|
|
75
84
|
}
|
|
76
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Fills a specified element with a value and press Tab.
|
|
88
|
+
* @param {string | Locator} input - The element to fill.
|
|
89
|
+
* @param {string} value - The value to fill the element with.
|
|
90
|
+
* @param {FillOptions} options - The fill options.
|
|
91
|
+
*/
|
|
92
|
+
export async function fillAndTab(input: string | Locator, value: string, options?: FillOptions): Promise<void> {
|
|
93
|
+
const locator = getLocator(input, { ...defaultVisibleOnlyOption, ...options });
|
|
94
|
+
await locator.fill(value, options);
|
|
95
|
+
await locator.press('Tab');
|
|
96
|
+
}
|
|
97
|
+
|
|
77
98
|
/**
|
|
78
99
|
* Types a value into a specified element, simulating keystrokes character by character.
|
|
79
100
|
* @param {string | Locator} input - The element into which the value will be typed. This can be either a string representing the selector or a Locator object.
|
|
@@ -90,13 +111,23 @@ export async function pressSequentially(
|
|
|
90
111
|
}
|
|
91
112
|
|
|
92
113
|
/**
|
|
93
|
-
* Simulates the action of pressing a key or a combination of keys on the
|
|
94
|
-
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc
|
|
95
|
-
* @param {string | Locator} input - The element on which the key press action will be performed. This can be either a string representing the selector or a Locator object.
|
|
114
|
+
* Simulates the action of pressing a key or a combination of keys on the page.
|
|
115
|
+
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc on the page..
|
|
96
116
|
* @param {string} key - The key or combination of keys to be pressed. For example, 'Enter', 'Tab', or 'Control+A'.
|
|
97
117
|
* @param {PressSequentiallyOptions} [options] - Optional configuration for the key press action. This can include options like delay between key presses.
|
|
98
118
|
*/
|
|
99
|
-
export async function
|
|
119
|
+
export async function pressPageKeyboard(key: string, options?: PressSequentiallyOptions): Promise<void> {
|
|
120
|
+
await getPage().keyboard.press(key, options);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Simulates the action of pressing a key or a combination of keys on a specified element.
|
|
125
|
+
* This function is useful for scenarios where you need to simulate key presses like 'Enter', 'Tab', etc on a specified element..
|
|
126
|
+
* @param {string} key - The key or combination of keys to be pressed. For example, 'Enter', 'Tab', or 'Control+A'.
|
|
127
|
+
* @param {string | Locator} input - The element on which the key press action will be performed. This can be either a string representing the selector or a Locator object.
|
|
128
|
+
* @param {PressSequentiallyOptions} [options] - Optional configuration for the key press action. This can include options like delay between key presses.
|
|
129
|
+
*/
|
|
130
|
+
export async function pressLocatorKeyboard(
|
|
100
131
|
input: string | Locator,
|
|
101
132
|
key: string,
|
|
102
133
|
options?: PressSequentiallyOptions,
|
|
@@ -375,11 +406,31 @@ export async function scrollLocatorIntoView(input: string | Locator, options?: T
|
|
|
375
406
|
*/
|
|
376
407
|
|
|
377
408
|
/**
|
|
378
|
-
* Clicks on a specified element using JavaScript.
|
|
379
|
-
*
|
|
380
|
-
*
|
|
409
|
+
* Clicks on a specified element using JavaScript execution.
|
|
410
|
+
* This method is particularly useful in tests where the standard Playwright `click` function fails to trigger the click event properly.
|
|
411
|
+
* It directly invokes the `click` method on the HTMLElement, bypassing any potential issues with CSS, visibility, or DOM events.
|
|
412
|
+
* @param {string | Locator} input - The element to click on. Can be a string selector or a Playwright `Locator` object.
|
|
413
|
+
* @param {TimeoutOptions} options - Currently the timeout options for evaluate is not taking effect.
|
|
381
414
|
*/
|
|
382
415
|
export async function clickByJS(input: string | Locator, options?: TimeoutOption): Promise<void> {
|
|
383
416
|
const locator = getLocator(input);
|
|
384
417
|
await locator.evaluate((el: HTMLElement) => el.click(), options);
|
|
385
418
|
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Clears the value of an input element and triggers an input event.
|
|
422
|
+
* This method is particularly useful in tests where the standard clear or fill functions fail to clear the text.
|
|
423
|
+
* The `input` event is dispatched with the `bubbles` option set to true,
|
|
424
|
+
* allowing the event to bubble up through the DOM, which can trigger event
|
|
425
|
+
* listeners attached to parent elements, ensuring the application reacts as expected.
|
|
426
|
+
* @param {string | Locator} input - The element whose input value is to be cleared. Can be a string selector or a Playwright Locator.
|
|
427
|
+
* * @param {TimeoutOptions} options - Currently the timeout options for evaluate is not taking effect.
|
|
428
|
+
*/
|
|
429
|
+
export async function clearByJS(input: string | Locator, options?: TimeoutOption): Promise<void> {
|
|
430
|
+
const locator = getLocator(input);
|
|
431
|
+
await locator.evaluate(element => {
|
|
432
|
+
(element as HTMLInputElement).value = '';
|
|
433
|
+
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
434
|
+
element.dispatchEvent(new Event('change', { bubbles: true }));
|
|
435
|
+
}, options);
|
|
436
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getPage } from './page-utils';
|
|
2
|
+
import { APIRequestContext, APIResponse } from '@playwright/test';
|
|
3
|
+
|
|
4
|
+
export function getAPIRequestContext(): APIRequestContext {
|
|
5
|
+
return getPage().request;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export async function getRequest(url: string, options?: Parameters<APIRequestContext['get']>[1]): Promise<APIResponse> {
|
|
9
|
+
return await getAPIRequestContext().get(url, options);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function postRequest(
|
|
13
|
+
url: string,
|
|
14
|
+
options?: Parameters<APIRequestContext['post']>[1],
|
|
15
|
+
): Promise<APIResponse> {
|
|
16
|
+
return await getAPIRequestContext().post(url, options);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function putRequest(url: string, options?: Parameters<APIRequestContext['put']>[1]): Promise<APIResponse> {
|
|
20
|
+
return await getAPIRequestContext().put(url, options);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function deleteRequest(
|
|
24
|
+
url: string,
|
|
25
|
+
options?: Parameters<APIRequestContext['delete']>[1],
|
|
26
|
+
): Promise<APIResponse> {
|
|
27
|
+
return await getAPIRequestContext().delete(url, options);
|
|
28
|
+
}
|
|
@@ -25,6 +25,10 @@ export function getPage(): Page {
|
|
|
25
25
|
return page;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export function getContext(): BrowserContext {
|
|
29
|
+
return page.context();
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
/**
|
|
29
33
|
* Sets the current Page.
|
|
30
34
|
* @param {Page} pageInstance - The Page instance to set as the current Page.
|