playwright-ts-automationframework 1.1.50 → 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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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:
|
|
@@ -255,7 +250,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
255
250
|
switch (_c.label) {
|
|
256
251
|
case 0:
|
|
257
252
|
if (!(value != null)) return [3 /*break*/, 2];
|
|
258
|
-
verificationResult = value.includes(attributeValue) ? "PASSED" : "FAILED";
|
|
253
|
+
verificationResult = value.trim().includes(attributeValue) ? "PASSED" : "FAILED";
|
|
259
254
|
logText = "VERIFICATION: ".concat(verificationResult, ". Atribute value of ").concat(control.controlLocator, " Expected: '").concat(attributeValue, "' contains Actual : '").concat(value, "'");
|
|
260
255
|
(0, logs_core_1.logVerification)(logText);
|
|
261
256
|
_a = test_1.expect;
|
|
@@ -457,7 +452,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
457
452
|
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText ? "PASSED" : "FAILED";
|
|
458
453
|
var logText = "VERIFICATION: ".concat(verificationResult, " Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
459
454
|
(0, logs_core_1.logVerification)(logText);
|
|
460
|
-
(0, test_1.expect)(value, logText).toEqual(expectedText);
|
|
455
|
+
(0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toEqual(expectedText);
|
|
461
456
|
})];
|
|
462
457
|
case 1:
|
|
463
458
|
_a.sent();
|
|
@@ -474,7 +469,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
474
469
|
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "PASSED" : "FAILED";
|
|
475
470
|
var logText = "VERIFICATION: ".concat(verificationResult, " Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
476
471
|
(0, logs_core_1.logVerification)(logText);
|
|
477
|
-
(0, test_1.expect)(value, logText).toContain(expectedText);
|
|
472
|
+
(0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toContain(expectedText);
|
|
478
473
|
})];
|
|
479
474
|
case 1:
|
|
480
475
|
_a.sent();
|
|
@@ -503,7 +498,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
503
498
|
var verificationResult = value.trim() === expectedText ? "PASSED" : "FAILED";
|
|
504
499
|
var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
505
500
|
(0, logs_core_1.logVerification)(logText);
|
|
506
|
-
(0, test_1.expect)(value, logText).toEqual(expectedText);
|
|
501
|
+
(0, test_1.expect)(value.trim(), logText).toEqual(expectedText);
|
|
507
502
|
})];
|
|
508
503
|
case 1:
|
|
509
504
|
_a.sent();
|
|
@@ -520,7 +515,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
520
515
|
var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
|
|
521
516
|
var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
522
517
|
(0, logs_core_1.logVerification)(logText);
|
|
523
|
-
(0, test_1.expect)(value, logText).toContain(expectedText);
|
|
518
|
+
(0, test_1.expect)(value.trim(), logText).toContain(expectedText);
|
|
524
519
|
})];
|
|
525
520
|
case 1:
|
|
526
521
|
_a.sent();
|
|
@@ -549,7 +544,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
549
544
|
var verificationResult = value.trim() === expectedText ? "PASSED" : "FAILED";
|
|
550
545
|
var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
551
546
|
(0, logs_core_1.logVerification)(logText);
|
|
552
|
-
(0, test_1.expect)(value, logText).toEqual(expectedText);
|
|
547
|
+
(0, test_1.expect)(value.trim(), logText).toEqual(expectedText);
|
|
553
548
|
})];
|
|
554
549
|
case 1:
|
|
555
550
|
_a.sent();
|
|
@@ -566,7 +561,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
566
561
|
var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
|
|
567
562
|
var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
568
563
|
(0, logs_core_1.logVerification)(logText);
|
|
569
|
-
(0, test_1.expect)(value, logText).toContain(expectedText);
|
|
564
|
+
(0, test_1.expect)(value.trim(), logText).toContain(expectedText);
|
|
570
565
|
})];
|
|
571
566
|
case 1:
|
|
572
567
|
_a.sent();
|
|
@@ -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;
|
|
@@ -810,7 +867,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
810
867
|
var verificationResult = value.includes(subString) ? "PASSED" : "FAILED";
|
|
811
868
|
var logText = "VERIFICATION: ".concat(verificationResult, " Verify URL contains. Expected: '").concat(subString, "' Actual: '").concat(value, "'");
|
|
812
869
|
(0, logs_core_1.logVerification)(logText);
|
|
813
|
-
(0, test_1.expect)(value, logText).toContain(subString);
|
|
870
|
+
(0, test_1.expect)(value.trim(), logText).toContain(subString);
|
|
814
871
|
})];
|
|
815
872
|
case 1:
|
|
816
873
|
_a.sent();
|