playwright-ts-automationframework 1.1.15 → 1.1.17

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Playwright Typescript Automation framework library
2
2
 
3
+ Sample Project: https://github.com/ketanp88/PlaywrightFrameworkDemoProject
4
+
3
5
  Playwright Typescript Automation framework
4
6
 
5
7
  This is a test automation framework around Playwright - for end-to-end testing. This is Playwright Automation framework has all wrapper actions methods and assertions method along with logger. This is plug and play Playwright Test Automation framework in Typescript.
@@ -18,7 +18,7 @@ export declare class Actions extends BasePage {
18
18
  *
19
19
  * click(loginBtn);
20
20
  */
21
- click(control: WebControl, isforceful?: boolean): Promise<void>;
21
+ click(control: WebControl): Promise<void>;
22
22
  /**
23
23
  * Mouse hover on an element.
24
24
  *
@@ -171,7 +171,7 @@ export declare class Actions extends BasePage {
171
171
  *
172
172
  * let errorMessage = getText(errorMsg);
173
173
  */
174
- getText(control: WebControl): Promise<string>;
174
+ getText(control: WebControl): Promise<string | void>;
175
175
  /**
176
176
  * Read textbox value of an element
177
177
  *
@@ -183,7 +183,7 @@ export declare class Actions extends BasePage {
183
183
  *
184
184
  * let textboxValue = getTextboxValue(usernameTxtbx);
185
185
  */
186
- getTextboxValue(control: WebControl): Promise<string>;
186
+ getTextboxValue(control: WebControl): Promise<string | void>;
187
187
  /**
188
188
  * Read selected dropdown item.
189
189
  *
@@ -195,7 +195,7 @@ export declare class Actions extends BasePage {
195
195
  *
196
196
  * let selectedItem = getSelectedItemFromDropdown(cityDrpdwn);
197
197
  */
198
- getSelectedItemFromDropdown(control: WebControl): Promise<string>;
198
+ getSelectedItemFromDropdown(control: WebControl): Promise<string | void>;
199
199
  /**
200
200
  * Read attribute value of element.
201
201
  *
@@ -208,7 +208,7 @@ export declare class Actions extends BasePage {
208
208
  *
209
209
  * let attributeValue = getAttributeValue(usernameTxtbx, "title");
210
210
  */
211
- getAttributeValue(control: WebControl, attributeName: string): Promise<string | null>;
211
+ getAttributeValue(control: WebControl, attributeName: string): Promise<string | void | null>;
212
212
  /**
213
213
  * Scroll to an element.
214
214
  *
@@ -284,7 +284,7 @@ export declare class Actions extends BasePage {
284
284
  *
285
285
  * waitTillPageURLContains("https://www.google.com/");
286
286
  */
287
- waitTillPageURLContains(url: string): Promise<void>;
287
+ waitTillPageURLContains(url: string, timeoutInSeconds?: number): Promise<void>;
288
288
  /**
289
289
  * Wait till element is present
290
290
  *
@@ -296,7 +296,7 @@ export declare class Actions extends BasePage {
296
296
  *
297
297
  * waitTillElementIsPresent(usernameTxtbx);
298
298
  */
299
- waitTillElementIsPresent(control: WebControl): Promise<void>;
299
+ waitTillElementIsPresent(control: WebControl, timeoutInSeconds?: number): Promise<void>;
300
300
  /**
301
301
  * Wait till element is attached to the dom
302
302
  *
@@ -308,7 +308,7 @@ export declare class Actions extends BasePage {
308
308
  *
309
309
  * waitTillElementIsAttached(usernameTxtbx);
310
310
  */
311
- waitTillElementIsAttached(control: WebControl): Promise<void>;
311
+ waitTillElementIsAttached(control: WebControl, timeoutInSeconds?: number): Promise<void>;
312
312
  /**
313
313
  * Wait till element is not displayed
314
314
  *
@@ -320,7 +320,7 @@ export declare class Actions extends BasePage {
320
320
  *
321
321
  * waitTillElementIsNotPresent(usernameTxtbx);
322
322
  */
323
- waitTillElementIsNotPresent(control: WebControl): Promise<void>;
323
+ waitTillElementIsNotPresent(control: WebControl, timeoutInSeconds?: number): Promise<void>;
324
324
  /**
325
325
  * Wait for execution to stop for given time
326
326
  *
@@ -330,7 +330,8 @@ export declare class Actions extends BasePage {
330
330
  *
331
331
  * sleep(10);
332
332
  */
333
- sleep(timeInSeconds?: number): Promise<unknown>;
333
+ sleep(timeInSeconds?: number): Promise<void>;
334
+ waitForPageTimeout(timeoutInSeconds?: number): Promise<void>;
334
335
  /**
335
336
  * Close the browser instance
336
337
  *
@@ -74,15 +74,16 @@ var Actions = /** @class */ (function (_super) {
74
74
  *
75
75
  * click(loginBtn);
76
76
  */
77
- Actions.prototype.click = function (control_1) {
78
- return __awaiter(this, arguments, void 0, function (control, isforceful) {
79
- if (isforceful === void 0) { isforceful = false; }
77
+ Actions.prototype.click = function (control) {
78
+ return __awaiter(this, void 0, void 0, function () {
80
79
  return __generator(this, function (_a) {
81
80
  switch (_a.label) {
82
- case 0: return [4 /*yield*/, control.controlLocator.click({ force: isforceful }).then(function () {
81
+ case 0: return [4 /*yield*/, control.controlLocator.first().click().then(function () {
83
82
  (0, logs_core_1.logAction)("Clicked on '" + control.controlDescription + "'");
84
83
  }, function (error) {
85
84
  (0, logs_core_1.errorLog)("Unable to click on '" + control.controlDescription + "'");
85
+ (0, logs_core_1.consoleLog)("Error: '" + error + "'");
86
+ throw error;
86
87
  })];
87
88
  case 1:
88
89
  _a.sent();
@@ -106,10 +107,11 @@ var Actions = /** @class */ (function (_super) {
106
107
  return __awaiter(this, void 0, void 0, function () {
107
108
  return __generator(this, function (_a) {
108
109
  switch (_a.label) {
109
- case 0: return [4 /*yield*/, control.controlLocator.hover().then(function () {
110
+ case 0: return [4 /*yield*/, control.controlLocator.first().hover().then(function () {
110
111
  (0, logs_core_1.logAction)("Mouse hover to '" + control.controlDescription + "'");
111
112
  }, function (error) {
112
113
  (0, logs_core_1.errorLog)("Unable to mouse hover on :'" + control.controlDescription + "'");
114
+ (0, logs_core_1.consoleLog)("Error: '" + error + "'");
113
115
  })];
114
116
  case 1:
115
117
  _a.sent();
@@ -134,7 +136,7 @@ var Actions = /** @class */ (function (_super) {
134
136
  return __awaiter(this, void 0, void 0, function () {
135
137
  return __generator(this, function (_a) {
136
138
  switch (_a.label) {
137
- case 0: return [4 /*yield*/, control.controlLocator.focus()];
139
+ case 0: return [4 /*yield*/, control.controlLocator.first().focus()];
138
140
  case 1:
139
141
  _a.sent();
140
142
  return [4 /*yield*/, this.pressKeyboardEvent(control, action)];
@@ -160,7 +162,7 @@ var Actions = /** @class */ (function (_super) {
160
162
  return __awaiter(this, void 0, void 0, function () {
161
163
  return __generator(this, function (_a) {
162
164
  switch (_a.label) {
163
- case 0: return [4 /*yield*/, control.controlLocator.fill(textTobeEntered).then(function () {
165
+ case 0: return [4 /*yield*/, control.controlLocator.first().fill(textTobeEntered).then(function () {
164
166
  if (control.controlDescription.trim().toLowerCase().endsWith('textbox')) {
165
167
  (0, logs_core_1.logAction)("Entered '" + textTobeEntered + "' in '" + control.controlDescription + "'");
166
168
  }
@@ -169,6 +171,7 @@ var Actions = /** @class */ (function (_super) {
169
171
  }
170
172
  }, function (error) {
171
173
  (0, logs_core_1.errorLog)("Unable to enter text in '" + control.controlDescription + "' textbox due to reason: " + error);
174
+ throw error;
172
175
  })];
173
176
  case 1:
174
177
  _a.sent();
@@ -193,7 +196,7 @@ var Actions = /** @class */ (function (_super) {
193
196
  return __awaiter(this, void 0, void 0, function () {
194
197
  return __generator(this, function (_a) {
195
198
  switch (_a.label) {
196
- case 0: return [4 /*yield*/, control.controlLocator.press(key).then(function () {
199
+ case 0: return [4 /*yield*/, control.controlLocator.first().press(key).then(function () {
197
200
  (0, logs_core_1.logAction)("Press Key '" + key.toUpperCase() + "' on '" + control.controlDescription + "'");
198
201
  })];
199
202
  case 1:
@@ -218,12 +221,18 @@ var Actions = /** @class */ (function (_super) {
218
221
  Actions.prototype.selectFromDropdownByValue = function (control, optionTobeSelcted) {
219
222
  return __awaiter(this, void 0, void 0, function () {
220
223
  return __generator(this, function (_a) {
221
- control.controlLocator.selectOption({ value: optionTobeSelcted }).then(function () {
222
- (0, logs_core_1.logAction)("Selected '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
223
- }, function () {
224
- (0, logs_core_1.errorLog)("'Unable to select '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
225
- });
226
- return [2 /*return*/];
224
+ switch (_a.label) {
225
+ case 0: return [4 /*yield*/, control.controlLocator.first().selectOption({ value: optionTobeSelcted }).then(function () {
226
+ (0, logs_core_1.logAction)("Selected '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
227
+ }, function (error) {
228
+ (0, logs_core_1.errorLog)("Unable to select '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
229
+ (0, logs_core_1.consoleLog)("Error: '" + error + "'");
230
+ throw error;
231
+ })];
232
+ case 1:
233
+ _a.sent();
234
+ return [2 /*return*/];
235
+ }
227
236
  });
228
237
  });
229
238
  };
@@ -242,12 +251,18 @@ var Actions = /** @class */ (function (_super) {
242
251
  Actions.prototype.selectDropDownByText = function (control, optionTobeSelcted) {
243
252
  return __awaiter(this, void 0, void 0, function () {
244
253
  return __generator(this, function (_a) {
245
- control.controlLocator.selectOption({ label: optionTobeSelcted }).then(function () {
246
- (0, logs_core_1.logAction)("Selected '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
247
- }, function () {
248
- (0, logs_core_1.errorLog)("'Unable to select '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
249
- });
250
- return [2 /*return*/];
254
+ switch (_a.label) {
255
+ case 0: return [4 /*yield*/, control.controlLocator.first().selectOption({ label: optionTobeSelcted }).then(function () {
256
+ (0, logs_core_1.logAction)("Selected '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
257
+ }, function (error) {
258
+ (0, logs_core_1.errorLog)("Unable to select '" + optionTobeSelcted + "' from '" + control.controlDescription + "");
259
+ (0, logs_core_1.consoleLog)("Error: '" + error + "'");
260
+ throw error;
261
+ })];
262
+ case 1:
263
+ _a.sent();
264
+ return [2 /*return*/];
265
+ }
251
266
  });
252
267
  });
253
268
  };
@@ -266,12 +281,18 @@ var Actions = /** @class */ (function (_super) {
266
281
  Actions.prototype.selectFromDropdownByIndex = function (control, index) {
267
282
  return __awaiter(this, void 0, void 0, function () {
268
283
  return __generator(this, function (_a) {
269
- control.controlLocator.first().selectOption({ index: index }).then(function () {
270
- (0, logs_core_1.logAction)("Selected '" + index + "' option from '" + control.controlDescription + "'");
271
- }, function () {
272
- (0, logs_core_1.errorLog)("'Unable to select '" + index + "' option from '" + control.controlDescription + "'");
273
- });
274
- return [2 /*return*/];
284
+ switch (_a.label) {
285
+ case 0: return [4 /*yield*/, control.controlLocator.first().selectOption({ index: index }).then(function () {
286
+ (0, logs_core_1.logAction)("Selected '" + index + "' option from '" + control.controlDescription + "'");
287
+ }, function (error) {
288
+ (0, logs_core_1.errorLog)("Unable to select '" + index + "' option from '" + control.controlDescription + "'");
289
+ (0, logs_core_1.errorLog)("Error: '" + error + "'");
290
+ throw error;
291
+ })];
292
+ case 1:
293
+ _a.sent();
294
+ return [2 /*return*/];
295
+ }
275
296
  });
276
297
  });
277
298
  };
@@ -298,10 +319,16 @@ var Actions = /** @class */ (function (_super) {
298
319
  if (!(expectedCheckboxValue == true)) return [3 /*break*/, 2];
299
320
  control.controlLocator.first().check().then(function () {
300
321
  (0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as checked");
322
+ }, function (error) {
323
+ (0, logs_core_1.errorLog)("Unable Set checkbox value of '" + control.controlDescription + "' as checked");
324
+ throw error;
301
325
  });
302
326
  return [3 /*break*/, 4];
303
327
  case 2: return [4 /*yield*/, control.controlLocator.first().uncheck().then(function () {
304
328
  (0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as unchecked");
329
+ }, function (error) {
330
+ (0, logs_core_1.errorLog)("Unable Set checkbox value of '" + control.controlDescription + "' as unchecked");
331
+ throw error;
305
332
  })];
306
333
  case 3:
307
334
  _a.sent();
@@ -325,19 +352,14 @@ var Actions = /** @class */ (function (_super) {
325
352
  */
326
353
  Actions.prototype.isSelected = function (control) {
327
354
  return __awaiter(this, void 0, void 0, function () {
355
+ var isChecked;
328
356
  return __generator(this, function (_a) {
329
357
  switch (_a.label) {
330
- case 0: return [4 /*yield*/, control.controlLocator.first().isChecked().then(function (value) {
331
- if (value) {
332
- (0, logs_core_1.consoleLog)("'" + control.controlDescription + "' checkbox is selected");
333
- }
334
- else {
335
- (0, logs_core_1.consoleLog)("'" + control.controlDescription + "' checkbox is not selected");
336
- }
337
- })];
358
+ case 0: return [4 /*yield*/, control.controlLocator.first().isChecked()];
338
359
  case 1:
339
- _a.sent();
340
- return [2 /*return*/, control.controlLocator.first().first().isChecked()];
360
+ isChecked = _a.sent();
361
+ (0, logs_core_1.consoleLog)("'".concat(control.controlDescription, "' checkbox is ").concat(isChecked ? 'selected' : 'not selected'));
362
+ return [2 /*return*/, isChecked];
341
363
  }
342
364
  });
343
365
  });
@@ -359,16 +381,10 @@ var Actions = /** @class */ (function (_super) {
359
381
  return __generator(this, function (_a) {
360
382
  switch (_a.label) {
361
383
  case 0: return [4 /*yield*/, control.controlLocator.first().isEnabled().then(function (value) {
362
- if (value) {
363
- (0, logs_core_1.consoleLog)("'" + control.controlDescription + "' is enabled");
364
- }
365
- else {
366
- (0, logs_core_1.consoleLog)("'" + control.controlDescription + "' is not enabled");
367
- }
384
+ (0, logs_core_1.consoleLog)("'".concat(control.controlDescription, "' is ").concat(value ? 'enabled' : 'not enabled'));
385
+ return value;
368
386
  })];
369
- case 1:
370
- _a.sent();
371
- return [2 /*return*/, control.controlLocator.first().isEnabled()];
387
+ case 1: return [2 /*return*/, _a.sent()];
372
388
  }
373
389
  });
374
390
  });
@@ -387,19 +403,14 @@ var Actions = /** @class */ (function (_super) {
387
403
  */
388
404
  Actions.prototype.isDisplayed = function (control) {
389
405
  return __awaiter(this, void 0, void 0, function () {
406
+ var isVisible;
390
407
  return __generator(this, function (_a) {
391
408
  switch (_a.label) {
392
- case 0: return [4 /*yield*/, control.controlLocator.first().isVisible().then(function (value) {
393
- if (value) {
394
- (0, logs_core_1.consoleLog)("'" + control.controlDescription + "' is displayed");
395
- }
396
- else {
397
- (0, logs_core_1.consoleLog)("'" + control.controlDescription + "' is not displayed");
398
- }
399
- })];
409
+ case 0: return [4 /*yield*/, control.controlLocator.first().isVisible()];
400
410
  case 1:
401
- _a.sent();
402
- return [2 /*return*/, control.controlLocator.first().isVisible()];
411
+ isVisible = _a.sent();
412
+ (0, logs_core_1.consoleLog)("'".concat(control.controlDescription, "' is ").concat(isVisible ? 'displayed' : 'not displayed'));
413
+ return [2 /*return*/, isVisible];
403
414
  }
404
415
  });
405
416
  });
@@ -421,12 +432,11 @@ var Actions = /** @class */ (function (_super) {
421
432
  switch (_a.label) {
422
433
  case 0: return [4 /*yield*/, control.controlLocator.first().innerText().then(function (value) {
423
434
  (0, logs_core_1.consoleLog)("Value is read from '" + control.controlDescription + "' is: '" + value + "'");
435
+ return value;
424
436
  }, function (error) {
425
437
  (0, logs_core_1.errorLog)("Unable to read the text from '" + control.controlDescription + "' due to reason: " + error);
426
438
  })];
427
- case 1:
428
- _a.sent();
429
- return [2 /*return*/, control.controlLocator.first().innerText()];
439
+ case 1: return [2 /*return*/, _a.sent()];
430
440
  }
431
441
  });
432
442
  });
@@ -448,13 +458,11 @@ var Actions = /** @class */ (function (_super) {
448
458
  switch (_a.label) {
449
459
  case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
450
460
  (0, logs_core_1.consoleLog)("Value is read from textbox '" + control.controlDescription + "' is: '" + value + "'");
461
+ return value;
451
462
  }, function (error) {
452
463
  (0, logs_core_1.errorLog)("Unable to read the value from '" + control.controlDescription + "' due to reason: " + error);
453
464
  })];
454
- case 1:
455
- _a.sent();
456
- return [4 /*yield*/, control.controlLocator.first().inputValue()];
457
- case 2: return [2 /*return*/, _a.sent()];
465
+ case 1: return [2 /*return*/, _a.sent()];
458
466
  }
459
467
  });
460
468
  });
@@ -476,13 +484,11 @@ var Actions = /** @class */ (function (_super) {
476
484
  switch (_a.label) {
477
485
  case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
478
486
  (0, logs_core_1.consoleLog)("Value is read from '" + control.controlDescription + "' is: '" + value + "'");
487
+ return value;
479
488
  }, function (error) {
480
489
  (0, logs_core_1.errorLog)("Unable to read the value '" + control.controlDescription + "' due to reason: " + error);
481
490
  })];
482
- case 1:
483
- _a.sent();
484
- return [4 /*yield*/, control.controlLocator.first().inputValue()];
485
- case 2: return [2 /*return*/, _a.sent()];
491
+ case 1: return [2 /*return*/, _a.sent()];
486
492
  }
487
493
  });
488
494
  });
@@ -509,10 +515,7 @@ var Actions = /** @class */ (function (_super) {
509
515
  }, function (reason) {
510
516
  (0, logs_core_1.errorLog)("Unable to read attribute value from '" + control.controlDescription + "' reason: '" + reason + "'");
511
517
  })];
512
- case 1:
513
- _a.sent();
514
- return [4 /*yield*/, control.controlLocator.first().getAttribute(attributeName)];
515
- case 2: return [2 /*return*/, _a.sent()];
518
+ case 1: return [2 /*return*/, _a.sent()];
516
519
  }
517
520
  });
518
521
  });
@@ -580,6 +583,9 @@ var Actions = /** @class */ (function (_super) {
580
583
  return [4 /*yield*/, dialog.accept().then(function () {
581
584
  (0, logs_core_1.logAction)('Alert is accepted');
582
585
  return true;
586
+ }, function (error) {
587
+ (0, logs_core_1.errorLog)("Unable to accept alert: " + error);
588
+ throw error;
583
589
  })];
584
590
  case 1:
585
591
  _a.sent();
@@ -587,6 +593,9 @@ var Actions = /** @class */ (function (_super) {
587
593
  case 2: return [4 /*yield*/, dialog.dismiss().then(function () {
588
594
  (0, logs_core_1.logAction)('Alert is dismissed');
589
595
  return false;
596
+ }, function (error) {
597
+ (0, logs_core_1.errorLog)("Unable to dismiss alert: " + error);
598
+ throw error;
590
599
  })];
591
600
  case 3:
592
601
  _a.sent();
@@ -689,15 +698,16 @@ var Actions = /** @class */ (function (_super) {
689
698
  *
690
699
  * waitTillPageURLContains("https://www.google.com/");
691
700
  */
692
- Actions.prototype.waitTillPageURLContains = function (url) {
693
- return __awaiter(this, void 0, void 0, function () {
701
+ Actions.prototype.waitTillPageURLContains = function (url_1) {
702
+ return __awaiter(this, arguments, void 0, function (url, timeoutInSeconds) {
694
703
  var error_1;
704
+ if (timeoutInSeconds === void 0) { timeoutInSeconds = 30; }
695
705
  return __generator(this, function (_a) {
696
706
  switch (_a.label) {
697
707
  case 0:
698
708
  _a.trys.push([0, 2, , 3]);
699
709
  return [4 /*yield*/, this.page.waitForURL(url, {
700
- timeout: 10000,
710
+ timeout: timeoutInSeconds * 1000,
701
711
  waitUntil: "load"
702
712
  })];
703
713
  case 1: return [2 /*return*/, _a.sent()];
@@ -720,9 +730,10 @@ var Actions = /** @class */ (function (_super) {
720
730
  *
721
731
  * waitTillElementIsPresent(usernameTxtbx);
722
732
  */
723
- Actions.prototype.waitTillElementIsPresent = function (control) {
724
- return __awaiter(this, void 0, void 0, function () {
733
+ Actions.prototype.waitTillElementIsPresent = function (control_1) {
734
+ return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
725
735
  var error_2;
736
+ if (timeoutInSeconds === void 0) { timeoutInSeconds = 30; }
726
737
  return __generator(this, function (_a) {
727
738
  switch (_a.label) {
728
739
  case 0: return [4 /*yield*/, this.page.waitForLoadState("domcontentloaded")];
@@ -733,7 +744,7 @@ var Actions = /** @class */ (function (_super) {
733
744
  _a.trys.push([2, 4, , 5]);
734
745
  return [4 /*yield*/, control.controlLocator.waitFor({
735
746
  state: "visible",
736
- timeout: 10000
747
+ timeout: timeoutInSeconds * 1000,
737
748
  })];
738
749
  case 3:
739
750
  _a.sent();
@@ -757,9 +768,10 @@ var Actions = /** @class */ (function (_super) {
757
768
  *
758
769
  * waitTillElementIsAttached(usernameTxtbx);
759
770
  */
760
- Actions.prototype.waitTillElementIsAttached = function (control) {
761
- return __awaiter(this, void 0, void 0, function () {
771
+ Actions.prototype.waitTillElementIsAttached = function (control_1) {
772
+ return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
762
773
  var error_3;
774
+ if (timeoutInSeconds === void 0) { timeoutInSeconds = 30; }
763
775
  return __generator(this, function (_a) {
764
776
  switch (_a.label) {
765
777
  case 0: return [4 /*yield*/, this.page.waitForLoadState("domcontentloaded")];
@@ -770,7 +782,7 @@ var Actions = /** @class */ (function (_super) {
770
782
  _a.trys.push([2, 4, , 5]);
771
783
  return [4 /*yield*/, control.controlLocator.waitFor({
772
784
  state: "attached",
773
- timeout: 10000
785
+ timeout: timeoutInSeconds * 1000,
774
786
  })];
775
787
  case 3:
776
788
  _a.sent();
@@ -794,16 +806,17 @@ var Actions = /** @class */ (function (_super) {
794
806
  *
795
807
  * waitTillElementIsNotPresent(usernameTxtbx);
796
808
  */
797
- Actions.prototype.waitTillElementIsNotPresent = function (control) {
798
- return __awaiter(this, void 0, void 0, function () {
809
+ Actions.prototype.waitTillElementIsNotPresent = function (control_1) {
810
+ return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
799
811
  var error_4;
812
+ if (timeoutInSeconds === void 0) { timeoutInSeconds = 30; }
800
813
  return __generator(this, function (_a) {
801
814
  switch (_a.label) {
802
815
  case 0:
803
816
  _a.trys.push([0, 2, , 3]);
804
817
  return [4 /*yield*/, control.controlLocator.waitFor({
805
818
  state: "hidden",
806
- timeout: 10000
819
+ timeout: timeoutInSeconds * 1000,
807
820
  })];
808
821
  case 1:
809
822
  _a.sent();
@@ -831,7 +844,22 @@ var Actions = /** @class */ (function (_super) {
831
844
  return __generator(this, function (_a) {
832
845
  switch (_a.label) {
833
846
  case 0: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, timeInSeconds * 1000); })];
834
- case 1: return [2 /*return*/, _a.sent()];
847
+ case 1:
848
+ _a.sent();
849
+ return [2 /*return*/];
850
+ }
851
+ });
852
+ });
853
+ };
854
+ Actions.prototype.waitForPageTimeout = function () {
855
+ return __awaiter(this, arguments, void 0, function (timeoutInSeconds) {
856
+ if (timeoutInSeconds === void 0) { timeoutInSeconds = 5; }
857
+ return __generator(this, function (_a) {
858
+ switch (_a.label) {
859
+ case 0: return [4 /*yield*/, this.page.waitForTimeout(timeoutInSeconds * 1000)];
860
+ case 1:
861
+ _a.sent();
862
+ return [2 /*return*/];
835
863
  }
836
864
  });
837
865
  });
@@ -98,7 +98,7 @@ var Assertion = /** @class */ (function (_super) {
98
98
  Assertion.prototype.verifyIsContains = function (actual, expected) {
99
99
  try {
100
100
  var verificationResult = actual.trim().includes(expected.trim()) ? "PASSED" : "Failed";
101
- (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Actual: '").concat(actual, "' contains Expected: '").concat(expected.trim(), "'"));
101
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Actual: '").concat(actual, "' contains Expected: '").concat(expected.trim(), "'"));
102
102
  (0, test_1.expect)(actual.trim()).toContain(expected.trim());
103
103
  }
104
104
  catch (error1) {
@@ -266,9 +266,9 @@ var Assertion = /** @class */ (function (_super) {
266
266
  return __generator(this, function (_a) {
267
267
  switch (_a.label) {
268
268
  case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
269
- var verificationResult = value.trim() === expectedText.trim() ? "PASSED" : "Failed";
269
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText.trim() ? "PASSED" : "Failed";
270
270
  (0, logs_core_1.logVerification)("VERIFICATION: '".concat(verificationResult, "'. Expected: '").concat(expectedText, "' Actual: '").concat(value, "'"));
271
- (0, test_1.expect)(value.trim()).toBe(expectedText.trim());
271
+ (0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim()).toBe(expectedText.trim());
272
272
  })];
273
273
  case 1:
274
274
  _a.sent();
@@ -294,9 +294,9 @@ var Assertion = /** @class */ (function (_super) {
294
294
  return __generator(this, function (_a) {
295
295
  switch (_a.label) {
296
296
  case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
297
- var verificationResult = value.trim().includes(expectedText.trim()) ? "PASSED" : "Failed";
298
- (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(expectedText.trim(), "' is present in Actual: '").concat(value.trim(), "'"));
299
- (0, test_1.expect)(value.trim()).toContain(expectedText.trim());
297
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim())) ? "PASSED" : "Failed";
298
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(expectedText.trim(), "' is present in Actual: '").concat(value === null || value === void 0 ? void 0 : value.trim(), "'"));
299
+ (0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim()).toContain(expectedText.trim());
300
300
  })];
301
301
  case 1:
302
302
  _a.sent();
@@ -322,9 +322,9 @@ var Assertion = /** @class */ (function (_super) {
322
322
  return __generator(this, function (_a) {
323
323
  switch (_a.label) {
324
324
  case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
325
- var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "Failed";
325
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "PASSED" : "Failed";
326
326
  (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(expectedText, "' is present in Actual: '").concat(value, "' "));
327
- (0, test_1.expect)(false).toBe(value.trim().includes(expectedText.trim()));
327
+ (0, test_1.expect)(false).toBe(value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim()));
328
328
  })];
329
329
  case 1:
330
330
  _a.sent();
@@ -12,6 +12,6 @@ export declare class BasePage {
12
12
  * and URL provided in AppConfigurations.json
13
13
  */
14
14
  initializeBrowser(url?: string): Promise<void>;
15
- static setTestCaseID(testInfo: TestInfo, testCaseID?: string): void;
15
+ static setTestCaseID(testInfo: TestInfo, testCaseID?: number): void;
16
16
  static executionCompleted(testinfo: TestInfo): void;
17
17
  }
@@ -59,7 +59,7 @@ var BasePage = /** @class */ (function () {
59
59
  switch (_a.label) {
60
60
  case 0: return [4 /*yield*/, this.page.goto(url, {
61
61
  waitUntil: "load",
62
- timeout: 20000
62
+ timeout: 30000
63
63
  }).then(function () {
64
64
  (0, logs_core_1.logAction)("Navigated to URL: " + url);
65
65
  })];
@@ -71,16 +71,16 @@ var BasePage = /** @class */ (function () {
71
71
  });
72
72
  };
73
73
  BasePage.setTestCaseID = function (testInfo, testCaseID) {
74
- if (testCaseID === void 0) { testCaseID = "0"; }
75
- testInfo.testId = testCaseID.toString();
74
+ if (testCaseID === void 0) { testCaseID = 0; }
75
+ var testId = testInfo.testId;
76
76
  (0, logs_core_1.logTestResult)('');
77
- (0, logs_core_1.logTestResult)("===== START Of Execution For TC ID: ".concat(testInfo.testId, " Title: '").concat(testInfo.title, "' ======"));
77
+ (0, logs_core_1.logTestResult)("===== START Of Execution For TestCase ID: " + testId + " Title: '" + testInfo.title + "' ======");
78
78
  (0, logs_core_1.logTestResult)('');
79
79
  };
80
80
  BasePage.executionCompleted = function (testinfo) {
81
81
  var _a;
82
82
  (0, logs_core_1.logTestResult)('');
83
- (0, logs_core_1.logTestResult)("===== END Of Execution For Test Case: ' ".concat(testinfo.title, " ' With Test Result: ' ").concat((_a = testinfo.status) === null || _a === void 0 ? void 0 : _a.toUpperCase(), "' ====="));
83
+ (0, logs_core_1.logTestResult)("===== END Of Execution For Test Case: '" + testinfo.testId + "-" + testinfo.title + "' With Test Result: '" + ((_a = testinfo.status) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + "' =====");
84
84
  (0, logs_core_1.logTestResult)('');
85
85
  };
86
86
  return BasePage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ts-automationframework",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@playwright/test": "^1.47.2",
23
- "@types/node": "^20.16.9",
23
+ "@types/node": "^20.16.10",
24
24
  "log4js": "^6.9.1",
25
25
  "nodemailer": "^6.9.15",
26
26
  "npm": "^10.8.3",