playwright-ts-automationframework 1.1.38 → 1.1.40

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.
@@ -174,6 +174,19 @@ export declare class Assertion extends Actions {
174
174
  */
175
175
  verifyInnerText(control: WebControl, expectedText: string): Promise<void>;
176
176
  /**
177
+ * Verify element's input text is equal to expected value
178
+ * If expected element's inner value to be expected value then test case gets passed else failed..
179
+ *
180
+ * @param control Textbox control.
181
+ * @param expectedText Expected value.
182
+ * Example:
183
+ *
184
+ * usernameTxtbx = new WebControl(this.page.locator('#username'), 'Username textbox');
185
+ *
186
+ * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
187
+ */
188
+ verifyInputValue(control: WebControl, expectedText: string): Promise<void>;
189
+ /**
177
190
  * Verify element's checkbox/radio value is equal to expected value
178
191
  * If expected element's checkbox/radio value to be expected value then test case gets passed else failed..
179
192
  *
@@ -79,7 +79,7 @@ var Assertion = /** @class */ (function (_super) {
79
79
  try {
80
80
  var verificationResult = object1 === object2 ? "PASSED" : "FAILED";
81
81
  (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". ").concat(controlDescription, " Expected: '").concat(object1, "' Actual: '").concat(object2, "'"));
82
- (0, test_1.expect)(object1).toBe(object2);
82
+ test_1.expect.soft(object1).toBe(object2);
83
83
  }
84
84
  catch (error1) {
85
85
  (0, logs_core_1.logError)("VERIFICATION: FAILED. Expected: '" + object1 + "' Actual: '" + object2 + "'");
@@ -102,7 +102,7 @@ var Assertion = /** @class */ (function (_super) {
102
102
  var verificationResult = actual.trim().includes(expected.trim()) ? "PASSED" : "FAILED";
103
103
  var logText = "VERIFICATION: ".concat(verificationResult, ". ").concat(controlDescription, " Actual: '").concat(actual, "' contains Expected: '").concat(expected.trim(), "'");
104
104
  (0, logs_core_1.logVerification)(logText);
105
- (0, test_1.expect)(actual.trim(), logText).toContain(expected.trim());
105
+ test_1.expect.soft(actual.trim(), logText).toContain(expected.trim());
106
106
  }
107
107
  catch (error1) {
108
108
  (0, logs_core_1.logError)("VERIFICATION: FAILED. Actual: '" + expected + "' contains Expected: '" + actual + "'");
@@ -135,7 +135,7 @@ var Assertion = /** @class */ (function (_super) {
135
135
  var verificationResult = value === expectedIsDisplayed ? "PASSED" : "FAILED";
136
136
  var logText = "VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' displayed status is '").concat(value, "' Expected: ").concat(expectedIsDisplayed);
137
137
  (0, logs_core_1.logVerification)(logText);
138
- (0, test_1.expect)(value, logText).toBe(expectedIsDisplayed);
138
+ test_1.expect.soft(value, logText).toBe(expectedIsDisplayed);
139
139
  }, function (reason) {
140
140
  (0, logs_core_1.logError)("VERIFICATION: FAILED. '" + control.controlDescription + "' displayed status is: '" + false + "' due to reason: " + reason);
141
141
  })];
@@ -184,7 +184,7 @@ var Assertion = /** @class */ (function (_super) {
184
184
  verificationResult = value === true ? "PASSED" : "FAILED";
185
185
  logText = "VERIFICATION: ".concat(verificationResult, ". '").concat(control.controlDescription, "' hidden status is '").concat(value, "' Expected: true");
186
186
  (0, logs_core_1.logVerification)(logText);
187
- return [4 /*yield*/, (0, test_1.expect)(element, logText).toBeHidden()];
187
+ return [4 /*yield*/, test_1.expect.soft(element, logText).toBeHidden()];
188
188
  case 1:
189
189
  _a.sent();
190
190
  return [2 /*return*/];
@@ -220,10 +220,10 @@ var Assertion = /** @class */ (function (_super) {
220
220
  case 0: return [4 /*yield*/, this.getAttributeValue(control, attributeName).then(function (value) { return __awaiter(_this, void 0, void 0, function () {
221
221
  var verificationResult, logText;
222
222
  return __generator(this, function (_a) {
223
- verificationResult = value === expectedAttributeValue ? "PASSED" : "FAILED";
223
+ verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedAttributeValue ? "PASSED" : "FAILED";
224
224
  logText = "VERIFICATION: ".concat(verificationResult, ". Attribute value of ").concat(control.controlDescription, " Expected: '").concat(expectedAttributeValue, "' Actual : '").concat(value, "'");
225
225
  (0, logs_core_1.logVerification)(logText);
226
- (0, test_1.expect)(value, logText).toBe(expectedAttributeValue);
226
+ test_1.expect.soft(value, logText).toBe(expectedAttributeValue);
227
227
  return [2 /*return*/];
228
228
  });
229
229
  }); })];
@@ -254,26 +254,26 @@ var Assertion = /** @class */ (function (_super) {
254
254
  return __generator(this, function (_a) {
255
255
  switch (_a.label) {
256
256
  case 0: return [4 /*yield*/, this.getAttributeValue(control, attributeName).then(function (value) { return __awaiter(_this, void 0, void 0, function () {
257
- var verificationResult, logText, _a, _b;
258
- return __generator(this, function (_c) {
259
- switch (_c.label) {
257
+ var verificationResult, logText, _a, _b, _c, _d;
258
+ return __generator(this, function (_e) {
259
+ switch (_e.label) {
260
260
  case 0:
261
261
  if (!(value != null)) return [3 /*break*/, 2];
262
262
  verificationResult = value.includes(attributeValue) ? "PASSED" : "FAILED";
263
263
  logText = "VERIFICATION: ".concat(verificationResult, ". Atribute value of ").concat(control.controlLocator, " Expected: '").concat(attributeValue, "' contains Actual : '").concat(value, "'");
264
264
  (0, logs_core_1.logVerification)(logText);
265
- _a = test_1.expect;
265
+ _b = (_a = test_1.expect).soft;
266
266
  return [4 /*yield*/, this.getAttributeValue(control, attributeName)];
267
267
  case 1:
268
- _a.apply(void 0, [_c.sent(), logText]).toContain(attributeValue);
268
+ _b.apply(_a, [_e.sent(), logText]).toContain(attributeValue);
269
269
  return [3 /*break*/, 4];
270
270
  case 2:
271
271
  (0, logs_core_1.logVerification)("VERIFICATION: FAILED. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'"));
272
- _b = test_1.expect;
272
+ _d = (_c = test_1.expect).soft;
273
273
  return [4 /*yield*/, this.getAttributeValue(control, attributeName)];
274
274
  case 3:
275
- _b.apply(void 0, [_c.sent(), "VERIFICATION: FAILED. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'")]).toContain(attributeValue);
276
- _c.label = 4;
275
+ _d.apply(_c, [_e.sent(), "VERIFICATION: FAILED. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'")]).toContain(attributeValue);
276
+ _e.label = 4;
277
277
  case 4: return [2 /*return*/];
278
278
  }
279
279
  });
@@ -312,7 +312,7 @@ var Assertion = /** @class */ (function (_super) {
312
312
  var verificationResult = value === expValue ? "PASSED" : "FAILED";
313
313
  var logText = "VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' enabled status is: '").concat(value, "' Expected: ").concat(expValue);
314
314
  (0, logs_core_1.logVerification)(logText);
315
- (0, test_1.expect)(value, logText).toBe(expValue);
315
+ test_1.expect.soft(value, logText).toBe(expValue);
316
316
  })];
317
317
  case 3:
318
318
  _a.sent();
@@ -345,7 +345,7 @@ var Assertion = /** @class */ (function (_super) {
345
345
  var verificationResult = isChecked === expValue ? "PASSED" : "FAILED";
346
346
  var logText = "VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' selected status is: '").concat(isChecked, "' Expected: ").concat(expValue);
347
347
  (0, logs_core_1.logVerification)(logText);
348
- (0, test_1.expect)(isChecked, logText).toBe(expValue);
348
+ test_1.expect.soft(isChecked, logText).toBe(expValue);
349
349
  })];
350
350
  case 3:
351
351
  _a.sent();
@@ -374,7 +374,7 @@ var Assertion = /** @class */ (function (_super) {
374
374
  var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText.trim() ? "PASSED" : "FAILED";
375
375
  var logText = "VERIFICATION: '".concat(verificationResult, "' Verify text of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
376
376
  (0, logs_core_1.logVerification)(logText);
377
- (0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toBe(expectedText.trim());
377
+ test_1.expect.soft(value === null || value === void 0 ? void 0 : value.trim(), logText).toBe(expectedText.trim());
378
378
  })];
379
379
  case 1:
380
380
  _a.sent();
@@ -403,7 +403,7 @@ var Assertion = /** @class */ (function (_super) {
403
403
  var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim())) ? "PASSED" : "FAILED";
404
404
  var logText = "VERIFICATION: ".concat(verificationResult, ". Verify text of ").concat(control.controlDescription, " .Expected: '").concat(expectedText.trim(), "' is present in Actual: '").concat(value === null || value === void 0 ? void 0 : value.trim(), "'");
405
405
  (0, logs_core_1.logVerification)(logText);
406
- (0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toContain(expectedText.trim());
406
+ test_1.expect.soft(value === null || value === void 0 ? void 0 : value.trim(), logText).toContain(expectedText.trim());
407
407
  })];
408
408
  case 1:
409
409
  _a.sent();
@@ -432,7 +432,7 @@ var Assertion = /** @class */ (function (_super) {
432
432
  var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "PASSED" : "FAILED";
433
433
  var logText = "VERIFICATION: ".concat(verificationResult, ". Verify text of ").concat(control.controlDescription, " Expected: '").concat(expectedText, "' does not contains Actual: '").concat(value, "'");
434
434
  (0, logs_core_1.logVerification)(logText);
435
- (0, test_1.expect)(false, logText).toBe(value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim()));
435
+ test_1.expect.soft(false, logText).toBe(value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim()));
436
436
  })];
437
437
  case 1:
438
438
  _a.sent();
@@ -458,10 +458,10 @@ var Assertion = /** @class */ (function (_super) {
458
458
  return __generator(this, function (_a) {
459
459
  switch (_a.label) {
460
460
  case 0: return [4 /*yield*/, control.controlLocator.first().getAttribute("value").then(function (value) {
461
- var verificationResult = value === expectedText ? "PASSED" : "FAILED";
461
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText ? "PASSED" : "FAILED";
462
462
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
463
463
  (0, logs_core_1.logVerification)(logText);
464
- (0, test_1.expect)(value, logText).toEqual(expectedText);
464
+ test_1.expect.soft(value, logText).toEqual(expectedText);
465
465
  })];
466
466
  case 1:
467
467
  _a.sent();
@@ -487,10 +487,39 @@ var Assertion = /** @class */ (function (_super) {
487
487
  return __generator(this, function (_a) {
488
488
  switch (_a.label) {
489
489
  case 0: return [4 /*yield*/, control.controlLocator.first().innerText().then(function (value) {
490
- var verificationResult = value === expectedText ? "PASSED" : "FAILED";
490
+ var verificationResult = value.trim() === expectedText ? "PASSED" : "FAILED";
491
491
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
492
492
  (0, logs_core_1.logVerification)(logText);
493
- (0, test_1.expect)(value, logText).toEqual(expectedText);
493
+ test_1.expect.soft(value, logText).toEqual(expectedText);
494
+ })];
495
+ case 1:
496
+ _a.sent();
497
+ return [2 /*return*/];
498
+ }
499
+ });
500
+ });
501
+ };
502
+ /**
503
+ * Verify element's input text is equal to expected value
504
+ * If expected element's inner value to be expected value then test case gets passed else failed..
505
+ *
506
+ * @param control Textbox control.
507
+ * @param expectedText Expected value.
508
+ * Example:
509
+ *
510
+ * usernameTxtbx = new WebControl(this.page.locator('#username'), 'Username textbox');
511
+ *
512
+ * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
513
+ */
514
+ Assertion.prototype.verifyInputValue = function (control, expectedText) {
515
+ return __awaiter(this, void 0, void 0, function () {
516
+ return __generator(this, function (_a) {
517
+ switch (_a.label) {
518
+ case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
519
+ var verificationResult = value.trim() === expectedText ? "PASSED" : "FAILED";
520
+ var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
521
+ (0, logs_core_1.logVerification)(logText);
522
+ test_1.expect.soft(value, logText).toEqual(expectedText);
494
523
  })];
495
524
  case 1:
496
525
  _a.sent();
@@ -519,7 +548,7 @@ var Assertion = /** @class */ (function (_super) {
519
548
  var verificationResult = value === isChecked ? "PASSED" : "FAILED";
520
549
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify checkbox value of ").concat(control.controlDescription, ". Expected: '").concat(value, "' Actual: '").concat(isChecked, "'");
521
550
  (0, logs_core_1.logVerification)(logText);
522
- (0, test_1.expect)(isChecked, logText).toBe(value);
551
+ test_1.expect.soft(isChecked, logText).toBe(value);
523
552
  })];
524
553
  case 1:
525
554
  _a.sent();
@@ -556,7 +585,7 @@ var Assertion = /** @class */ (function (_super) {
556
585
  verificationResult = (tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase()) == expectedTagName.toLowerCase() ? "PASSED" : "FAILED";
557
586
  logText = "VERIFICATION: ".concat(verificationResult, " Verify Tagname of ").concat(control.controlDescription, ". Expected: '").concat(expectedTagName.toLowerCase(), "' Actual: '").concat(tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase(), "'");
558
587
  (0, logs_core_1.logVerification)(logText);
559
- (0, test_1.expect)(tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase(), logText).toBe(expectedTagName.toLowerCase());
588
+ test_1.expect.soft(tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase(), logText).toBe(expectedTagName.toLowerCase());
560
589
  return [2 /*return*/];
561
590
  }
562
591
  });
@@ -588,7 +617,7 @@ var Assertion = /** @class */ (function (_super) {
588
617
  }).length;
589
618
  verificationResult = count >= 1 ? "PASSED" : "FAILED";
590
619
  (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". '").concat(valueToVerify, "' is Present in list '").concat(control.controlDescription, "'"));
591
- (0, test_1.expect)(count).toBeGreaterThanOrEqual(1);
620
+ test_1.expect.soft(count).toBeGreaterThanOrEqual(1);
592
621
  return [2 /*return*/];
593
622
  }
594
623
  });
@@ -632,7 +661,7 @@ var Assertion = /** @class */ (function (_super) {
632
661
  }).length;
633
662
  verificationResult = count >= 1 ? "PASSED" : "FAILED";
634
663
  (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". '").concat(expectedValue, "' is Present in list '").concat(control.controlDescription, "'"));
635
- (0, test_1.expect)(count).toBeGreaterThanOrEqual(1);
664
+ test_1.expect.soft(count).toBeGreaterThanOrEqual(1);
636
665
  return [2 /*return*/];
637
666
  }
638
667
  });
@@ -666,7 +695,7 @@ var Assertion = /** @class */ (function (_super) {
666
695
  return [4 /*yield*/, list[i].innerText().then(function (value) {
667
696
  var verificationResult = value.trim().includes(listOfValueToVerify[i]) ? "PASSED" : "FAILED";
668
697
  (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(listOfValueToVerify[i], "' Actual: '").concat(value, "'"));
669
- (0, test_1.expect)(value.trim()).toContain(listOfValueToVerify[i]);
698
+ test_1.expect.soft(value.trim()).toContain(listOfValueToVerify[i]);
670
699
  })];
671
700
  case 2:
672
701
  _b.sent();
@@ -709,7 +738,7 @@ var Assertion = /** @class */ (function (_super) {
709
738
  verificationResult = dialog.message().includes(expectedText) ? "PASSED" : "FAILED";
710
739
  logText = "VERIFICATION: ".concat(verificationResult, " Verify alert text. Expected: '").concat(expectedText, "' Actual: '").concat(dialog.message(), "'");
711
740
  (0, logs_core_1.logVerification)(logText);
712
- (0, test_1.expect)(dialog.message(), logText).toContain(expectedText);
741
+ test_1.expect.soft(dialog.message(), logText).toContain(expectedText);
713
742
  return [2 /*return*/];
714
743
  });
715
744
  }); });
@@ -734,7 +763,7 @@ var Assertion = /** @class */ (function (_super) {
734
763
  var verificationResult = value.includes(subString) ? "PASSED" : "FAILED";
735
764
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify URL contains. Expected: '").concat(subString, "' Actual: '").concat(value, "'");
736
765
  (0, logs_core_1.logVerification)(logText);
737
- (0, test_1.expect)(value, logText).toContain(subString);
766
+ test_1.expect.soft(value, logText).toContain(subString);
738
767
  })];
739
768
  case 1:
740
769
  _a.sent();
@@ -762,7 +791,7 @@ var Assertion = /** @class */ (function (_super) {
762
791
  var verificationResult = value == expectedCount ? "PASSED" : "FAILED";
763
792
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
764
793
  (0, logs_core_1.logVerification)(logText);
765
- (0, test_1.expect)(value, logText).toBe(expectedCount);
794
+ test_1.expect.soft(value, logText).toBe(expectedCount);
766
795
  })];
767
796
  case 1:
768
797
  _a.sent();
@@ -779,7 +808,7 @@ var Assertion = /** @class */ (function (_super) {
779
808
  var verificationResult = value >= expectedCount ? "PASSED" : "FAILED";
780
809
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
781
810
  (0, logs_core_1.logVerification)(logText);
782
- (0, test_1.expect)(value, logText).toBeGreaterThanOrEqual(expectedCount);
811
+ test_1.expect.soft(value, logText).toBeGreaterThanOrEqual(expectedCount);
783
812
  })];
784
813
  case 1:
785
814
  _a.sent();
@@ -796,7 +825,7 @@ var Assertion = /** @class */ (function (_super) {
796
825
  var verificationResult = value <= expectedCount ? "PASSED" : "FAILED";
797
826
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
798
827
  (0, logs_core_1.logVerification)(logText);
799
- (0, test_1.expect)(value, logText).toBeLessThanOrEqual(expectedCount);
828
+ test_1.expect.soft(value, logText).toBeLessThanOrEqual(expectedCount);
800
829
  })];
801
830
  case 1:
802
831
  _a.sent();
@@ -825,7 +854,7 @@ var Assertion = /** @class */ (function (_super) {
825
854
  var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
826
855
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify title contains. Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
827
856
  (0, logs_core_1.logVerification)(logText);
828
- (0, test_1.expect)(value.trim(), logText).toContain(expectedText);
857
+ test_1.expect.soft(value.trim(), logText).toContain(expectedText);
829
858
  }, function (reason) {
830
859
  (0, logs_core_1.logError)('Error : ' + reason);
831
860
  })];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ts-automationframework",
3
- "version": "1.1.38",
3
+ "version": "1.1.40",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",