@anddone/coretestautomation 1.0.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.
Files changed (72) hide show
  1. package/.github/workflows/npm-release.yml +102 -0
  2. package/dist/api/base.api.d.ts +32 -0
  3. package/dist/api/base.api.d.ts.map +1 -0
  4. package/dist/api/base.api.js +7 -0
  5. package/dist/api/base.api.js.map +1 -0
  6. package/dist/api/headers.d.ts +6 -0
  7. package/dist/api/headers.d.ts.map +1 -0
  8. package/dist/api/headers.js +23 -0
  9. package/dist/api/headers.js.map +1 -0
  10. package/dist/index.d.ts +13 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +29 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/pages/basepage.d.ts +6 -0
  15. package/dist/pages/basepage.d.ts.map +1 -0
  16. package/dist/pages/basepage.js +10 -0
  17. package/dist/pages/basepage.js.map +1 -0
  18. package/dist/testData/api.data.json +6 -0
  19. package/dist/utils/apiUtils.d.ts +123 -0
  20. package/dist/utils/apiUtils.d.ts.map +1 -0
  21. package/dist/utils/apiUtils.js +264 -0
  22. package/dist/utils/apiUtils.js.map +1 -0
  23. package/dist/utils/assertionUtils.d.ts +223 -0
  24. package/dist/utils/assertionUtils.d.ts.map +1 -0
  25. package/dist/utils/assertionUtils.js +400 -0
  26. package/dist/utils/assertionUtils.js.map +1 -0
  27. package/dist/utils/commonUtils.d.ts +590 -0
  28. package/dist/utils/commonUtils.d.ts.map +1 -0
  29. package/dist/utils/commonUtils.js +1292 -0
  30. package/dist/utils/commonUtils.js.map +1 -0
  31. package/dist/utils/fakerStaticData.d.ts +16 -0
  32. package/dist/utils/fakerStaticData.d.ts.map +1 -0
  33. package/dist/utils/fakerStaticData.js +88 -0
  34. package/dist/utils/fakerStaticData.js.map +1 -0
  35. package/dist/utils/fileCommonUtils.d.ts +22 -0
  36. package/dist/utils/fileCommonUtils.d.ts.map +1 -0
  37. package/dist/utils/fileCommonUtils.js +243 -0
  38. package/dist/utils/fileCommonUtils.js.map +1 -0
  39. package/dist/utils/generationUtils.d.ts +424 -0
  40. package/dist/utils/generationUtils.d.ts.map +1 -0
  41. package/dist/utils/generationUtils.js +869 -0
  42. package/dist/utils/generationUtils.js.map +1 -0
  43. package/dist/utils/pageUtils.d.ts +90 -0
  44. package/dist/utils/pageUtils.d.ts.map +1 -0
  45. package/dist/utils/pageUtils.js +214 -0
  46. package/dist/utils/pageUtils.js.map +1 -0
  47. package/dist/utils/tableUtils.d.ts +304 -0
  48. package/dist/utils/tableUtils.d.ts.map +1 -0
  49. package/dist/utils/tableUtils.js +555 -0
  50. package/dist/utils/tableUtils.js.map +1 -0
  51. package/dist/utils/validationUtils.d.ts +80 -0
  52. package/dist/utils/validationUtils.d.ts.map +1 -0
  53. package/dist/utils/validationUtils.js +172 -0
  54. package/dist/utils/validationUtils.js.map +1 -0
  55. package/package.json +23 -0
  56. package/playwright.config.ts +79 -0
  57. package/src/api/base.api.ts +39 -0
  58. package/src/api/headers.ts +17 -0
  59. package/src/index.ts +12 -0
  60. package/src/pages/basepage.ts +11 -0
  61. package/src/testData/api.data.json +6 -0
  62. package/src/types/pdf-parse.d.ts +6 -0
  63. package/src/utils/apiUtils.ts +307 -0
  64. package/src/utils/assertionUtils.ts +455 -0
  65. package/src/utils/commonUtils.ts +1544 -0
  66. package/src/utils/fakerStaticData.ts +91 -0
  67. package/src/utils/fileCommonUtils.ts +239 -0
  68. package/src/utils/generationUtils.ts +929 -0
  69. package/src/utils/pageUtils.ts +224 -0
  70. package/src/utils/tableUtils.ts +715 -0
  71. package/src/utils/validationUtils.ts +179 -0
  72. package/tsconfig.json +19 -0
@@ -0,0 +1,590 @@
1
+ import type { Locator } from '@playwright/test';
2
+ export type ActionOptions = {
3
+ timeout?: number;
4
+ description?: string;
5
+ lastButtonLocator?: string;
6
+ activePageLocator?: string;
7
+ nextButtonLocator?: string;
8
+ prevButtonLocator?: string;
9
+ firstButtonLocator?: string;
10
+ pageButtonLocator?: string;
11
+ };
12
+ export declare class CommonUtils {
13
+ private static isHighlight;
14
+ private static resolveOptions;
15
+ /**
16
+ * Highlights a UI element on the page for debugging and visual validation.
17
+ */
18
+ static highlight(locator: Locator): Promise<void>;
19
+ /**
20
+ * Waits for a Playwright locator to become visible on the page.
21
+ *
22
+ * @param locator - Playwright Locator to wait for
23
+ * @param options - Optional configuration object
24
+ * @param options.timeout - Maximum wait time in milliseconds (default: 15000)
25
+ * @param options.description - Logical name of the element for logging purposes
26
+ *
27
+ * @example
28
+ * await CommonUtils.waitForVisible(loginButton);
29
+ *
30
+ * @example
31
+ * await CommonUtils.waitForVisible(loginButton, {timeout: 5000,description: 'Login Button'});
32
+ */
33
+ static waitForVisible(locator: Locator, options?: ActionOptions): Promise<void>;
34
+ /**
35
+ * Waits for a Playwright locator to become hidden or removed from the DOM.
36
+ *
37
+ * @param locator - Playwright Locator to wait for
38
+ * @param options - Optional configuration object
39
+ * @param options.timeout - Maximum wait time in milliseconds (default: 15000)
40
+ * @param options.description - Logical name of the element for logging purposes
41
+ *
42
+ * @example
43
+ * await CommonUtils.waitForInvisible(loginButton);
44
+ *
45
+ * @example
46
+ * await CommonUtils.waitForInvisible(loginButton, {timeout: 5000,description: 'Login Button'});
47
+ */
48
+ static waitForInvisible(locator: Locator, options?: ActionOptions): Promise<void>;
49
+ /**
50
+ * Pauses execution for a specified number of seconds.
51
+ *
52
+ * @param seconds - Number of seconds to wait
53
+ *
54
+ * @example
55
+ * await CommonUtils.waitSeconds(3);
56
+ *
57
+ * @returns Promise<void>
58
+ */
59
+ static waitSeconds(seconds: number): Promise<void>;
60
+ /**
61
+ * Clicks on a web element after waiting for it to become visible.
62
+ *
63
+ * If the element is not found or the click fails, the error is logged
64
+ *
65
+ * @param locator - Playwright Locator to be clicked
66
+ * @param options - Optional configuration object
67
+ * @param options.timeout - Maximum wait time for visibility and click (default: 15000 ms)
68
+ * @param options.description - Logical name of the element for logging purposes
69
+ *
70
+ * @example
71
+ * await CommonUtils.click(loginButton);
72
+ *
73
+ * @example
74
+ * await CommonUtils.click(loginButton, {timeout: 5000,description: 'Login Button'});
75
+ */
76
+ static click(locator: Locator, options?: ActionOptions): Promise<void>;
77
+ /**
78
+ * Fills text into an input field after ensuring it is visible.
79
+ *
80
+ * @param locator - Playwright Locator of the input element
81
+ * @param text - Text value to be entered into the field
82
+ * @param options - Optional configuration object
83
+ * @param options.timeout - Maximum wait time for visibility (default: 15000 ms)
84
+ * @param options.description - Logical name of the element for logging purposes
85
+ *
86
+ * @example
87
+ * await CommonUtils.fill(usernameInput, 'admin');
88
+ *
89
+ * @example
90
+ * await CommonUtils.fill(usernameInput, 'admin', {timeout: 5000,description: 'Username Input'
91
+ * });
92
+ */
93
+ static fill(locator: Locator, text: string, options?: ActionOptions): Promise<void>;
94
+ /**
95
+ * Types text into an input or editable element using keyboard events.
96
+ *
97
+ * @param locator - Playwright Locator of the input or editable element
98
+ * @param text - Text to be typed into the element
99
+ * @param options - Optional configuration object
100
+ * @param options.timeout - Maximum wait time for visibility (default: 15000 ms)
101
+ * @param options.description - Logical name of the element for logging purposes
102
+ *
103
+ * @example
104
+ * await CommonUtils.typeText(usernameInput, 'admin');
105
+ *
106
+ * @example
107
+ * await CommonUtils.typeText(passwordInput, 'password123', {
108
+ * timeout: 5000,
109
+ * description: 'Password Input'
110
+ * });
111
+ */
112
+ static typeText(locator: Locator, text: string, options?: ActionOptions): Promise<void>;
113
+ /**
114
+ * Checks whether a locator is visible within the given timeout.
115
+ *
116
+ * @param locator - Locator of the element to check
117
+ * @param options - Optional configuration (timeout in ms, description)
118
+ * @returns True if the element becomes visible, otherwise false
119
+ *
120
+ * @example
121
+ * const visible = await CommonUtils.isVisible(page.locator('#loginButton'));
122
+ * const visibleWithDesc = await CommonUtils.isVisible(page.locator('#loginButton'), {timeout:5000, description:'Login Button'});
123
+ */
124
+ static isVisible(locator: Locator, options?: ActionOptions): Promise<boolean>;
125
+ /**
126
+ * Checks whether a locator is enabled (interactable).
127
+ *
128
+ * @param locator - Locator of the element to check
129
+ * @param options - Optional configuration (timeout in ms, description)
130
+ * @returns True if the element is enabled, otherwise false
131
+ *
132
+ * @example
133
+ * const enabled = await CommonUtils.isEnabled(page.locator('#submitButton'));
134
+ */
135
+ static isEnabled(locator: Locator, options?: ActionOptions): Promise<boolean>;
136
+ /**
137
+ * Checks whether a locator is disabled.
138
+ *
139
+ * @param locator - Locator of the element to check
140
+ * @param options - Optional configuration (timeout in ms, description)
141
+ * @returns True if the element is disabled or not interactable, otherwise false
142
+ *
143
+ * @example
144
+ * const disabled = await CommonUtils.isDisabled(page.locator('#cancelButton'));
145
+ */
146
+ static isDisabled(locator: Locator, options?: ActionOptions): Promise<boolean>;
147
+ /**
148
+ * Checks whether a locator is editable.
149
+ *
150
+ * @param locator - Locator of the element to check
151
+ * @param options - Optional configuration (timeout in ms, description)
152
+ * @returns True if the element is editable, otherwise false
153
+ *
154
+ * @example
155
+ * const editable = await CommonUtils.isEditable(page.locator('#nameInput'));
156
+ */
157
+ static isEditable(locator: Locator, options?: ActionOptions): Promise<boolean>;
158
+ /**
159
+ * Checks whether a checkbox or radio button is checked.
160
+ *
161
+ * @param locator - Locator of the checkbox or radio element
162
+ * @param options - Optional configuration (timeout in ms, description)
163
+ * @returns True if the element is checked, otherwise false
164
+ *
165
+ * @example
166
+ * const checked = await CommonUtils.isChecked(page.locator('#acceptTerms'));
167
+ */
168
+ static isChecked(locator: Locator, options?: ActionOptions): Promise<boolean>;
169
+ /**
170
+ * Checks whether a locator is hidden within the given timeout.
171
+ *
172
+ * @param locator - Locator of the element to check
173
+ * @param options - Optional configuration (timeout in ms, description)
174
+ * @returns True if the element is hidden or not visible, otherwise false
175
+ *
176
+ * @example
177
+ * const hidden = await CommonUtils.isHidden(page.locator('#loadingSpinner'));
178
+ */
179
+ static isHidden(locator: Locator, options?: ActionOptions): Promise<boolean>;
180
+ /**
181
+ * Clears the value of an input or editable element.
182
+ *
183
+ * @param locator - Locator of the element to clear
184
+ * @param options - Optional configuration (timeout in ms, description)
185
+ *
186
+ * @example
187
+ * await CommonUtils.clear(page.locator('#searchInput'));
188
+ * await CommonUtils.clear(page.locator('#searchInput'), {timeout: 5000, description: 'Search Input'});
189
+ */
190
+ static clear(locator: Locator, options?: ActionOptions): Promise<void>;
191
+ /**
192
+ * Retrieves the value of a specified attribute from an element.
193
+ *
194
+ * @param locator - Locator of the element
195
+ * @param attributeName - Name of the attribute to retrieve
196
+ * @param options - Optional configuration (timeout in ms, description)
197
+ * @returns Attribute value or null if not found
198
+ */
199
+ static getAttributeValue(locator: Locator, attributeName: string, options?: ActionOptions): Promise<string | null>;
200
+ /**
201
+ * Checks whether an element's attribute value contains the expected text.
202
+ *
203
+ * @param locator - Locator of the element
204
+ * @param attributeName - Attribute to inspect
205
+ * @param expectedValue - Text expected to be contained in the attribute
206
+ * @param options - Optional configuration (timeout in ms, description)
207
+ * @returns True if attribute contains the expected value
208
+ */
209
+ static isAttributeValueContains(locator: Locator, attributeName: string, expectedValue: string, options?: ActionOptions): Promise<boolean>;
210
+ /**
211
+ * Retrieves visible text from a Playwright locator.
212
+ *
213
+ * @param locator - Playwright Locator from which text is retrieved
214
+ * @param options - Optional configuration object
215
+ * @param options.timeout - Maximum wait time for visibility (default: 15000 ms)
216
+ * @param options.description - Logical name of the element for logging
217
+ *
218
+ * @returns The extracted text, or an empty string if unavailable
219
+ *
220
+ * @example
221
+ * const header = await CommonUtils.getText(pageHeader);
222
+ *
223
+ * @example
224
+ * const errorMsg = await CommonUtils.getText(errorLabel, {
225
+ * timeout: 5000,
226
+ * description: 'Error Message'
227
+ * });
228
+ */
229
+ static getText(locator: Locator, options?: ActionOptions): Promise<string>;
230
+ /**
231
+ * Retrieves the visible innerText of an element.
232
+ *
233
+ * @param locator - Locator of the target element
234
+ * @param options - Optional action settings
235
+ * @param options.timeout - Maximum time to wait for the element to become visible (default: 1500)
236
+ * @param options.description - Description of the element used for logging
237
+ *
238
+ * @example
239
+ * const text = await getInnerText(title);
240
+ *
241
+ * @example
242
+ * const text = await getInnerText(title, {description: 'Page title',timeout: 3000
243
+ * });
244
+ *
245
+ * @returns Trimmed innerText, or empty string if unavailable
246
+ */
247
+ static getInnerText(locator: Locator, options?: ActionOptions): Promise<string>;
248
+ /**
249
+ * Gets trimmed innerText values from a list of elements.
250
+ *
251
+ * @param locatorList - Locator representing multiple elements
252
+ * @param options - Optional action settings
253
+ * @param options.timeout - Maximum wait time for at least one element to become visible (default: 1500)
254
+ * @param options.description - Description of the element list used for logging
255
+ *
256
+ * @example
257
+ * const texts = await CommonUtils.getAllInnerText(listItems);
258
+ *
259
+ * @example
260
+ * const texts = await CommonUtils.getAllInnerText(listItems, {
261
+ * description: 'Fruit list items',
262
+ * timeout: 5000
263
+ * });
264
+ *
265
+ * @returns Array of trimmed innerText values, or empty array if none found
266
+ */
267
+ static getAllInnerText(locatorList: Locator, options?: ActionOptions): Promise<string[]>;
268
+ /**
269
+ * Gets trimmed textContent values from a list of elements.
270
+ *
271
+ * @param locatorList - Locator representing multiple elements
272
+ * @param options - Optional action settings
273
+ * @param options.timeout - Maximum wait time for at least one element to be attached (default: 1500)
274
+ * @param options.description - Description of the element list used for logging
275
+ *
276
+ * @example
277
+ * const texts = await CommonUtils.getAllText(listItems);
278
+ *
279
+ * @example
280
+ * const texts = await CommonUtils.getAllText(listItems, {
281
+ * description: 'Fruit list items',
282
+ * timeout: 5000
283
+ * });
284
+ *
285
+ * @returns Array of trimmed textContent values, or empty array if none found
286
+ */
287
+ static getAllText(locatorList: Locator, options?: ActionOptions): Promise<string[]>;
288
+ /**
289
+ * Fetches the trimmed text of a specific child tag inside a locator.
290
+ *
291
+ * @param locator - Locator of the parent element
292
+ * @param tagName - Tag name of the child element to fetch text from (e.g., 'span', 'p')
293
+ * @param options - Optional action settings
294
+ * @param options.timeout - Maximum time to wait for the element (default: 15000)
295
+ * @param options.description - Description of the element used for logging
296
+ *
297
+ * @example
298
+ * const spanText = await CommonUtils.getTextByTag(parentDiv, 'span');
299
+ *
300
+ * @example
301
+ * const spanText = await CommonUtils.getTextByTag(parentDiv, 'span', {
302
+ * description: 'Amount label',
303
+ * timeout: 5000
304
+ * });
305
+ *
306
+ * @returns Trimmed text of the child element, or empty string if not found
307
+ */
308
+ static getTextByTag(locator: Locator, tagName: string, options?: ActionOptions): Promise<string>;
309
+ /**
310
+ * Finds the index of the first element whose innerText exactly matches the expected value.
311
+ *
312
+ * @param locatorList - Locator representing a list of elements
313
+ * @param expected - Exact text to match against each element's innerText
314
+ * @param options - Optional action settings
315
+ * @param options.timeout - Maximum time to wait for at least one element to become visible (default: 1500)
316
+ * @param options.description - Description of the element list used for logging
317
+ *
318
+ * @example
319
+ * const index = await getIndexOfExpected(listItems, 'Apple');
320
+ *
321
+ * @example
322
+ * const index = await getIndexOfExpected(listItems,'Apple',
323
+ * { description: 'Fruit list items', timeout: 5000 }
324
+ * );
325
+ *
326
+ * @returns Zero-based index of the matched element, or -1 if not found
327
+ */
328
+ static getIndexOfExpected(locatorList: Locator, expected: string, options?: ActionOptions): Promise<number>;
329
+ /**
330
+ * Checks if an element's innerText exactly matches the expected text.
331
+ *
332
+ * @param locator - Locator of the target element
333
+ * @param expected - Expected text to match exactly against the element's innerText
334
+ * @param options - Optional action settings
335
+ * @param options.timeout - Maximum time to wait for the element to become visible (default: 1500)
336
+ * @param options.description - Description of the element used for logging
337
+ *
338
+ * @example
339
+ * const isMatch = await isElementTextMatchInnerText(title, 'Welcome');
340
+ *
341
+ * @example
342
+ * const isMatch = await isElementTextMatchInnerText(title, 'Welcome', {
343
+ * description: 'Page title',
344
+ * timeout: 3000
345
+ * });
346
+ *
347
+ * @returns True if the element's innerText matches the expected text exactly, otherwise false
348
+ */
349
+ static isElementTextMatchInnerText(locator: Locator, expected: string, options?: ActionOptions): Promise<boolean>;
350
+ /**
351
+ * Checks if an element's innerText contains the expected text.
352
+ *
353
+ * @param locator - Locator of the target element
354
+ * @param expected - Text expected to be contained within the element's innerText
355
+ * @param options - Optional action settings
356
+ * @param options.timeout - Maximum time to wait for the element to become visible (default: 1500)
357
+ * @param options.description - Description of the element used for logging
358
+ *
359
+ * @example
360
+ * const contains = await isElementTextContainsInnerText(message, 'Success');
361
+ *
362
+ * @example
363
+ * const contains = await isElementTextContainsInnerText(message, 'Success', {
364
+ * description: 'Toast message'
365
+ * });
366
+ *
367
+ * @returns True if the element's innerText contains the expected text, otherwise false
368
+ */
369
+ static isElementTextContainsInnerText(locator: Locator, expected: string, options?: ActionOptions): Promise<boolean>;
370
+ /**
371
+ * Checks if an element's textContent exactly matches the expected text.
372
+ *
373
+ * @param locator - Locator of the target element
374
+ * @param expected - Expected text to match exactly against the element's textContent
375
+ * @param options - Optional action settings
376
+ * @param options.timeout - Maximum time to wait for the element to become visible (default: 1500)
377
+ * @param options.description - Description of the element used for logging
378
+ *
379
+ * @example
380
+ * const isExact = await isElementTextMatchText(label, 'Username');
381
+ *
382
+ * @example
383
+ * const isExact = await isElementTextMatchText(label, 'Username', {
384
+ * description: 'Username label'
385
+ * });
386
+ *
387
+ * @returns True if the element's textContent matches the expected text exactly, otherwise false
388
+ */
389
+ static isElementTextMatchText(locator: Locator, expected: string, options?: ActionOptions): Promise<boolean>;
390
+ /**
391
+ * Checks if an element's textContent contains the expected text.
392
+ *
393
+ * @param locator - Locator of the target element
394
+ * @param expected - Text expected to be contained within the element's textContent
395
+ * @param options - Optional action settings
396
+ * @param options.timeout - Maximum time to wait for the element to become visible (default: 1500)
397
+ * @param options.description - Description of the element used for logging
398
+ *
399
+ * @example
400
+ * const contains = await isElementTextContainsText(button, 'Submit');
401
+ *
402
+ * @example
403
+ * const contains = await isElementTextContainsText(button, 'Submit', {description: 'Submit button',
404
+ * timeout: 4000
405
+ * });
406
+ *
407
+ * @returns True if the element's textContent contains the expected text, otherwise false
408
+ */
409
+ static isElementTextContainsText(locator: Locator, expected: string, options?: ActionOptions): Promise<boolean>;
410
+ /**
411
+ * Checks if the given list is sorted in ascending order.
412
+ * @param list List of comparable values
413
+ * @returns true if sorted ascending, else false
414
+ */
415
+ static isAscending<T>(list: T[]): boolean;
416
+ /**
417
+ * Checks if the given list is sorted in descending order.
418
+ * @param list List of comparable values
419
+ * @returns true if sorted descending, else false
420
+ */
421
+ static isDescending<T>(list: T[]): boolean;
422
+ /**
423
+ * Sorts a list of values in ascending or descending order.
424
+ * @param values Values to sort
425
+ * @param order Sorting order ('asc' or 'desc')
426
+ * @returns Sorted array
427
+ */
428
+ static sortValues(values: any[], order: 'asc' | 'desc'): any[];
429
+ /**
430
+ * Sort date strings from Newest to Oldest using given format.
431
+ * @param dateStrings Date strings from UI
432
+ * @param format Date format (e.g. 'MMM dd, yyyy HH:mm:s')
433
+ * @returns Sorted date strings (Newest first)
434
+ */
435
+ static sortDateNewestToOldest(dateStrings: string[], format: string): string[];
436
+ /**
437
+ * Sort date strings from Oldest to Newest using given format.
438
+ * @param dateStrings Date strings from UI
439
+ * @param format Date format (e.g. 'MMM dd, yyyy HH:mm:s')
440
+ * @returns Sorted date strings (Oldest first)
441
+ */
442
+ static sortDateOldestToNewest(dateStrings: string[], format: string): string[];
443
+ /**
444
+ * Month name to month index mapping for parsing 'MMM' format.
445
+ */
446
+ static readonly MONTH_MAP: Record<string, number>;
447
+ /**
448
+ * Parses a date string into a Date object using a generic format.
449
+ * Supports multiple date tokens like yyyy, MM, MMM, dd, HH, mm, ss.
450
+ * @param dateStr Date string from UI
451
+ * @param format Format of the date string
452
+ * @returns Parsed Date object
453
+ */
454
+ static parseDateGeneric(dateStr: string, format: string): Date;
455
+ /**
456
+ * Formats a Date object into a string using the provided format.
457
+ * @param date Date object
458
+ * @param format Desired output format
459
+ * @returns Formatted date string
460
+ */
461
+ static formatDateGeneric(date: Date, format: string): string;
462
+ /**
463
+ * Selects an option from a list of locators based on visible text.
464
+ *
465
+ * @param optionsList - Locator representing list of selectable options
466
+ * @param optionText - Visible text of the option to select
467
+ * @param options - Optional action settings
468
+ * @param options.timeout - Maximum wait time (default: 15000)
469
+ *
470
+ * @returns true if option is clicked successfully, otherwise false
471
+ */
472
+ static clickOnFilterOptionFromList(optionsList: Locator, optionText: string, options?: ActionOptions): Promise<boolean>;
473
+ /**
474
+ * Selects an option from a native <select> dropdown using visible text.
475
+ *
476
+ * @param dropdown - Locator pointing to the <select> element
477
+ * @param optionText - Visible text of the option to select
478
+ * @param options - Optional configuration (timeout, description)
479
+ */
480
+ static selectByText(dropdown: Locator, optionText: string, options?: ActionOptions): Promise<void>;
481
+ /**
482
+ * Selects an option from a native <select> dropdown using the option's value attribute.
483
+ *
484
+ * @param dropdown - Locator pointing to the <select> element
485
+ * @param value - Value attribute of the option to select
486
+ * @param options - Optional configuration (timeout, description)
487
+ */
488
+ static selectByValue(dropdown: Locator, value: string, options?: ActionOptions): Promise<void>;
489
+ /**
490
+ * Selects an option from a native <select> dropdown using the option index (0-based).
491
+ *
492
+ * @param dropdown - Locator pointing to the <select> element
493
+ * @param index - Index of the option (0-based)
494
+ * @param options - Optional configuration (timeout, description)
495
+ */
496
+ static selectByIndex(dropdown: Locator, index: number, options?: ActionOptions): Promise<void>;
497
+ /**
498
+ * Selects an option from a custom (non-<select>) dropdown using visible text.
499
+ *
500
+ * @param dropdown - Locator for the dropdown trigger element
501
+ * @param optionsList - Locator representing all dropdown option elements
502
+ * @param value - Visible text of the option to select
503
+ * @param options - Optional configuration (timeout, description)
504
+ */
505
+ static selectFromCustomDropdown(dropdown: Locator, optionsList: Locator, value: string, options?: ActionOptions): Promise<void>;
506
+ /**
507
+ * Retrieves all visible option texts from a dropdown or options list.
508
+ *
509
+ * @param optionsList - Locator pointing to dropdown option elements
510
+ * @param options - Optional configuration (timeout, description)
511
+ * @returns Array of trimmed option texts or empty array
512
+ */
513
+ static getAllOptions(optionsList: Locator, options?: ActionOptions): Promise<string[]>;
514
+ /**
515
+ * Checks whether a dropdown/options list contains a specific visible option.
516
+ *
517
+ * @param optionsList - Locator representing dropdown option elements
518
+ * @param value - Option text to verify
519
+ * @param options - Optional configuration (timeout, description)
520
+ * @returns true if option exists, otherwise false
521
+ */
522
+ static hasOption(optionsList: Locator, value: string, options?: ActionOptions): Promise<boolean>;
523
+ /**
524
+ * Retrieves the currently selected option text from a native <select> dropdown.
525
+ *
526
+ * @param dropdown - Locator for the <select> element
527
+ * @param options - Optional configuration (timeout, description)
528
+ * @returns The text of the selected option, or null if none is selected
529
+ */
530
+ static getSelectedOption(dropdown: Locator, options?: ActionOptions): Promise<string | null>;
531
+ /**
532
+ * Determines the total number of pages by navigating to the last page
533
+ * and reading the active page number.
534
+ *
535
+ * @param paginationContainer - Locator for the pagination container
536
+ * @param options - Optional configuration (timeout, description, locators)
537
+ * @returns Total number of pages, or 0 if it cannot be determined
538
+ */
539
+ static getTotalPaginationCount(paginationContainer: Locator, options?: ActionOptions): Promise<number>;
540
+ /**
541
+ * Clicks the "Next" button in pagination, if available.
542
+ *
543
+ * @param paginationContainer - Locator for the pagination container
544
+ * @param options - Optional configuration (timeout, description, locators)
545
+ * @returns True if the next button was clicked, otherwise false
546
+ */
547
+ static clickNextPagination(paginationContainer: Locator, options?: ActionOptions): Promise<boolean>;
548
+ /**
549
+ * Clicks the "Previous" button in pagination, if available.
550
+ *
551
+ * @param paginationContainer - Locator for the pagination container
552
+ * @param options - Optional configuration (timeout, description, locators)
553
+ * @returns True if the previous button was clicked, otherwise false
554
+ */
555
+ static clickPrevPagination(paginationContainer: Locator, options?: ActionOptions): Promise<boolean>;
556
+ /**
557
+ * Clicks the "Last" page button in pagination.
558
+ *
559
+ * @param paginationContainer - Locator for the pagination container
560
+ * @param options - Optional configuration (timeout, description, locators)
561
+ * @returns True if the last button was clicked successfully, otherwise false
562
+ */
563
+ static clickLastPagination(paginationContainer: Locator, options?: ActionOptions): Promise<boolean>;
564
+ /**
565
+ * Retrieves the currently active page number from pagination.
566
+ *
567
+ * @param paginationContainer - Locator for the pagination container
568
+ * @param options - Optional configuration (timeout, description, locators)
569
+ * @returns Active page number, or 0 if not found or invalid
570
+ */
571
+ static getActivePaginationPage(paginationContainer: Locator, options?: ActionOptions): Promise<number>;
572
+ /**
573
+ * Clicks the "Start" (first page) button in pagination, if available.
574
+ *
575
+ * @param paginationContainer - Locator for the pagination container
576
+ * @param options - Optional configuration (timeout, description, locators)
577
+ * @returns True if the start button was clicked, otherwise false
578
+ */
579
+ static clickStartPagination(paginationContainer: Locator, options?: ActionOptions): Promise<boolean>;
580
+ /**
581
+ * Clicks a specific page number button in pagination.
582
+ *
583
+ * @param paginationContainer - Locator for the pagination container
584
+ * @param pageNumber - Page number to navigate to (1-based)
585
+ * @param options - Optional configuration (timeout, description, locators)
586
+ * @returns True if the page number button was clicked, otherwise false
587
+ */
588
+ static clickPaginationPageNumber(paginationContainer: Locator, pageNumber: number, options?: ActionOptions): Promise<boolean>;
589
+ }
590
+ //# sourceMappingURL=commonUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commonUtils.d.ts","sourceRoot":"","sources":["../../src/utils/commonUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAS;IAEnC,OAAO,CAAC,MAAM,CAAC,cAAc;IAM7B;;MAEE;WACkB,SAAS,CAAC,OAAO,EAAE,OAAO;IAS9C;;;;;;;;;;;;;MAaE;WACW,cAAc,CAAC,OAAO,EAAE,OAAO,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