playwright-ts-automationframework 1.1.68 → 1.1.70

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.
@@ -0,0 +1,1045 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.Assertion = void 0;
55
+ var actions_core_1 = require("./actions.core");
56
+ var logs_core_1 = require("./logs.core");
57
+ var test_1 = require("@playwright/test");
58
+ /**
59
+ * All Verification methods required for test case verification.
60
+ * @author Ketan Pardeshi
61
+ * */
62
+ var Assertion = /** @class */ (function (_super) {
63
+ __extends(Assertion, _super);
64
+ function Assertion(page) {
65
+ return _super.call(this, page) || this;
66
+ }
67
+ /**
68
+ * Verify two objects are equals.
69
+ * If both objects are equal test case gets passed else fails.
70
+ *
71
+ * @param object1 First object.
72
+ * @param object2 Second object.
73
+ * Example:
74
+ *
75
+ * verifyIsEquals("Invalid username", "Invalid username");
76
+ */
77
+ Assertion.prototype.verifyIsEquals = function (object1, object2, controlDescription) {
78
+ if (controlDescription === void 0) { controlDescription = ""; }
79
+ try {
80
+ var verificationResult = object1 === object2 ? "✅ PASSED" : "❌ FAILED";
81
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". ").concat(controlDescription, " Expected: '").concat(object1, "' Actual: '").concat(object2, "'"));
82
+ test_1.expect.soft(object1).toEqual(object2);
83
+ }
84
+ catch (error1) {
85
+ (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Expected: '" + object1 + "' Actual: '" + object2 + "'");
86
+ throw error1;
87
+ }
88
+ };
89
+ Assertion.prototype.verifyIsNotEquals = function (object1, object2, controlDescription) {
90
+ if (controlDescription === void 0) { controlDescription = ""; }
91
+ try {
92
+ var verificationResult = object1 != object2 ? "✅ PASSED" : "❌ FAILED";
93
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". ").concat(controlDescription, " Expected: '").concat(object1, "' is NOT equals Actual: '").concat(object2, "'"));
94
+ test_1.expect.soft(object1).not.toEqual(object2);
95
+ }
96
+ catch (error1) {
97
+ (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Expected: '" + object1 + "' Actual: '" + object2 + "'");
98
+ throw error1;
99
+ }
100
+ };
101
+ Assertion.prototype.verifyIsEqualIgnorecase = function (object1, object2, controlDescription, caseInsensitive) {
102
+ if (controlDescription === void 0) { controlDescription = ""; }
103
+ if (caseInsensitive === void 0) { caseInsensitive = false; }
104
+ try {
105
+ var expected = object1;
106
+ var actual = object2;
107
+ if (caseInsensitive && typeof object1 === 'string' && typeof object2 === 'string') {
108
+ expected = object1.toLowerCase();
109
+ actual = object2.toLowerCase();
110
+ }
111
+ var verificationResult = expected === actual ? "✅ PASSED" : "❌ FAILED";
112
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". ").concat(controlDescription, " Expected: '").concat(object1, "' Actual: '").concat(object2, "'"));
113
+ // Perform assertion based on case sensitivity
114
+ if (caseInsensitive && typeof object1 === 'string' && typeof object2 === 'string') {
115
+ test_1.expect.soft(object1.toLowerCase()).toEqual(object2.toLowerCase());
116
+ }
117
+ else {
118
+ test_1.expect.soft(object1).toEqual(object2);
119
+ }
120
+ }
121
+ catch (error1) {
122
+ (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Expected: '" + object1 + "' Actual: '" + object2 + "'");
123
+ throw error1;
124
+ }
125
+ };
126
+ /**
127
+ * Verify first value contains substring as second.
128
+ * If expected value is present in actual value then test case gets passed else failed..
129
+ *
130
+ * @param expected First object which has .
131
+ * @param actual Second object.
132
+ * Example:
133
+ *
134
+ * verifyIsContains("Invalid username Test", "Invalid username");
135
+ */
136
+ Assertion.prototype.verifyIsContains = function (actual, expected, controlDescription) {
137
+ if (controlDescription === void 0) { controlDescription = ""; }
138
+ try {
139
+ var verificationResult = actual.trim().includes(expected.trim()) ? "✅ PASSED" : "❌ FAILED";
140
+ var logText = "VERIFICATION: '".concat(verificationResult, "'. ").concat(controlDescription, " Actual: '").concat(actual, "' contains Expected: '").concat(expected.trim(), "'");
141
+ (0, logs_core_1.logVerification)(logText);
142
+ test_1.expect.soft(actual.trim(), logText).toContain(expected.trim());
143
+ }
144
+ catch (error1) {
145
+ (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Actual: '" + expected + "' contains Expected: '" + actual + "'");
146
+ throw error1;
147
+ }
148
+ };
149
+ /**
150
+ * Verify element's displayed/not displayed status as per expected value
151
+ * If expected element's displayed status is as per expected then test case gets passed else failed..
152
+ *
153
+ * @param control Control of which enable or disable status.
154
+ * @param expValue Expected value enabled as true or disabled as false.
155
+ * Example:
156
+ *
157
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
158
+ *
159
+ * verifyIsDisplayed(loginBtn, true);
160
+ */
161
+ Assertion.prototype.verifyIsDisplayed = function (control_1) {
162
+ return __awaiter(this, arguments, void 0, function (control, expectedIsDisplayed) {
163
+ if (expectedIsDisplayed === void 0) { expectedIsDisplayed = true; }
164
+ return __generator(this, function (_a) {
165
+ switch (_a.label) {
166
+ case 0:
167
+ if (!expectedIsDisplayed) return [3 /*break*/, 3];
168
+ return [4 /*yield*/, this.waitTillElementIsPresent(control)];
169
+ case 1:
170
+ _a.sent();
171
+ return [4 /*yield*/, this.isDisplayed(control).then(function (value) {
172
+ var verificationResult = value === expectedIsDisplayed ? "✅ PASSED" : "❌ FAILED";
173
+ var logText = "VERIFICATION: '".concat(verificationResult, "' '").concat(control.controlDescription, "' displayed status is '").concat(value, "' Expected: '").concat(expectedIsDisplayed, "'");
174
+ (0, logs_core_1.logVerification)(logText);
175
+ test_1.expect.soft(value, logText).toBe(expectedIsDisplayed);
176
+ }, function (reason) {
177
+ (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. '" + control.controlDescription + "' displayed status is: '" + false + "' due to reason: " + reason);
178
+ })];
179
+ case 2:
180
+ _a.sent();
181
+ return [3 /*break*/, 5];
182
+ case 3: return [4 /*yield*/, this.verifyIsNotDisplayed(control)];
183
+ case 4:
184
+ _a.sent();
185
+ _a.label = 5;
186
+ case 5: return [2 /*return*/];
187
+ }
188
+ });
189
+ });
190
+ };
191
+ /**
192
+ * Verify element is not displayed
193
+ * If expected element's displayed status is false the test case gets passed else failed..
194
+ *
195
+ * @param control Control for which not displayed status need to verify.
196
+ * @param isAlreadyHidden Is control already hidden or need to wait to get hidden.
197
+ * Example:
198
+ *
199
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
200
+ *
201
+ * verifyIsNotDisplayed(loginBtn, true);
202
+ */
203
+ Assertion.prototype.verifyIsNotDisplayed = function (control_1) {
204
+ return __awaiter(this, arguments, void 0, function (control, isAlreadyHidden) {
205
+ var element;
206
+ var _this = this;
207
+ if (isAlreadyHidden === void 0) { isAlreadyHidden = false; }
208
+ return __generator(this, function (_a) {
209
+ switch (_a.label) {
210
+ case 0:
211
+ element = control.controlLocator;
212
+ return [4 /*yield*/, control.controlLocator.isHidden().then(function (value) { return __awaiter(_this, void 0, void 0, function () {
213
+ var verificationResult, logText;
214
+ return __generator(this, function (_a) {
215
+ verificationResult = value === true ? "✅ PASSED" : "❌ FAILED";
216
+ logText = "VERIFICATION: '".concat(verificationResult, "'. '").concat(control.controlDescription, "' hidden status is '").concat(value, "' Expected: 'true'");
217
+ (0, logs_core_1.logVerification)(logText);
218
+ test_1.expect.soft(value, logText).toBe(true);
219
+ return [2 /*return*/];
220
+ });
221
+ }); })];
222
+ case 1:
223
+ _a.sent();
224
+ return [2 /*return*/];
225
+ }
226
+ });
227
+ });
228
+ };
229
+ /**
230
+ * Verify attribute value of the control
231
+ * If elements attribute value is as per expected value then test case gets passed else failed..
232
+ *
233
+ * @param control Control for which attribute value need to verify.
234
+ * @param attributeName Attribute name.
235
+ * @param attributeValue Expected attribute value
236
+
237
+ * Example:
238
+ *
239
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
240
+ *
241
+ * verifyAttributeValue(loginBtn, "value", "Submit");
242
+ */
243
+ Assertion.prototype.verifyAttributeValue = function (control, attributeName, expectedAttributeValue) {
244
+ return __awaiter(this, void 0, void 0, function () {
245
+ var _this = this;
246
+ return __generator(this, function (_a) {
247
+ switch (_a.label) {
248
+ case 0: return [4 /*yield*/, this.getAttributeValue(control, attributeName).then(function (value) { return __awaiter(_this, void 0, void 0, function () {
249
+ var verificationResult, logText;
250
+ return __generator(this, function (_a) {
251
+ verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedAttributeValue ? "✅ PASSED" : "❌ FAILED";
252
+ logText = "VERIFICATION: '".concat(verificationResult, "'. Attribute value of ").concat(control.controlDescription, " Expected: '").concat(expectedAttributeValue, "' Actual : '").concat(value, "'");
253
+ (0, logs_core_1.logVerification)(logText);
254
+ test_1.expect.soft(value, logText).toBe(expectedAttributeValue);
255
+ return [2 /*return*/];
256
+ });
257
+ }); })];
258
+ case 1:
259
+ _a.sent();
260
+ return [2 /*return*/];
261
+ }
262
+ });
263
+ });
264
+ };
265
+ /**
266
+ * Verify element's attribute value contains expected value
267
+ * If element's attribute value contains expected value then test case gets passed else failed..
268
+ *
269
+ * @param control Control of which attribute value need to verify.
270
+ * @param attributeName Attribute name
271
+ * @param expectedText Expected partial value.
272
+ *
273
+ * Example:
274
+ *
275
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
276
+ *
277
+ * verifyAttributeValueContains(loginBtn, "value", "Submit");
278
+ */
279
+ Assertion.prototype.verifyAttributeValueContains = function (control, attributeName, attributeValue) {
280
+ return __awaiter(this, void 0, void 0, function () {
281
+ var _this = this;
282
+ return __generator(this, function (_a) {
283
+ switch (_a.label) {
284
+ case 0: return [4 /*yield*/, this.getAttributeValue(control, attributeName).then(function (value) { return __awaiter(_this, void 0, void 0, function () {
285
+ var verificationResult, logText, _a, _b, _c, _d;
286
+ return __generator(this, function (_e) {
287
+ switch (_e.label) {
288
+ case 0:
289
+ if (!(value != null)) return [3 /*break*/, 2];
290
+ verificationResult = value.trim().includes(attributeValue) ? "✅ PASSED" : "❌ FAILED";
291
+ logText = "VERIFICATION: '".concat(verificationResult, "'. Atribute value of ").concat(control.controlLocator, " Expected: '").concat(attributeValue, "' contains Actual : '").concat(value, "'");
292
+ (0, logs_core_1.logVerification)(logText);
293
+ _b = (_a = test_1.expect).soft;
294
+ return [4 /*yield*/, this.getAttributeValue(control, attributeName)];
295
+ case 1:
296
+ _b.apply(_a, [_e.sent(), logText]).toContain(attributeValue);
297
+ return [3 /*break*/, 4];
298
+ case 2:
299
+ (0, logs_core_1.logVerification)("VERIFICATION: '\u274C FAILED'. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'"));
300
+ _d = (_c = test_1.expect).soft;
301
+ return [4 /*yield*/, this.getAttributeValue(control, attributeName)];
302
+ case 3:
303
+ _d.apply(_c, [_e.sent(), "VERIFICATION: '\u274C FAILED'. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'")]).toContain(attributeValue);
304
+ _e.label = 4;
305
+ case 4: return [2 /*return*/];
306
+ }
307
+ });
308
+ }); })];
309
+ case 1:
310
+ _a.sent();
311
+ return [2 /*return*/];
312
+ }
313
+ });
314
+ });
315
+ };
316
+ /**
317
+ * Verify element's enabled/disabled status as per expected value
318
+ * If expected element's enabled status is as per expected then test case gets passed else failed..
319
+ *
320
+ * @param control Control of which enable or disable status.
321
+ * @param expValue Expected value enabled as true or disabled as false.
322
+ * Example:
323
+ *
324
+ * loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
325
+ *
326
+ * verifyIsEnabled(loginBtn, true);
327
+ */
328
+ Assertion.prototype.verifyIsEnabled = function (control_1) {
329
+ return __awaiter(this, arguments, void 0, function (control, expValue) {
330
+ if (expValue === void 0) { expValue = true; }
331
+ return __generator(this, function (_a) {
332
+ switch (_a.label) {
333
+ case 0:
334
+ if (!(expValue == true)) return [3 /*break*/, 2];
335
+ return [4 /*yield*/, this.page.waitForLoadState("load")];
336
+ case 1:
337
+ _a.sent();
338
+ _a.label = 2;
339
+ case 2:
340
+ if (!expValue) return [3 /*break*/, 4];
341
+ return [4 /*yield*/, control.controlLocator.isEnabled().then(function (value) {
342
+ var verificationResult = value === true ? "PASSED" : "Failed";
343
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' enabled status is: '").concat(value, "'"));
344
+ (0, test_1.expect)(value).toBe(true);
345
+ })];
346
+ case 3:
347
+ _a.sent();
348
+ return [3 /*break*/, 6];
349
+ case 4: return [4 /*yield*/, this.verifyIsDisabled(control, true)];
350
+ case 5:
351
+ _a.sent();
352
+ _a.label = 6;
353
+ case 6: return [2 /*return*/];
354
+ }
355
+ });
356
+ });
357
+ };
358
+ Assertion.prototype.verifyIsDisabled = function (control_1) {
359
+ return __awaiter(this, arguments, void 0, function (control, expValue) {
360
+ if (expValue === void 0) { expValue = true; }
361
+ return __generator(this, function (_a) {
362
+ switch (_a.label) {
363
+ case 0:
364
+ if (!(expValue == true)) return [3 /*break*/, 2];
365
+ return [4 /*yield*/, this.page.waitForLoadState("load")];
366
+ case 1:
367
+ _a.sent();
368
+ _a.label = 2;
369
+ case 2: return [4 /*yield*/, control.controlLocator.isDisabled().then(function (value) {
370
+ var verificationResult = value === true ? "PASSED" : "Failed";
371
+ (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' disabled status is: '").concat(value, "'"));
372
+ (0, test_1.expect)(value).toBe(true);
373
+ })];
374
+ case 3:
375
+ _a.sent();
376
+ return [2 /*return*/];
377
+ }
378
+ });
379
+ });
380
+ };
381
+ /**
382
+ * The function `verifyIsSelected` asynchronously verifies if a web control is selected with an
383
+ * expected boolean value.
384
+ * @param {WebControl} control - The `control` parameter is a WebControl object that represents an
385
+ * element on a web page that you want to verify the selected status of.
386
+ * @param {boolean} [expValue=true] - The `expValue` parameter is a boolean value that represents the
387
+ * expected selection status of a web control. By default, it is set to `true`, meaning that the
388
+ * control is expected to be selected.
389
+ */
390
+ Assertion.prototype.verifyIsSelected = function (control_1) {
391
+ return __awaiter(this, arguments, void 0, function (control, expValue) {
392
+ if (expValue === void 0) { expValue = true; }
393
+ return __generator(this, function (_a) {
394
+ switch (_a.label) {
395
+ case 0:
396
+ if (!(expValue == true)) return [3 /*break*/, 2];
397
+ return [4 /*yield*/, this.page.waitForLoadState("load")];
398
+ case 1:
399
+ _a.sent();
400
+ _a.label = 2;
401
+ case 2: return [4 /*yield*/, control.controlLocator.first().isChecked().then(function (isChecked) {
402
+ var verificationResult = isChecked === expValue ? "✅ PASSED" : "❌ FAILED";
403
+ var logText = "VERIFICATION: '".concat(verificationResult, "' '").concat(control.controlDescription, "' selected status is: '").concat(isChecked, "' Expected: '").concat(expValue, "'");
404
+ (0, logs_core_1.logVerification)(logText);
405
+ test_1.expect.soft(isChecked, logText).toBe(expValue);
406
+ })];
407
+ case 3:
408
+ _a.sent();
409
+ return [2 /*return*/];
410
+ }
411
+ });
412
+ });
413
+ };
414
+ /**
415
+ * Verify element's text as per expected value
416
+ * If expected element's text is as per expected value then test case gets passed else failed..
417
+ *
418
+ * @param control Control of which text need to verify.
419
+ * @param expectedText Expected value.
420
+ * Example:
421
+ *
422
+ * errorMsg = new WebControl(this.page.locator('#error'), 'Login Error message');
423
+ *
424
+ * verifyDisplayedText(loginBtn, "Invalid Username Test User");
425
+ */
426
+ Assertion.prototype.verifyDisplayedText = function (control, expectedText) {
427
+ return __awaiter(this, void 0, void 0, function () {
428
+ return __generator(this, function (_a) {
429
+ switch (_a.label) {
430
+ case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
431
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText.trim() ? "✅ PASSED" : "❌ FAILED";
432
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify text of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
433
+ (0, logs_core_1.logVerification)(logText);
434
+ test_1.expect.soft(value === null || value === void 0 ? void 0 : value.trim(), logText).toBe(expectedText.trim());
435
+ })];
436
+ case 1:
437
+ _a.sent();
438
+ return [2 /*return*/];
439
+ }
440
+ });
441
+ });
442
+ };
443
+ /**
444
+ * Verify element's text contains partial expected value
445
+ * If expected element's text contains expected value then test case gets passed else failed..
446
+ *
447
+ * @param control Control of which text need to verify.
448
+ * @param expectedText Expected partial value.
449
+ * Example:
450
+ *
451
+ * errorMsg = new WebControl(this.page.locator('#error'), 'Login Error message');
452
+ *
453
+ * verifyDisplayedTextContains(loginBtn, "Invalid Username");
454
+ */
455
+ Assertion.prototype.verifyDisplayedTextContains = function (control, expectedText) {
456
+ return __awaiter(this, void 0, void 0, function () {
457
+ return __generator(this, function (_a) {
458
+ switch (_a.label) {
459
+ case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
460
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim())) ? "✅ PASSED" : "❌ FAILED";
461
+ 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(), "'");
462
+ (0, logs_core_1.logVerification)(logText);
463
+ test_1.expect.soft(value === null || value === void 0 ? void 0 : value.trim(), logText).toContain(expectedText.trim());
464
+ })];
465
+ case 1:
466
+ _a.sent();
467
+ return [2 /*return*/];
468
+ }
469
+ });
470
+ });
471
+ };
472
+ /**
473
+ * Verify element's text does not contains expected value
474
+ * If expected element's text does not contains expected value then test case gets passed else failed..
475
+ *
476
+ * @param control Control of which text need to verify.
477
+ * @param expectedText Expected partial value.
478
+ * Example:
479
+ *
480
+ * errorMsg = new WebControl(this.page.locator('#error'), 'Login Error message');
481
+ *
482
+ * verifyDisplayedTextDoesNotContains(loginBtn, "Enter User");
483
+ */
484
+ Assertion.prototype.verifyDisplayedTextDoesNotContains = function (control, expectedText) {
485
+ return __awaiter(this, void 0, void 0, function () {
486
+ return __generator(this, function (_a) {
487
+ switch (_a.label) {
488
+ case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
489
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "✅ PASSED" : "❌ FAILED";
490
+ var logText = "VERIFICATION: '".concat(verificationResult, "'. Verify text of ").concat(control.controlDescription, " Expected: '").concat(expectedText, "' does not contains Actual: '").concat(value, "'");
491
+ (0, logs_core_1.logVerification)(logText);
492
+ test_1.expect.soft(false, logText).toBe(value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim()));
493
+ })];
494
+ case 1:
495
+ _a.sent();
496
+ return [2 /*return*/];
497
+ }
498
+ });
499
+ });
500
+ };
501
+ /**
502
+ * Verify element's textbox is equal to expected value
503
+ * If expected element's textbox value to be expected value then test case gets passed else failed..
504
+ *
505
+ * @param control Textbox control.
506
+ * @param expectedText Expected value.
507
+ * Example:
508
+ *
509
+ * usernameTxtbx = new WebControl(this.page.locator('#username'), 'Username textbox');
510
+ *
511
+ * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
512
+ */
513
+ Assertion.prototype.verifyTextboxValue = function (control, expectedText) {
514
+ return __awaiter(this, void 0, void 0, function () {
515
+ return __generator(this, function (_a) {
516
+ switch (_a.label) {
517
+ case 0: return [4 /*yield*/, control.controlLocator.first().getAttribute("value").then(function (value) {
518
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText ? "✅ PASSED" : "❌ FAILED";
519
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
520
+ (0, logs_core_1.logVerification)(logText);
521
+ test_1.expect.soft(value === null || value === void 0 ? void 0 : value.trim(), logText).toEqual(expectedText);
522
+ })];
523
+ case 1:
524
+ _a.sent();
525
+ return [2 /*return*/];
526
+ }
527
+ });
528
+ });
529
+ };
530
+ Assertion.prototype.verifyTextboxValueContains = function (control, expectedText) {
531
+ return __awaiter(this, void 0, void 0, function () {
532
+ return __generator(this, function (_a) {
533
+ switch (_a.label) {
534
+ case 0: return [4 /*yield*/, control.controlLocator.first().getAttribute("value").then(function (value) {
535
+ var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "✅ PASSED" : "❌ FAILED";
536
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
537
+ (0, logs_core_1.logVerification)(logText);
538
+ test_1.expect.soft(value === null || value === void 0 ? void 0 : value.trim(), logText).toContain(expectedText);
539
+ })];
540
+ case 1:
541
+ _a.sent();
542
+ return [2 /*return*/];
543
+ }
544
+ });
545
+ });
546
+ };
547
+ /**
548
+ * Verify element's inner text is equal to expected value
549
+ * If expected element's inner value to be expected value then test case gets passed else failed..
550
+ *
551
+ * @param control Textbox control.
552
+ * @param expectedText Expected value.
553
+ * Example:
554
+ *
555
+ * usernameTxtbx = new WebControl(this.page.locator('#username'), 'Username textbox');
556
+ *
557
+ * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
558
+ */
559
+ Assertion.prototype.verifyInnerText = function (control, expectedText) {
560
+ return __awaiter(this, void 0, void 0, function () {
561
+ return __generator(this, function (_a) {
562
+ switch (_a.label) {
563
+ case 0: return [4 /*yield*/, control.controlLocator.first().innerText().then(function (value) {
564
+ var verificationResult = value.trim() === expectedText ? "✅ PASSED" : "❌ FAILED";
565
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
566
+ (0, logs_core_1.logVerification)(logText);
567
+ test_1.expect.soft(value.trim(), logText).toEqual(expectedText);
568
+ })];
569
+ case 1:
570
+ _a.sent();
571
+ return [2 /*return*/];
572
+ }
573
+ });
574
+ });
575
+ };
576
+ Assertion.prototype.verifyInnerTextContains = function (control, expectedText) {
577
+ return __awaiter(this, void 0, void 0, function () {
578
+ return __generator(this, function (_a) {
579
+ switch (_a.label) {
580
+ case 0: return [4 /*yield*/, control.controlLocator.first().innerText().then(function (value) {
581
+ var verificationResult = value.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
582
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
583
+ (0, logs_core_1.logVerification)(logText);
584
+ test_1.expect.soft(value.trim(), logText).toContain(expectedText);
585
+ })];
586
+ case 1:
587
+ _a.sent();
588
+ return [2 /*return*/];
589
+ }
590
+ });
591
+ });
592
+ };
593
+ /**
594
+ * Verify element's input text is equal to expected value
595
+ * If expected element's inner value to be expected value then test case gets passed else failed..
596
+ *
597
+ * @param control Textbox control.
598
+ * @param expectedText Expected value.
599
+ * Example:
600
+ *
601
+ * usernameTxtbx = new WebControl(this.page.locator('#username'), 'Username textbox');
602
+ *
603
+ * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
604
+ */
605
+ Assertion.prototype.verifyInputValue = function (control, expectedText) {
606
+ return __awaiter(this, void 0, void 0, function () {
607
+ return __generator(this, function (_a) {
608
+ switch (_a.label) {
609
+ case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
610
+ var verificationResult = value.trim() === expectedText ? "✅ PASSED" : "❌ FAILED";
611
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
612
+ (0, logs_core_1.logVerification)(logText);
613
+ test_1.expect.soft(value.trim(), logText).toEqual(expectedText);
614
+ })];
615
+ case 1:
616
+ _a.sent();
617
+ return [2 /*return*/];
618
+ }
619
+ });
620
+ });
621
+ };
622
+ Assertion.prototype.verifyInputValueContains = function (control, expectedText) {
623
+ return __awaiter(this, void 0, void 0, function () {
624
+ return __generator(this, function (_a) {
625
+ switch (_a.label) {
626
+ case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
627
+ var verificationResult = value.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
628
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
629
+ (0, logs_core_1.logVerification)(logText);
630
+ test_1.expect.soft(value.trim(), logText).toContain(expectedText);
631
+ })];
632
+ case 1:
633
+ _a.sent();
634
+ return [2 /*return*/];
635
+ }
636
+ });
637
+ });
638
+ };
639
+ /**
640
+ * Verify element's checkbox/radio value is equal to expected value
641
+ * If expected element's checkbox/radio value to be expected value then test case gets passed else failed..
642
+ *
643
+ * @param control Checkbox/radio control.
644
+ * @param expectedText Expected checkbox/radio value.
645
+ * Example:
646
+ *
647
+ * isMinor = new WebControl(this.page.locator('#isMinor'), 'Is Minor checkbox');
648
+ *
649
+ * verifyCheckboxValue(isMinor, true);
650
+ */
651
+ Assertion.prototype.verifyCheckboxValue = function (control, value) {
652
+ return __awaiter(this, void 0, void 0, function () {
653
+ return __generator(this, function (_a) {
654
+ switch (_a.label) {
655
+ case 0: return [4 /*yield*/, this.isSelected(control).then(function (isChecked) {
656
+ var verificationResult = value === isChecked ? "✅ PASSED" : "❌ FAILED";
657
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify checkbox value of ").concat(control.controlDescription, ". Expected: '").concat(value, "' Actual: '").concat(isChecked, "'");
658
+ (0, logs_core_1.logVerification)(logText);
659
+ test_1.expect.soft(isChecked, logText).toBe(value);
660
+ })];
661
+ case 1:
662
+ _a.sent();
663
+ return [2 /*return*/];
664
+ }
665
+ });
666
+ });
667
+ };
668
+ /**
669
+ * Verify element's tagname is equal to expected value
670
+ * If expected element's Tagname is equal to expected value then test case gets passed else failed..
671
+ *
672
+ * @param control Checkbox/radio control.
673
+ * @param expectedText Expected checkbox/radio value.
674
+ * Example:
675
+ *
676
+ * isMinor = new WebControl(this.page.locator('#isMinor'), 'Is Minor checkbox');
677
+ *
678
+ * verifyTagName(isMinor, "a");
679
+ */
680
+ Assertion.prototype.verifyTagName = function (control, expectedTagName) {
681
+ return __awaiter(this, void 0, void 0, function () {
682
+ var tagName, parent, verificationResult, logText;
683
+ return __generator(this, function (_a) {
684
+ switch (_a.label) {
685
+ case 0:
686
+ parent = control.controlLocator.first();
687
+ if (!(parent != null)) return [3 /*break*/, 2];
688
+ return [4 /*yield*/, parent.evaluate(function (e) { return e.tagName; })];
689
+ case 1:
690
+ tagName = _a.sent();
691
+ _a.label = 2;
692
+ case 2:
693
+ verificationResult = (tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase()) == expectedTagName.toLowerCase() ? "✅ PASSED" : "❌ FAILED";
694
+ 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(), "'");
695
+ (0, logs_core_1.logVerification)(logText);
696
+ test_1.expect.soft(tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase(), logText).toBe(expectedTagName.toLowerCase());
697
+ return [2 /*return*/];
698
+ }
699
+ });
700
+ });
701
+ };
702
+ Assertion.prototype.verifyListContainsValue = function (control, valueToVerify) {
703
+ return __awaiter(this, void 0, void 0, function () {
704
+ var listOfElements, count, verificationResult;
705
+ return __generator(this, function (_a) {
706
+ switch (_a.label) {
707
+ case 0: return [4 /*yield*/, control.controlLocator.all()];
708
+ case 1:
709
+ listOfElements = _a.sent();
710
+ count = listOfElements.filter(function (elem) {
711
+ return __awaiter(this, void 0, void 0, function () {
712
+ return __generator(this, function (_a) {
713
+ switch (_a.label) {
714
+ case 0: return [4 /*yield*/, elem.innerText().then(function (text) {
715
+ return __awaiter(this, void 0, void 0, function () {
716
+ return __generator(this, function (_a) {
717
+ return [2 /*return*/, text.trim().includes(valueToVerify)];
718
+ });
719
+ });
720
+ })];
721
+ case 1: return [2 /*return*/, _a.sent()];
722
+ }
723
+ });
724
+ });
725
+ }).length;
726
+ verificationResult = count >= 1 ? "✅ PASSED" : "❌ FAILED";
727
+ (0, logs_core_1.logVerification)("VERIFICATION: '".concat(verificationResult, "'. '").concat(valueToVerify, "' is Present in list '").concat(control.controlDescription, "'"));
728
+ test_1.expect.soft(count).toBeGreaterThanOrEqual(1);
729
+ return [2 /*return*/];
730
+ }
731
+ });
732
+ });
733
+ };
734
+ Assertion.prototype.verifyListContainsMultipleValues = function (control_1, listOfValueToVerify_1) {
735
+ return __awaiter(this, arguments, void 0, function (control, listOfValueToVerify, waitTillElementIsDisplayed) {
736
+ var _this = this;
737
+ if (waitTillElementIsDisplayed === void 0) { waitTillElementIsDisplayed = true; }
738
+ return __generator(this, function (_a) {
739
+ switch (_a.label) {
740
+ case 0:
741
+ if (!waitTillElementIsDisplayed) return [3 /*break*/, 2];
742
+ return [4 /*yield*/, this.waitTillElementIsPresent(control)];
743
+ case 1:
744
+ _a.sent();
745
+ _a.label = 2;
746
+ case 2:
747
+ listOfValueToVerify.forEach(function (expectedValue) { return __awaiter(_this, void 0, void 0, function () {
748
+ var listOfElements, count, verificationResult;
749
+ return __generator(this, function (_a) {
750
+ switch (_a.label) {
751
+ case 0: return [4 /*yield*/, control.controlLocator.all()];
752
+ case 1:
753
+ listOfElements = _a.sent();
754
+ count = listOfElements.filter(function (element) {
755
+ return __awaiter(this, void 0, void 0, function () {
756
+ return __generator(this, function (_a) {
757
+ switch (_a.label) {
758
+ case 0: return [4 /*yield*/, element.innerText().then(function (text) {
759
+ return __awaiter(this, void 0, void 0, function () {
760
+ return __generator(this, function (_a) {
761
+ return [2 /*return*/, text.trim().includes(expectedValue)];
762
+ });
763
+ });
764
+ })];
765
+ case 1: return [2 /*return*/, _a.sent()];
766
+ }
767
+ });
768
+ });
769
+ }).length;
770
+ verificationResult = count >= 1 ? "✅ PASSED" : "❌ FAILED";
771
+ (0, logs_core_1.logVerification)("VERIFICATION: '".concat(verificationResult, "'. '").concat(expectedValue, "' is Present in list '").concat(control.controlDescription, "'"));
772
+ test_1.expect.soft(count).toBeGreaterThanOrEqual(1);
773
+ return [2 /*return*/];
774
+ }
775
+ });
776
+ }); });
777
+ return [2 /*return*/];
778
+ }
779
+ });
780
+ });
781
+ };
782
+ Assertion.prototype.verifyDropdownOptions = function (control_1, listOfValueToVerify_1) {
783
+ return __awaiter(this, arguments, void 0, function (control, listOfValueToVerify, waitTillElementIsDisplayed) {
784
+ var options, listOfOptions, _i, options_1, option, value;
785
+ var _this = this;
786
+ if (waitTillElementIsDisplayed === void 0) { waitTillElementIsDisplayed = true; }
787
+ return __generator(this, function (_a) {
788
+ switch (_a.label) {
789
+ case 0: return [4 /*yield*/, control.controlLocator.locator('option').all()];
790
+ case 1:
791
+ options = _a.sent();
792
+ listOfOptions = [];
793
+ _i = 0, options_1 = options;
794
+ _a.label = 2;
795
+ case 2:
796
+ if (!(_i < options_1.length)) return [3 /*break*/, 5];
797
+ option = options_1[_i];
798
+ return [4 /*yield*/, option.innerText()];
799
+ case 3:
800
+ value = _a.sent();
801
+ if (value) {
802
+ listOfOptions.push(value);
803
+ }
804
+ _a.label = 4;
805
+ case 4:
806
+ _i++;
807
+ return [3 /*break*/, 2];
808
+ case 5:
809
+ listOfValueToVerify.forEach(function (expectedValue) { return __awaiter(_this, void 0, void 0, function () {
810
+ var listOfElements, count, verificationResult;
811
+ return __generator(this, function (_a) {
812
+ switch (_a.label) {
813
+ case 0: return [4 /*yield*/, control.controlLocator.all()];
814
+ case 1:
815
+ listOfElements = _a.sent();
816
+ count = listOfElements.filter(function (element) {
817
+ return __awaiter(this, void 0, void 0, function () {
818
+ return __generator(this, function (_a) {
819
+ switch (_a.label) {
820
+ case 0: return [4 /*yield*/, element.innerText().then(function (text) {
821
+ return __awaiter(this, void 0, void 0, function () {
822
+ return __generator(this, function (_a) {
823
+ return [2 /*return*/, text.trim().includes(expectedValue)];
824
+ });
825
+ });
826
+ })];
827
+ case 1: return [2 /*return*/, _a.sent()];
828
+ }
829
+ });
830
+ });
831
+ }).length;
832
+ verificationResult = count >= 1 ? "✅ PASSED" : "❌ FAILED";
833
+ (0, logs_core_1.logVerification)("VERIFICATION: '".concat(verificationResult, "'. '").concat(expectedValue, "' is Present in list '").concat(control.controlDescription, "'"));
834
+ test_1.expect.soft(count).toBeGreaterThanOrEqual(1);
835
+ return [2 /*return*/];
836
+ }
837
+ });
838
+ }); });
839
+ return [2 /*return*/];
840
+ }
841
+ });
842
+ });
843
+ };
844
+ Assertion.prototype.verifyListForMultipleValues = function (control_1, listOfValueToVerify_1) {
845
+ return __awaiter(this, arguments, void 0, function (control, listOfValueToVerify, waitTillElementIsDisplayed) {
846
+ var list, _loop_1, i;
847
+ if (waitTillElementIsDisplayed === void 0) { waitTillElementIsDisplayed = true; }
848
+ return __generator(this, function (_a) {
849
+ switch (_a.label) {
850
+ case 0:
851
+ if (!waitTillElementIsDisplayed) return [3 /*break*/, 2];
852
+ return [4 /*yield*/, this.waitTillElementIsPresent(control)];
853
+ case 1:
854
+ _a.sent();
855
+ _a.label = 2;
856
+ case 2: return [4 /*yield*/, control.controlLocator.all()];
857
+ case 3:
858
+ list = _a.sent();
859
+ _loop_1 = function (i) {
860
+ return __generator(this, function (_b) {
861
+ switch (_b.label) {
862
+ case 0: return [4 /*yield*/, list[i].waitFor({ state: "visible" })];
863
+ case 1:
864
+ _b.sent();
865
+ return [4 /*yield*/, list[i].innerText().then(function (value) {
866
+ var verificationResult = value.trim().includes(listOfValueToVerify[i]) ? "✅ PASSED" : "❌ FAILED";
867
+ (0, logs_core_1.logVerification)("VERIFICATION: '".concat(verificationResult, "'. Expected: '").concat(listOfValueToVerify[i], "' Actual: '").concat(value, "'"));
868
+ test_1.expect.soft(value.trim()).toContain(listOfValueToVerify[i]);
869
+ })];
870
+ case 2:
871
+ _b.sent();
872
+ return [2 /*return*/];
873
+ }
874
+ });
875
+ };
876
+ i = 0;
877
+ _a.label = 4;
878
+ case 4:
879
+ if (!(i < listOfValueToVerify.length)) return [3 /*break*/, 7];
880
+ return [5 /*yield**/, _loop_1(i)];
881
+ case 5:
882
+ _a.sent();
883
+ _a.label = 6;
884
+ case 6:
885
+ i++;
886
+ return [3 /*break*/, 4];
887
+ case 7: return [2 /*return*/];
888
+ }
889
+ });
890
+ });
891
+ };
892
+ /**
893
+ * Verify Alert text is equal to expected value
894
+ * If alert text is equal to expected value then test case gets passed else failed..
895
+ *
896
+ * @param expectedText Expected alert text.
897
+ * Example:
898
+ *
899
+ * verifyAlertText("Password should be 8 digit.")
900
+ */
901
+ Assertion.prototype.verifyAlertText = function (expectedText) {
902
+ return __awaiter(this, void 0, void 0, function () {
903
+ var _this = this;
904
+ return __generator(this, function (_a) {
905
+ this.page.on('dialog', function (dialog) { return __awaiter(_this, void 0, void 0, function () {
906
+ var verificationResult, logText;
907
+ return __generator(this, function (_a) {
908
+ verificationResult = dialog.message().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
909
+ logText = "VERIFICATION: '".concat(verificationResult, "' Verify alert text. Expected: '").concat(expectedText, "' Actual: '").concat(dialog.message(), "'");
910
+ (0, logs_core_1.logVerification)(logText);
911
+ test_1.expect.soft(dialog.message(), logText).toContain(expectedText);
912
+ return [2 /*return*/];
913
+ });
914
+ }); });
915
+ return [2 /*return*/];
916
+ });
917
+ });
918
+ };
919
+ /**
920
+ * Verify URL contains expected value
921
+ * If URL contains expected value then test case gets passed else failed..
922
+ *
923
+ * @param expectedText Expected partial URL.
924
+ * Example:
925
+ *
926
+ * verifyURLContains("google.com");
927
+ */
928
+ Assertion.prototype.verifyURLContains = function (subString) {
929
+ return __awaiter(this, void 0, void 0, function () {
930
+ return __generator(this, function (_a) {
931
+ switch (_a.label) {
932
+ case 0: return [4 /*yield*/, this.getURL().then(function (value) {
933
+ var verificationResult = value.includes(subString) ? "✅ PASSED" : "❌ FAILED";
934
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify URL contains. Expected: '").concat(subString, "' Actual: '").concat(value, "'");
935
+ (0, logs_core_1.logVerification)(logText);
936
+ test_1.expect.soft(value.trim(), logText).toContain(subString);
937
+ })];
938
+ case 1:
939
+ _a.sent();
940
+ return [2 /*return*/];
941
+ }
942
+ });
943
+ });
944
+ };
945
+ /**
946
+ * Verify count of elements which matched the control
947
+ * If count of elements is equal to expected value then test case will get passed else failed..
948
+ *
949
+ * @param control Control element.
950
+ * @param expectedCount Expected count of elements matching criteria
951
+ * Example:
952
+ *
953
+ * checkboxes = new WebControl(this.page.locator("xpath=//a"), 'checkboxes');
954
+ * verifyCountOfElements(isMinor, 5);
955
+ */
956
+ Assertion.prototype.verifyCountOfElements = function (control, expectedCount) {
957
+ return __awaiter(this, void 0, void 0, function () {
958
+ return __generator(this, function (_a) {
959
+ switch (_a.label) {
960
+ case 0: return [4 /*yield*/, control.controlLocator.count().then(function (value) {
961
+ var verificationResult = value == expectedCount ? "✅ PASSED" : "❌ FAILED";
962
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
963
+ (0, logs_core_1.logVerification)(logText);
964
+ test_1.expect.soft(value, logText).toBe(expectedCount);
965
+ })];
966
+ case 1:
967
+ _a.sent();
968
+ return [2 /*return*/];
969
+ }
970
+ });
971
+ });
972
+ };
973
+ Assertion.prototype.verifyCountOfElementsIsGreaterOrEqual = function (control, expectedCount) {
974
+ return __awaiter(this, void 0, void 0, function () {
975
+ return __generator(this, function (_a) {
976
+ switch (_a.label) {
977
+ case 0: return [4 /*yield*/, control.controlLocator.count().then(function (value) {
978
+ var verificationResult = value >= expectedCount ? "✅ PASSED" : "❌ FAILED";
979
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
980
+ (0, logs_core_1.logVerification)(logText);
981
+ test_1.expect.soft(value, logText).toBeGreaterThanOrEqual(expectedCount);
982
+ })];
983
+ case 1:
984
+ _a.sent();
985
+ return [2 /*return*/];
986
+ }
987
+ });
988
+ });
989
+ };
990
+ Assertion.prototype.verifyCountOfElementsIsLesseOrEqual = function (control, expectedCount) {
991
+ return __awaiter(this, void 0, void 0, function () {
992
+ return __generator(this, function (_a) {
993
+ switch (_a.label) {
994
+ case 0: return [4 /*yield*/, control.controlLocator.count().then(function (value) {
995
+ var verificationResult = value <= expectedCount ? "✅ PASSED" : "❌ FAILED";
996
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify count of elements of ").concat(control.controlDescription, ". Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
997
+ (0, logs_core_1.logVerification)(logText);
998
+ test_1.expect.soft(value, logText).toBeLessThanOrEqual(expectedCount);
999
+ })];
1000
+ case 1:
1001
+ _a.sent();
1002
+ return [2 /*return*/];
1003
+ }
1004
+ });
1005
+ });
1006
+ };
1007
+ /**
1008
+ * Verify title of web page contains expected value
1009
+ * If title contains expected value then test case will get passed else failed..
1010
+ *
1011
+ * @param expectedText Expected partial Title.
1012
+ * Example:
1013
+ *
1014
+ * verifyPageTitleContains("Google");
1015
+ */
1016
+ Assertion.prototype.verifyPageTitleContains = function (expectedText) {
1017
+ return __awaiter(this, void 0, void 0, function () {
1018
+ var error1_1;
1019
+ return __generator(this, function (_a) {
1020
+ switch (_a.label) {
1021
+ case 0:
1022
+ _a.trys.push([0, 2, , 3]);
1023
+ return [4 /*yield*/, this.page.title().then(function (value) {
1024
+ var verificationResult = value.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
1025
+ var logText = "VERIFICATION: '".concat(verificationResult, "' Verify title contains. Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
1026
+ (0, logs_core_1.logVerification)(logText);
1027
+ test_1.expect.soft(value.trim(), logText).toContain(expectedText);
1028
+ }, function (reason) {
1029
+ (0, logs_core_1.logError)('❌ Error : ' + reason);
1030
+ })];
1031
+ case 1:
1032
+ _a.sent();
1033
+ return [3 /*break*/, 3];
1034
+ case 2:
1035
+ error1_1 = _a.sent();
1036
+ (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Expected: '" + expectedText + "'is NOT present in title.");
1037
+ throw error1_1;
1038
+ case 3: return [2 /*return*/];
1039
+ }
1040
+ });
1041
+ });
1042
+ };
1043
+ return Assertion;
1044
+ }(actions_core_1.Actions));
1045
+ exports.Assertion = Assertion;