playwright-ts-automationframework 1.1.26 → 1.1.28

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.
@@ -17,7 +17,7 @@ export declare class Assertion extends Actions {
17
17
  *
18
18
  * verifyIsEquals("Invalid username", "Invalid username");
19
19
  */
20
- verifyIsEquals(object1: any, object2: any): void;
20
+ verifyIsEquals(object1: any, object2: any, controlDescription?: string): void;
21
21
  /**
22
22
  * Verify first value contains substring as second.
23
23
  * If expected value is present in actual value then test case gets passsed else failed..
@@ -28,7 +28,7 @@ export declare class Assertion extends Actions {
28
28
  *
29
29
  * verifyIsContains("Invalid username Test", "Invalid username");
30
30
  */
31
- verifyIsContains(actual: string, expected: string): void;
31
+ verifyIsContains(actual: string, expected: string, controlDescription?: string): void;
32
32
  /**
33
33
  * Verify element's displayed/not displayed status as per expected value
34
34
  * If expected element's displayed status is as per expected then test case gets passed else failed..
@@ -221,6 +221,8 @@ export declare class Assertion extends Actions {
221
221
  * verifyCountOfElements(isMinor, 5);
222
222
  */
223
223
  verifyCountOfElements(control: WebControl, expectedCount: number): Promise<void>;
224
+ verifyCountOfElementsIsGreaterOrEqual(control: WebControl, expectedCount: number): Promise<void>;
225
+ verifyCountOfElementsIsLesseOrEqual(control: WebControl, expectedCount: number): Promise<void>;
224
226
  /**
225
227
  * Verify title of web page contains expected value
226
228
  * If title contains expected value then test case will get passsed else failed..
@@ -74,10 +74,11 @@ var Assertion = /** @class */ (function (_super) {
74
74
  *
75
75
  * verifyIsEquals("Invalid username", "Invalid username");
76
76
  */
77
- Assertion.prototype.verifyIsEquals = function (object1, object2) {
77
+ Assertion.prototype.verifyIsEquals = function (object1, object2, controlDescription) {
78
+ if (controlDescription === void 0) { controlDescription = ""; }
78
79
  try {
79
80
  var verificationResult = object1 === object2 ? "PASSED" : "FAILED";
80
- (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(object1, "' Actual: '").concat(object2, "'"));
81
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". ").concat(controlDescription, " Expected: '").concat(object1, "' Actual: '").concat(object2, "'"));
81
82
  (0, test_1.expect)(object1).toBe(object2);
82
83
  }
83
84
  catch (error1) {
@@ -95,10 +96,11 @@ var Assertion = /** @class */ (function (_super) {
95
96
  *
96
97
  * verifyIsContains("Invalid username Test", "Invalid username");
97
98
  */
98
- Assertion.prototype.verifyIsContains = function (actual, expected) {
99
+ Assertion.prototype.verifyIsContains = function (actual, expected, controlDescription) {
100
+ if (controlDescription === void 0) { controlDescription = ""; }
99
101
  try {
100
102
  var verificationResult = actual.trim().includes(expected.trim()) ? "PASSED" : "FAILED";
101
- var logText = "VERIFICATION: ".concat(verificationResult, ". Actual: '").concat(actual, "' contains Expected: '").concat(expected.trim(), "'");
103
+ var logText = "VERIFICATION: ".concat(verificationResult, ". ").concat(controlDescription, " Actual: '").concat(actual, "' contains Expected: '").concat(expected.trim(), "'");
102
104
  (0, logs_core_1.logVerification)(logText);
103
105
  (0, test_1.expect)(actual.trim(), logText).toContain(expected.trim());
104
106
  }
@@ -719,12 +721,29 @@ var Assertion = /** @class */ (function (_super) {
719
721
  * verifyCountOfElements(isMinor, 5);
720
722
  */
721
723
  Assertion.prototype.verifyCountOfElements = function (control, expectedCount) {
724
+ return __awaiter(this, void 0, void 0, function () {
725
+ return __generator(this, function (_a) {
726
+ switch (_a.label) {
727
+ case 0: return [4 /*yield*/, control.controlLocator.count().then(function (value) {
728
+ var verificationResult = value == expectedCount ? "PASSED" : "FAILED";
729
+ var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
730
+ (0, logs_core_1.logVerification)(logText);
731
+ (0, test_1.expect)(value, logText).toBe(expectedCount);
732
+ })];
733
+ case 1:
734
+ _a.sent();
735
+ return [2 /*return*/];
736
+ }
737
+ });
738
+ });
739
+ };
740
+ Assertion.prototype.verifyCountOfElementsIsGreaterOrEqual = function (control, expectedCount) {
722
741
  return __awaiter(this, void 0, void 0, function () {
723
742
  return __generator(this, function (_a) {
724
743
  switch (_a.label) {
725
744
  case 0: return [4 /*yield*/, control.controlLocator.count().then(function (value) {
726
745
  var verificationResult = value >= expectedCount ? "PASSED" : "FAILED";
727
- var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements. Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
746
+ var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
728
747
  (0, logs_core_1.logVerification)(logText);
729
748
  (0, test_1.expect)(value, logText).toBeGreaterThanOrEqual(expectedCount);
730
749
  })];
@@ -735,6 +754,23 @@ var Assertion = /** @class */ (function (_super) {
735
754
  });
736
755
  });
737
756
  };
757
+ Assertion.prototype.verifyCountOfElementsIsLesseOrEqual = function (control, expectedCount) {
758
+ return __awaiter(this, void 0, void 0, function () {
759
+ return __generator(this, function (_a) {
760
+ switch (_a.label) {
761
+ case 0: return [4 /*yield*/, control.controlLocator.count().then(function (value) {
762
+ var verificationResult = value <= expectedCount ? "PASSED" : "FAILED";
763
+ var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
764
+ (0, logs_core_1.logVerification)(logText);
765
+ (0, test_1.expect)(value, logText).toBeLessThanOrEqual(expectedCount);
766
+ })];
767
+ case 1:
768
+ _a.sent();
769
+ return [2 /*return*/];
770
+ }
771
+ });
772
+ });
773
+ };
738
774
  /**
739
775
  * Verify title of web page contains expected value
740
776
  * If title contains expected value then test case will get passsed else failed..
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ts-automationframework",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",