vasu-playwright-utils 0.1.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/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/vasu-playwright-lib/constants/index.d.ts +3 -0
- package/dist/vasu-playwright-lib/constants/index.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/constants/index.js +6 -0
- package/dist/vasu-playwright-lib/constants/index.js.map +1 -0
- package/dist/vasu-playwright-lib/constants/loadstate.d.ts +17 -0
- package/dist/vasu-playwright-lib/constants/loadstate.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/constants/loadstate.js +19 -0
- package/dist/vasu-playwright-lib/constants/loadstate.js.map +1 -0
- package/dist/vasu-playwright-lib/constants/timeouts.d.ts +44 -0
- package/dist/vasu-playwright-lib/constants/timeouts.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/constants/timeouts.js +47 -0
- package/dist/vasu-playwright-lib/constants/timeouts.js.map +1 -0
- package/dist/vasu-playwright-lib/index.d.ts +4 -0
- package/dist/vasu-playwright-lib/index.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/index.js +7 -0
- package/dist/vasu-playwright-lib/index.js.map +1 -0
- package/dist/vasu-playwright-lib/types/index.d.ts +2 -0
- package/dist/vasu-playwright-lib/types/index.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/types/index.js +5 -0
- package/dist/vasu-playwright-lib/types/index.js.map +1 -0
- package/dist/vasu-playwright-lib/types/optional-parameter-types.d.ts +59 -0
- package/dist/vasu-playwright-lib/types/optional-parameter-types.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/types/optional-parameter-types.js +7 -0
- package/dist/vasu-playwright-lib/types/optional-parameter-types.js.map +1 -0
- package/dist/vasu-playwright-lib/utils/action-utils.d.ts +199 -0
- package/dist/vasu-playwright-lib/utils/action-utils.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/utils/action-utils.js +406 -0
- package/dist/vasu-playwright-lib/utils/action-utils.js.map +1 -0
- package/dist/vasu-playwright-lib/utils/element-utils.d.ts +100 -0
- package/dist/vasu-playwright-lib/utils/element-utils.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/utils/element-utils.js +232 -0
- package/dist/vasu-playwright-lib/utils/element-utils.js.map +1 -0
- package/dist/vasu-playwright-lib/utils/index.d.ts +5 -0
- package/dist/vasu-playwright-lib/utils/index.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/utils/index.js +13 -0
- package/dist/vasu-playwright-lib/utils/index.js.map +1 -0
- package/dist/vasu-playwright-lib/utils/locator-utils.d.ts +77 -0
- package/dist/vasu-playwright-lib/utils/locator-utils.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/utils/locator-utils.js +113 -0
- package/dist/vasu-playwright-lib/utils/locator-utils.js.map +1 -0
- package/dist/vasu-playwright-lib/utils/page-utils.d.ts +36 -0
- package/dist/vasu-playwright-lib/utils/page-utils.d.ts.map +1 -0
- package/dist/vasu-playwright-lib/utils/page-utils.js +84 -0
- package/dist/vasu-playwright-lib/utils/page-utils.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
"use strict";
|
|
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.type = exports.fillAndEnter = exports.fill = exports.clickAndNavigate = exports.click = exports.wait = exports.goBack = exports.reloadPage = exports.waitForPageLoadState = exports.gotoURL = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const page_utils_1 = require("./page-utils");
|
|
6
|
+
const timeouts_1 = require("../constants/timeouts");
|
|
7
|
+
const locator_utils_1 = require("./locator-utils");
|
|
8
|
+
const loadstate_1 = require("../constants/loadstate");
|
|
9
|
+
/**
|
|
10
|
+
* 1. Navigations: This section contains functions for navigating within a web page or between web pages.
|
|
11
|
+
* These functions include going to a URL, waiting for a page to load, reloading a page, and going back to a previous page.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Navigates to the specified URL.
|
|
15
|
+
* @param {string} path - The URL to navigate to.
|
|
16
|
+
* @param {GotoOptions} options - The navigation options.
|
|
17
|
+
* @returns {Promise<null | Response>} - The navigation response or null if no response.
|
|
18
|
+
*/
|
|
19
|
+
function gotoURL(path, options = { waitUntil: loadstate_1.LOADSTATE }) {
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
return yield (0, page_utils_1.getPage)().goto(path, options);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.gotoURL = gotoURL;
|
|
25
|
+
/**
|
|
26
|
+
* Waits for a specific page load state.
|
|
27
|
+
* @param {NavigationOptions} options - The navigation options.
|
|
28
|
+
*/
|
|
29
|
+
function waitForPageLoadState(options) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
let waitUntil = loadstate_1.LOADSTATE;
|
|
32
|
+
if ((options === null || options === void 0 ? void 0 : options.waitUntil) && options.waitUntil !== 'commit') {
|
|
33
|
+
waitUntil = options.waitUntil;
|
|
34
|
+
}
|
|
35
|
+
yield (0, page_utils_1.getPage)().waitForLoadState(waitUntil);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.waitForPageLoadState = waitForPageLoadState;
|
|
39
|
+
/**
|
|
40
|
+
* Reloads the current page.
|
|
41
|
+
* @param {NavigationOptions} options - The navigation options.
|
|
42
|
+
*/
|
|
43
|
+
function reloadPage(options) {
|
|
44
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
yield Promise.all([(0, page_utils_1.getPage)().reload(options), (0, page_utils_1.getPage)().waitForEvent('framenavigated')]);
|
|
46
|
+
yield waitForPageLoadState(options);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.reloadPage = reloadPage;
|
|
50
|
+
/**
|
|
51
|
+
* Navigates back to the previous page.
|
|
52
|
+
* @param {NavigationOptions} options - The navigation options.
|
|
53
|
+
*/
|
|
54
|
+
function goBack(options) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
yield Promise.all([(0, page_utils_1.getPage)().goBack(options), (0, page_utils_1.getPage)().waitForEvent('framenavigated')]);
|
|
57
|
+
yield waitForPageLoadState(options);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
exports.goBack = goBack;
|
|
61
|
+
/**
|
|
62
|
+
* Waits for a specified amount of time.
|
|
63
|
+
* @param {number} ms - The amount of time to wait in milliseconds.
|
|
64
|
+
*/
|
|
65
|
+
function wait(ms) {
|
|
66
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
68
|
+
yield (0, page_utils_1.getPage)().waitForTimeout(ms);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
exports.wait = wait;
|
|
72
|
+
/**
|
|
73
|
+
* 2. Actions: This section contains functions for interacting with elements on a web page.
|
|
74
|
+
* These functions include clicking, filling input fields, typing, clearing input fields, checking and unchecking checkboxes, selecting options in dropdowns, and more.
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* Clicks on a specified element.
|
|
78
|
+
* @param {string | Locator} input - The element to click on.
|
|
79
|
+
* @param {ClickOptions} options - The click options.
|
|
80
|
+
*/
|
|
81
|
+
function click(input, options) {
|
|
82
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
84
|
+
yield locator.click(options);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.click = click;
|
|
88
|
+
/**
|
|
89
|
+
* Clicks on a specified element and waits for navigation.
|
|
90
|
+
* @param {string | Locator} input - The element to click on.
|
|
91
|
+
* @param {ClickOptions} options - The click options.
|
|
92
|
+
*/
|
|
93
|
+
function clickAndNavigate(input, options) {
|
|
94
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const timeout = (options === null || options === void 0 ? void 0 : options.timeout) || timeouts_1.STANDARD_TIMEOUT;
|
|
96
|
+
yield Promise.all([click(input, options), (0, page_utils_1.getPage)().waitForEvent('framenavigated', { timeout: timeout })]);
|
|
97
|
+
yield (0, page_utils_1.getPage)().waitForLoadState((options === null || options === void 0 ? void 0 : options.loadState) || loadstate_1.LOADSTATE, {
|
|
98
|
+
timeout: timeout,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
exports.clickAndNavigate = clickAndNavigate;
|
|
103
|
+
/**
|
|
104
|
+
* Fills a specified element with a value.
|
|
105
|
+
* @param {string | Locator} input - The element to fill.
|
|
106
|
+
* @param {string} value - The value to fill the element with.
|
|
107
|
+
* @param {FillOptions} options - The fill options.
|
|
108
|
+
*/
|
|
109
|
+
function fill(input, value, options) {
|
|
110
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
112
|
+
yield locator.fill(value, options);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
exports.fill = fill;
|
|
116
|
+
/**
|
|
117
|
+
* Fills a specified element with a value and press Enter.
|
|
118
|
+
* @param {string | Locator} input - The element to fill.
|
|
119
|
+
* @param {string} value - The value to fill the element with.
|
|
120
|
+
* @param {FillOptions} options - The fill options.
|
|
121
|
+
*/
|
|
122
|
+
function fillAndEnter(input, value, options) {
|
|
123
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
125
|
+
yield locator.fill(value, options);
|
|
126
|
+
yield locator.press('Enter');
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
exports.fillAndEnter = fillAndEnter;
|
|
130
|
+
/**
|
|
131
|
+
* Types a value into a specified element.
|
|
132
|
+
* @param {string | Locator} input - The element to type into.
|
|
133
|
+
* @param {string} value - The value to type.
|
|
134
|
+
* @param {TypeOptions} options - The type options.
|
|
135
|
+
*/
|
|
136
|
+
function type(input, value, options) {
|
|
137
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
139
|
+
yield locator.type(value, options);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
exports.type = type;
|
|
143
|
+
/**
|
|
144
|
+
* Clears the value of a specified element.
|
|
145
|
+
* @param {string | Locator} input - The element to clear.
|
|
146
|
+
* @param {ClearOptions} options - The clear options.
|
|
147
|
+
*/
|
|
148
|
+
function clear(input, options) {
|
|
149
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
151
|
+
yield locator.clear(options);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
exports.clear = clear;
|
|
155
|
+
/**
|
|
156
|
+
* Checks a specified checkbox or radio button.
|
|
157
|
+
* @param {string | Locator} input - The checkbox or radio button to check.
|
|
158
|
+
* @param {CheckOptions} options - The check options.
|
|
159
|
+
*/
|
|
160
|
+
function check(input, options) {
|
|
161
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
163
|
+
yield locator.check(options);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
exports.check = check;
|
|
167
|
+
/**
|
|
168
|
+
* Unchecks a specified checkbox or radio button.
|
|
169
|
+
* @param {string | Locator} input - The checkbox or radio button to uncheck.
|
|
170
|
+
* @param {CheckOptions} options - The uncheck options.
|
|
171
|
+
*/
|
|
172
|
+
function uncheck(input, options) {
|
|
173
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
175
|
+
yield locator.uncheck(options);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
exports.uncheck = uncheck;
|
|
179
|
+
/**
|
|
180
|
+
* Selects an option in a dropdown by its value.
|
|
181
|
+
* @param {string | Locator} input - The dropdown to select an option in.
|
|
182
|
+
* @param {string} value - The value of the option to select.
|
|
183
|
+
* @param {SelectOptions} options - The select options.
|
|
184
|
+
*/
|
|
185
|
+
function selectByValue(input, value, options) {
|
|
186
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
188
|
+
yield locator.selectOption({ value: value }, options);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
exports.selectByValue = selectByValue;
|
|
192
|
+
/**
|
|
193
|
+
* Selects options in a dropdown by their values (multi select).
|
|
194
|
+
* @param {string | Locator} input - The dropdown to select options in.
|
|
195
|
+
* @param {Array<string>} value - The values of the options to select.
|
|
196
|
+
* @param {SelectOptions} options - The select options.
|
|
197
|
+
*/
|
|
198
|
+
function selectByValues(input, value, options) {
|
|
199
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
201
|
+
yield locator.selectOption(value, options);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
exports.selectByValues = selectByValues;
|
|
205
|
+
/**
|
|
206
|
+
* Selects an option in a dropdown by its text.
|
|
207
|
+
* @param {string | Locator} input - The dropdown to select an option in.
|
|
208
|
+
* @param {string} text - The text of the option to select.
|
|
209
|
+
* @param {SelectOptions} options - The select options.
|
|
210
|
+
*/
|
|
211
|
+
function selectByText(input, text, options) {
|
|
212
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
214
|
+
yield locator.selectOption({ label: text }, options);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
exports.selectByText = selectByText;
|
|
218
|
+
/**
|
|
219
|
+
* Selects an option in a dropdown by its index.
|
|
220
|
+
* @param {string | Locator} input - The dropdown to select an option in.
|
|
221
|
+
* @param {number} index - The index of the option to select.
|
|
222
|
+
* @param {SelectOptions} options - The select options.
|
|
223
|
+
*/
|
|
224
|
+
function selectByIndex(input, index, options) {
|
|
225
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
227
|
+
yield locator.selectOption({ index: index }, options);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
exports.selectByIndex = selectByIndex;
|
|
231
|
+
/**
|
|
232
|
+
* 3. Alerts: This section contains functions for handling alert dialogs.
|
|
233
|
+
* These functions include accepting and dismissing alerts, and getting the text of an alert.
|
|
234
|
+
* Note: These functions currently have some repetition and could be optimized by applying the DRY (Don't Repeat Yourself) principle.
|
|
235
|
+
*/
|
|
236
|
+
/**
|
|
237
|
+
* Accepts an alert dialog.
|
|
238
|
+
* @param {string | Locator} input - The element to click to trigger the alert.
|
|
239
|
+
* @param {string} promptText - The text to enter into a prompt dialog.
|
|
240
|
+
* @returns {Promise<string>} - The message of the dialog.
|
|
241
|
+
*/
|
|
242
|
+
function acceptAlert(input, promptText) {
|
|
243
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
244
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
245
|
+
let dialogMessage = '';
|
|
246
|
+
(0, page_utils_1.getPage)().once('dialog', dialog => {
|
|
247
|
+
dialogMessage = dialog.message();
|
|
248
|
+
dialog.accept(promptText).catch(e => console.error('Error accepting dialog:', e));
|
|
249
|
+
});
|
|
250
|
+
yield locator.click();
|
|
251
|
+
// temporary fix to alerts - Need to be fixed
|
|
252
|
+
// await getPage().waitForEvent('dialog');
|
|
253
|
+
return dialogMessage;
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
exports.acceptAlert = acceptAlert;
|
|
257
|
+
/**
|
|
258
|
+
* Dismisses an alert dialog.
|
|
259
|
+
* @param {string | Locator} input - The element to click to trigger the alert.
|
|
260
|
+
* @returns {Promise<string>} - The message of the dialog.
|
|
261
|
+
*/
|
|
262
|
+
function dismissAlert(input) {
|
|
263
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
265
|
+
let dialogMessage = '';
|
|
266
|
+
(0, page_utils_1.getPage)().once('dialog', dialog => {
|
|
267
|
+
dialogMessage = dialog.message();
|
|
268
|
+
dialog.dismiss().catch(e => console.error('Error dismissing dialog:', e));
|
|
269
|
+
});
|
|
270
|
+
yield locator.click({ noWaitAfter: true });
|
|
271
|
+
// temporary fix for alerts - Need to be fixed
|
|
272
|
+
// await getPage().waitForEvent('dialog');
|
|
273
|
+
return dialogMessage;
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
exports.dismissAlert = dismissAlert;
|
|
277
|
+
/**
|
|
278
|
+
* Gets the text of an alert dialog.
|
|
279
|
+
* @param {string | Locator} input - The element to click to trigger the alert.
|
|
280
|
+
* @returns {Promise<string>} - The message of the dialog.
|
|
281
|
+
*/
|
|
282
|
+
function getAlertText(input) {
|
|
283
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
285
|
+
let dialogMessage = '';
|
|
286
|
+
const dialogHandler = (dialog) => {
|
|
287
|
+
dialogMessage = dialog.message();
|
|
288
|
+
};
|
|
289
|
+
(0, page_utils_1.getPage)().once('dialog', dialogHandler);
|
|
290
|
+
yield locator.click();
|
|
291
|
+
yield (0, page_utils_1.getPage)().waitForEvent('dialog');
|
|
292
|
+
(0, page_utils_1.getPage)().off('dialog', dialogHandler);
|
|
293
|
+
return dialogMessage;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
exports.getAlertText = getAlertText;
|
|
297
|
+
/**
|
|
298
|
+
* Hovers over a specified element.
|
|
299
|
+
* @param {string | Locator} input - The element to hover over.
|
|
300
|
+
* @param {HoverOptions} options - The hover options.
|
|
301
|
+
*/
|
|
302
|
+
function hover(input, options) {
|
|
303
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
304
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
305
|
+
yield locator.hover(options);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
exports.hover = hover;
|
|
309
|
+
/**
|
|
310
|
+
* Focuses on a specified element.
|
|
311
|
+
* @param {string | Locator} input - The element to focus on.
|
|
312
|
+
* @param {TimeoutOption} options - The timeout options.
|
|
313
|
+
*/
|
|
314
|
+
function focus(input, options) {
|
|
315
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
316
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
317
|
+
yield locator.focus(options);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
exports.focus = focus;
|
|
321
|
+
/**
|
|
322
|
+
* Drags and drops a specified element to a destination.
|
|
323
|
+
* @param {string | Locator} input - The element to drag.
|
|
324
|
+
* @param {string | Locator} dest - The destination to drop the element at.
|
|
325
|
+
* @param {DragOptions} options - The drag options.
|
|
326
|
+
*/
|
|
327
|
+
function dragAndDrop(input, dest, options) {
|
|
328
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
329
|
+
const drag = (0, locator_utils_1.getLocator)(input);
|
|
330
|
+
const drop = (0, locator_utils_1.getLocator)(dest);
|
|
331
|
+
yield drag.dragTo(drop, options);
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
exports.dragAndDrop = dragAndDrop;
|
|
335
|
+
/**
|
|
336
|
+
* Double clicks on a specified element.
|
|
337
|
+
* @param {string | Locator} input - The element to double click on.
|
|
338
|
+
* @param {DoubleClickOptions} options - The double click options.
|
|
339
|
+
*/
|
|
340
|
+
function doubleClick(input, options) {
|
|
341
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
342
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
343
|
+
yield locator.dblclick(options);
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
exports.doubleClick = doubleClick;
|
|
347
|
+
/**
|
|
348
|
+
* Downloads a file from a specified element.
|
|
349
|
+
* @param {string | Locator} input - The element to download the file from.
|
|
350
|
+
* @param {string} path - The path to save the downloaded file to.
|
|
351
|
+
*/
|
|
352
|
+
function downloadFile(input, path) {
|
|
353
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
354
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
355
|
+
const downloadPromise = (0, page_utils_1.getPage)().waitForEvent('download');
|
|
356
|
+
yield click(locator);
|
|
357
|
+
const download = yield downloadPromise;
|
|
358
|
+
// Wait for the download process to complete
|
|
359
|
+
console.log(yield download.path());
|
|
360
|
+
// Save downloaded file somewhere
|
|
361
|
+
yield download.saveAs(path);
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
exports.downloadFile = downloadFile;
|
|
365
|
+
/**
|
|
366
|
+
* Uploads files to a specified element.
|
|
367
|
+
* @param {string | Locator} input - The element to upload files to.
|
|
368
|
+
* @param {UploadValues} path - The files to upload.
|
|
369
|
+
* @param {UploadOptions} options - The upload options.
|
|
370
|
+
*/
|
|
371
|
+
function uploadFiles(input, path, options) {
|
|
372
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
373
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
374
|
+
yield locator.setInputFiles(path, options);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
exports.uploadFiles = uploadFiles;
|
|
378
|
+
/**
|
|
379
|
+
* Scrolls a specified element into view.
|
|
380
|
+
* @param {string | Locator} input - The element to scroll into view.
|
|
381
|
+
* @param {TimeoutOption} options - The timeout options.
|
|
382
|
+
*/
|
|
383
|
+
function scrollLocatorIntoView(input, options) {
|
|
384
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
385
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
386
|
+
yield locator.scrollIntoViewIfNeeded(options);
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
exports.scrollLocatorIntoView = scrollLocatorIntoView;
|
|
390
|
+
/**
|
|
391
|
+
* 4. JS: This section contains functions that use JavaScript to interact with elements on a web page.
|
|
392
|
+
* These functions include clicking on an element using JavaScript.
|
|
393
|
+
*/
|
|
394
|
+
/**
|
|
395
|
+
* Clicks on a specified element using JavaScript.
|
|
396
|
+
* @param {string | Locator} input - The element to click on.
|
|
397
|
+
* @param {TimeoutOption} options - The timeout options.
|
|
398
|
+
*/
|
|
399
|
+
function clickByJS(input, options) {
|
|
400
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
401
|
+
const locator = (0, locator_utils_1.getLocator)(input);
|
|
402
|
+
yield locator.evaluate('el => el.click()', options);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
exports.clickByJS = clickByJS;
|
|
406
|
+
//# sourceMappingURL=action-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-utils.js","sourceRoot":"","sources":["../../../src/vasu-playwright-lib/utils/action-utils.ts"],"names":[],"mappings":";;;;AAKA,6CAAuC;AAkBvC,oDAAyD;AACzD,mDAA6C;AAC7C,sDAAmD;AAEnD;;;GAGG;AAEH;;;;;GAKG;AACH,SAAsB,OAAO,CAAC,IAAY,EAAE,UAAuB,EAAE,SAAS,EAAE,qBAAS,EAAE;;QACzF,OAAO,MAAM,IAAA,oBAAO,GAAE,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CAAA;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAsB,oBAAoB,CAAC,OAA2B;;QACpE,IAAI,SAAS,GAA4B,qBAAS,CAAC;QAEnD,I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,0BAAU,EAAC,KAAK,CAAC,CAAC;QAClC,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,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;;;;GAIG;AACH,SAAsB,SAAS,CAAC,KAAuB,EAAE,OAAuB;;QAC9E,MAAM,OAAO,GAAG,IAAA,0BAAU,EAAC,KAAK,CAAC,CAAC;QAClC,MAAM,OAAO,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;CAAA;AAHD,8BAGC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* element-utils.ts: This module provides utility functions for retrieving text from web elements in web page and conditional statements with in Playwright.
|
|
3
|
+
* These utilities include a variety of functions for retrieving text, input values, URLs, and checking conditions such as
|
|
4
|
+
* whether an element is visible or checked. It provides a layer of abstraction over Playwright's built-in methods for
|
|
5
|
+
* interacting with elements, making it easier to perform common tasks and checks on web elements.
|
|
6
|
+
*/
|
|
7
|
+
import { Locator } from 'playwright';
|
|
8
|
+
import { NavigationOptions, TimeoutOption } from '../types/optional-parameter-types';
|
|
9
|
+
/**
|
|
10
|
+
* 1. Retreiving Data: Use these functions to retrieve text, values, and counts from web elements.
|
|
11
|
+
* These functions can also be used in conditional statements to check the state of web elements.
|
|
12
|
+
* These functions are not intended for use in assertions, unless the built-in Playwright assertions do not meet your criteria.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Returns the inner text of a Locator object.
|
|
16
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
17
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
18
|
+
* @returns {Promise<string>} - The inner text of the Locator.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getText(input: string | Locator, options?: TimeoutOption): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the inner text of all Locator objects.
|
|
23
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
24
|
+
* @returns {Promise<Array<string>>} - The inner text of all Locator objects.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAllTexts(input: string | Locator): Promise<Array<string>>;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the input value of a Locator object.
|
|
29
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
30
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
31
|
+
* @returns {Promise<string>} - The input value of the Locator.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getInputValue(input: string | Locator, options?: TimeoutOption): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the input values of all Locator objects.
|
|
36
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
37
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
38
|
+
* @returns {Promise<Array<string>>} - The input values of all Locator objects.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getAllInputValues(input: string | Locator, options?: TimeoutOption): Promise<Array<string>>;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the attribute of a Locator object.
|
|
43
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
44
|
+
* @param {string} attributeName - The name of the attribute to get.
|
|
45
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
46
|
+
* @returns {Promise<null | string>} - The attribute of the Locator if present or null if absent.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getAttribute(input: string | Locator, attributeName: string, options?: TimeoutOption): Promise<null | string>;
|
|
49
|
+
/**
|
|
50
|
+
* Saves the storage state of the page.
|
|
51
|
+
* @param {string} [path] - Optional path to save the storage state to.
|
|
52
|
+
* @returns {Promise<void>}
|
|
53
|
+
*/
|
|
54
|
+
export declare function saveStorageState(path?: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the URL of the page.
|
|
57
|
+
* @param {NavigationOptions} [options] - Optional navigation options.
|
|
58
|
+
* @returns {Promise<string>} - The URL of the page.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getURL(options?: NavigationOptions): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the count of Locator objects.
|
|
63
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
64
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
65
|
+
* @returns {Promise<number>} - The count of the Locator objects.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getLocatorCount(input: string | Locator, options?: TimeoutOption): Promise<number>;
|
|
68
|
+
/**
|
|
69
|
+
* 2. Conditions: Use these checks within conditional statements.
|
|
70
|
+
* They are not intended for use in assertions, unless the built-in Playwright assertions do not meet your criteria.
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a Locator object is attached to DOM.
|
|
74
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
75
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
76
|
+
* @returns {Promise<boolean>} - True if the Locator is attached, false otherwise.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isElementAttached(input: string | Locator, options?: TimeoutOption): Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* Checks if a Locator object is attached to DOM and is visible.
|
|
81
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
82
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
83
|
+
* @returns {Promise<boolean>} - True if the Locator is visible, false otherwise.
|
|
84
|
+
*/
|
|
85
|
+
export declare function isElementVisible(input: string | Locator, options?: TimeoutOption): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Checks if a Locator object is hidden or not present in DOM.
|
|
88
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
89
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
90
|
+
* @returns {Promise<boolean>} - True if the Locator is hidden, false otherwise.
|
|
91
|
+
*/
|
|
92
|
+
export declare function isElementHidden(input: string | Locator, options?: TimeoutOption): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Checks if a Locator object is checked.
|
|
95
|
+
* @param {string | Locator} input - The input to create the Locator from.
|
|
96
|
+
* @param {TimeoutOption} [options] - Optional timeout options.
|
|
97
|
+
* @returns {Promise<boolean>} - True if the Locator is checked, false otherwise.
|
|
98
|
+
*/
|
|
99
|
+
export declare function isElementChecked(input: string | Locator, options?: TimeoutOption): Promise<boolean>;
|
|
100
|
+
//# sourceMappingURL=element-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-utils.d.ts","sourceRoot":"","sources":["../../../src/vasu-playwright-lib/utils/element-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKrF;;;;GAIG;AAEH;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAG/F;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAGjF;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAGrG;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE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