playwright-ts-automationframework 1.1.51 → 1.1.52

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.
@@ -217,6 +217,7 @@ export declare class Assertion extends Actions {
217
217
  verifyTagName(control: WebControl, expectedTagName: string): Promise<void>;
218
218
  verifyListContainsValue(control: WebControl, valueToVerify: string): Promise<void>;
219
219
  verifyListContainsMultipleValues(control: WebControl, listOfValueToVerify: string[], waitTillElementIsDisplayed?: boolean): Promise<void>;
220
+ verifyDropdownOptions(control: WebControl, listOfValueToVerify: string[], waitTillElementIsDisplayed?: boolean): Promise<void>;
220
221
  verifyListForMultipleValues(control: WebControl, listOfValueToVerify: string[], waitTillElementIsDisplayed?: boolean): Promise<void>;
221
222
  /**
222
223
  * Verify Alert text is equal to expected value
@@ -175,16 +175,11 @@ var Assertion = /** @class */ (function (_super) {
175
175
  return [4 /*yield*/, control.controlLocator.isHidden().then(function (value) { return __awaiter(_this, void 0, void 0, function () {
176
176
  var verificationResult, logText;
177
177
  return __generator(this, function (_a) {
178
- switch (_a.label) {
179
- case 0:
180
- verificationResult = value === true ? "PASSED" : "FAILED";
181
- logText = "VERIFICATION: ".concat(verificationResult, ". '").concat(control.controlDescription, "' hidden status is '").concat(value, "' Expected: true");
182
- (0, logs_core_1.logVerification)(logText);
183
- return [4 /*yield*/, (0, test_1.expect)(element, logText).toBeHidden()];
184
- case 1:
185
- _a.sent();
186
- return [2 /*return*/];
187
- }
178
+ verificationResult = value === true ? "PASSED" : "FAILED";
179
+ logText = "VERIFICATION: ".concat(verificationResult, ". '").concat(control.controlDescription, "' hidden status is '").concat(value, "' Expected: true");
180
+ (0, logs_core_1.logVerification)(logText);
181
+ (0, test_1.expect)(value, logText).toBe(true);
182
+ return [2 /*return*/];
188
183
  });
189
184
  }); })];
190
185
  case 1:
@@ -718,6 +713,68 @@ var Assertion = /** @class */ (function (_super) {
718
713
  });
719
714
  });
720
715
  };
716
+ Assertion.prototype.verifyDropdownOptions = function (control_1, listOfValueToVerify_1) {
717
+ return __awaiter(this, arguments, void 0, function (control, listOfValueToVerify, waitTillElementIsDisplayed) {
718
+ var options, listOfOptions, _i, options_1, option, value;
719
+ var _this = this;
720
+ if (waitTillElementIsDisplayed === void 0) { waitTillElementIsDisplayed = true; }
721
+ return __generator(this, function (_a) {
722
+ switch (_a.label) {
723
+ case 0: return [4 /*yield*/, control.controlLocator.locator('option').all()];
724
+ case 1:
725
+ options = _a.sent();
726
+ listOfOptions = [];
727
+ _i = 0, options_1 = options;
728
+ _a.label = 2;
729
+ case 2:
730
+ if (!(_i < options_1.length)) return [3 /*break*/, 5];
731
+ option = options_1[_i];
732
+ return [4 /*yield*/, option.innerText()];
733
+ case 3:
734
+ value = _a.sent();
735
+ if (value) {
736
+ listOfOptions.push(value);
737
+ }
738
+ _a.label = 4;
739
+ case 4:
740
+ _i++;
741
+ return [3 /*break*/, 2];
742
+ case 5:
743
+ listOfValueToVerify.forEach(function (expectedValue) { return __awaiter(_this, void 0, void 0, function () {
744
+ var listOfElements, count, verificationResult;
745
+ return __generator(this, function (_a) {
746
+ switch (_a.label) {
747
+ case 0: return [4 /*yield*/, control.controlLocator.all()];
748
+ case 1:
749
+ listOfElements = _a.sent();
750
+ count = listOfElements.filter(function (element) {
751
+ return __awaiter(this, void 0, void 0, function () {
752
+ return __generator(this, function (_a) {
753
+ switch (_a.label) {
754
+ case 0: return [4 /*yield*/, element.innerText().then(function (text) {
755
+ return __awaiter(this, void 0, void 0, function () {
756
+ return __generator(this, function (_a) {
757
+ return [2 /*return*/, text.trim().includes(expectedValue)];
758
+ });
759
+ });
760
+ })];
761
+ case 1: return [2 /*return*/, _a.sent()];
762
+ }
763
+ });
764
+ });
765
+ }).length;
766
+ verificationResult = count >= 1 ? "PASSED" : "FAILED";
767
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". '").concat(expectedValue, "' is Present in list '").concat(control.controlDescription, "'"));
768
+ (0, test_1.expect)(count).toBeGreaterThanOrEqual(1);
769
+ return [2 /*return*/];
770
+ }
771
+ });
772
+ }); });
773
+ return [2 /*return*/];
774
+ }
775
+ });
776
+ });
777
+ };
721
778
  Assertion.prototype.verifyListForMultipleValues = function (control_1, listOfValueToVerify_1) {
722
779
  return __awaiter(this, arguments, void 0, function (control, listOfValueToVerify, waitTillElementIsDisplayed) {
723
780
  var list, _loop_1, i;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ts-automationframework",
3
- "version": "1.1.51",
3
+ "version": "1.1.52",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",