playwright-ts-automationframework 1.1.41 → 1.1.42

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.
@@ -172,7 +172,7 @@ export declare class Actions extends BasePage {
172
172
  *
173
173
  * let errorMessage = getText(errorMsg);
174
174
  */
175
- getText(control: WebControl): Promise<string | void>;
175
+ getText(control: WebControl): Promise<string>;
176
176
  /**
177
177
  * Read textbox value of an element
178
178
  *
@@ -184,7 +184,7 @@ export declare class Actions extends BasePage {
184
184
  *
185
185
  * let textboxValue = getTextboxValue(usernameTxtbx);
186
186
  */
187
- getTextboxValue(control: WebControl): Promise<string | void>;
187
+ getTextboxValue(control: WebControl): Promise<string>;
188
188
  /**
189
189
  * Read selected dropdown item.
190
190
  *
@@ -196,7 +196,7 @@ export declare class Actions extends BasePage {
196
196
  *
197
197
  * let selectedItem = getSelectedItemFromDropdown(cityDrpdwn);
198
198
  */
199
- getSelectedItemFromDropdown(control: WebControl): Promise<string | void>;
199
+ getSelectedItemFromDropdown(control: WebControl): Promise<string>;
200
200
  /**
201
201
  * Read attribute value of element.
202
202
  *
@@ -209,7 +209,7 @@ export declare class Actions extends BasePage {
209
209
  *
210
210
  * let attributeValue = getAttributeValue(usernameTxtbx, "title");
211
211
  */
212
- getAttributeValue(control: WebControl, attributeName: string): Promise<string | void | null>;
212
+ getAttributeValue(control: WebControl, attributeName: string): Promise<string | null>;
213
213
  /**
214
214
  * Scroll to an element.
215
215
  *
@@ -460,15 +460,21 @@ var Actions = /** @class */ (function (_super) {
460
460
  */
461
461
  Actions.prototype.getText = function (control) {
462
462
  return __awaiter(this, void 0, void 0, function () {
463
+ var text, error_1;
463
464
  return __generator(this, function (_a) {
464
465
  switch (_a.label) {
465
- case 0: return [4 /*yield*/, control.controlLocator.first().innerText().then(function (value) {
466
- (0, logs_core_1.logConsole)("Value is read from '" + control.controlDescription + "' is: '" + value + "'");
467
- return value;
468
- }, function (error) {
469
- (0, logs_core_1.logError)("Unable to read the text from '" + control.controlDescription + "' due to reason: " + error);
470
- })];
471
- case 1: return [2 /*return*/, _a.sent()];
466
+ case 0:
467
+ _a.trys.push([0, 2, , 3]);
468
+ return [4 /*yield*/, control.controlLocator.first().innerText()];
469
+ case 1:
470
+ text = _a.sent();
471
+ (0, logs_core_1.logConsole)("Value read from '".concat(control.controlDescription, "' is: '").concat(text, "'"));
472
+ return [2 /*return*/, text];
473
+ case 2:
474
+ error_1 = _a.sent();
475
+ (0, logs_core_1.logError)("Unable to read the text from '".concat(control.controlDescription, "' due to reason: ").concat(error_1));
476
+ return [2 /*return*/, '']; // Return an empty string or handle it as needed
477
+ case 3: return [2 /*return*/];
472
478
  }
473
479
  });
474
480
  });
@@ -486,15 +492,21 @@ var Actions = /** @class */ (function (_super) {
486
492
  */
487
493
  Actions.prototype.getTextboxValue = function (control) {
488
494
  return __awaiter(this, void 0, void 0, function () {
495
+ var value, error_2;
489
496
  return __generator(this, function (_a) {
490
497
  switch (_a.label) {
491
- case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
492
- (0, logs_core_1.logConsole)("Value is read from textbox '" + control.controlDescription + "' is: '" + value + "'");
493
- return value;
494
- }, function (error) {
495
- (0, logs_core_1.logError)("Unable to read the value from '" + control.controlDescription + "' due to reason: " + error);
496
- })];
497
- case 1: return [2 /*return*/, _a.sent()];
498
+ case 0:
499
+ _a.trys.push([0, 2, , 3]);
500
+ return [4 /*yield*/, control.controlLocator.first().inputValue()];
501
+ case 1:
502
+ value = _a.sent();
503
+ (0, logs_core_1.logConsole)("Value read from textbox '".concat(control.controlDescription, "' is: '").concat(value, "'"));
504
+ return [2 /*return*/, value];
505
+ case 2:
506
+ error_2 = _a.sent();
507
+ (0, logs_core_1.logError)("Unable to read the value from '".concat(control.controlDescription, "' due to reason: ").concat(error_2));
508
+ return [2 /*return*/, '']; // Return an empty string or handle it as needed
509
+ case 3: return [2 /*return*/];
498
510
  }
499
511
  });
500
512
  });
@@ -512,15 +524,21 @@ var Actions = /** @class */ (function (_super) {
512
524
  */
513
525
  Actions.prototype.getSelectedItemFromDropdown = function (control) {
514
526
  return __awaiter(this, void 0, void 0, function () {
527
+ var value, error_3;
515
528
  return __generator(this, function (_a) {
516
529
  switch (_a.label) {
517
- case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
518
- (0, logs_core_1.logConsole)("Value is read from '" + control.controlDescription + "' is: '" + value + "'");
519
- return value;
520
- }, function (error) {
521
- (0, logs_core_1.logError)("Unable to read the value '" + control.controlDescription + "' due to reason: " + error);
522
- })];
523
- case 1: return [2 /*return*/, _a.sent()];
530
+ case 0:
531
+ _a.trys.push([0, 2, , 3]);
532
+ return [4 /*yield*/, control.controlLocator.first().inputValue()];
533
+ case 1:
534
+ value = _a.sent();
535
+ (0, logs_core_1.logConsole)("Value read from '".concat(control.controlDescription, "' is: '").concat(value, "'"));
536
+ return [2 /*return*/, value];
537
+ case 2:
538
+ error_3 = _a.sent();
539
+ (0, logs_core_1.logError)("Unable to read the value from '".concat(control.controlDescription, "' due to reason: ").concat(error_3));
540
+ return [2 /*return*/, '']; // Return an empty string or handle it as needed
541
+ case 3: return [2 /*return*/];
524
542
  }
525
543
  });
526
544
  });
@@ -539,15 +557,21 @@ var Actions = /** @class */ (function (_super) {
539
557
  */
540
558
  Actions.prototype.getAttributeValue = function (control, attributeName) {
541
559
  return __awaiter(this, void 0, void 0, function () {
560
+ var value, error_4;
542
561
  return __generator(this, function (_a) {
543
562
  switch (_a.label) {
544
- case 0: return [4 /*yield*/, control.controlLocator.first().getAttribute(attributeName).then(function (value) {
545
- (0, logs_core_1.logConsole)("Attribute value for '" + control.controlDescription + "' is Attribute name: '" + attributeName + "' Value: '" + value + "'");
546
- return value;
547
- }, function (reason) {
548
- (0, logs_core_1.logError)("Unable to read attribute value from '" + control.controlDescription + "' reason: '" + reason + "'");
549
- })];
550
- case 1: return [2 /*return*/, _a.sent()];
563
+ case 0:
564
+ _a.trys.push([0, 2, , 3]);
565
+ return [4 /*yield*/, control.controlLocator.first().getAttribute(attributeName)];
566
+ case 1:
567
+ value = _a.sent();
568
+ (0, logs_core_1.logConsole)("Attribute value for '".concat(control.controlDescription, "' - Attribute Name: '").concat(attributeName, "', Value: '").concat(value, "'"));
569
+ return [2 /*return*/, value];
570
+ case 2:
571
+ error_4 = _a.sent();
572
+ (0, logs_core_1.logError)("Unable to read attribute value from '".concat(control.controlDescription, "' - Reason: ").concat(error_4));
573
+ return [2 /*return*/, null]; // Return `null` instead of `undefined` if an error occurs
574
+ case 3: return [2 /*return*/];
551
575
  }
552
576
  });
553
577
  });
@@ -732,7 +756,7 @@ var Actions = /** @class */ (function (_super) {
732
756
  */
733
757
  Actions.prototype.waitTillPageURLContains = function (url_1) {
734
758
  return __awaiter(this, arguments, void 0, function (url, timeoutInSeconds) {
735
- var error_1;
759
+ var error_5;
736
760
  if (timeoutInSeconds === void 0) { timeoutInSeconds = 30; }
737
761
  return __generator(this, function (_a) {
738
762
  switch (_a.label) {
@@ -744,7 +768,7 @@ var Actions = /** @class */ (function (_super) {
744
768
  })];
745
769
  case 1: return [2 /*return*/, _a.sent()];
746
770
  case 2:
747
- error_1 = _a.sent();
771
+ error_5 = _a.sent();
748
772
  return [3 /*break*/, 3];
749
773
  case 3: return [2 /*return*/];
750
774
  }
@@ -764,7 +788,7 @@ var Actions = /** @class */ (function (_super) {
764
788
  */
765
789
  Actions.prototype.waitTillElementIsPresent = function (control_1) {
766
790
  return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
767
- var error_2;
791
+ var error_6;
768
792
  if (timeoutInSeconds === void 0) { timeoutInSeconds = 30; }
769
793
  return __generator(this, function (_a) {
770
794
  switch (_a.label) {
@@ -782,7 +806,7 @@ var Actions = /** @class */ (function (_super) {
782
806
  _a.sent();
783
807
  return [3 /*break*/, 5];
784
808
  case 4:
785
- error_2 = _a.sent();
809
+ error_6 = _a.sent();
786
810
  return [3 /*break*/, 5];
787
811
  case 5: return [2 /*return*/];
788
812
  }
@@ -802,7 +826,7 @@ var Actions = /** @class */ (function (_super) {
802
826
  */
803
827
  Actions.prototype.waitTillElementIsAttached = function (control_1) {
804
828
  return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
805
- var error_3;
829
+ var error_7;
806
830
  if (timeoutInSeconds === void 0) { timeoutInSeconds = 30; }
807
831
  return __generator(this, function (_a) {
808
832
  switch (_a.label) {
@@ -820,7 +844,7 @@ var Actions = /** @class */ (function (_super) {
820
844
  _a.sent();
821
845
  return [3 /*break*/, 5];
822
846
  case 4:
823
- error_3 = _a.sent();
847
+ error_7 = _a.sent();
824
848
  return [3 /*break*/, 5];
825
849
  case 5: return [2 /*return*/];
826
850
  }
@@ -840,7 +864,7 @@ var Actions = /** @class */ (function (_super) {
840
864
  */
841
865
  Actions.prototype.waitTillElementIsNotPresent = function (control_1) {
842
866
  return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
843
- var error_4;
867
+ var error_8;
844
868
  if (timeoutInSeconds === void 0) { timeoutInSeconds = 30; }
845
869
  return __generator(this, function (_a) {
846
870
  switch (_a.label) {
@@ -854,7 +878,7 @@ var Actions = /** @class */ (function (_super) {
854
878
  _a.sent();
855
879
  return [3 /*break*/, 3];
856
880
  case 2:
857
- error_4 = _a.sent();
881
+ error_8 = _a.sent();
858
882
  return [3 /*break*/, 3];
859
883
  case 3: return [2 /*return*/];
860
884
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ts-automationframework",
3
- "version": "1.1.41",
3
+ "version": "1.1.42",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",