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.
@@ -1,68 +1,16 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
54
3
  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");
4
+ const actions_core_1 = require("./actions.core");
5
+ const logs_core_1 = require("./logs.core");
6
+ const test_1 = require("@playwright/test");
58
7
  /**
59
8
  * All Verification methods required for test case verification.
60
9
  * @author Ketan Pardeshi
61
10
  * */
62
- var Assertion = /** @class */ (function (_super) {
63
- __extends(Assertion, _super);
64
- function Assertion(page) {
65
- return _super.call(this, page) || this;
11
+ class Assertion extends actions_core_1.Actions {
12
+ constructor(page) {
13
+ super(page);
66
14
  }
67
15
  /**
68
16
  * Verify two objects are equals.
@@ -74,55 +22,54 @@ var Assertion = /** @class */ (function (_super) {
74
22
  *
75
23
  * verifyIsEquals("Invalid username", "Invalid username");
76
24
  */
77
- Assertion.prototype.verifyIsEquals = function (object1, object2, controlDescription) {
78
- if (controlDescription === void 0) { controlDescription = ""; }
25
+ verifyIsEquals(object1, object2, controlDescription = "") {
79
26
  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);
27
+ const verificationResult = object1 === object2 ? "✅ PASSED" : "❌ FAILED";
28
+ let logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Expected: '${object1}' Actual: '${object2}'`;
29
+ (0, logs_core_1.logVerification)(logText);
30
+ test_1.expect.soft(object1, logText).toEqual(object2);
83
31
  }
84
32
  catch (error1) {
85
- (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Expected: '" + object1 + "' Actual: '" + object2 + "'");
33
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Expected: '${object1}' Actual: '${object2}' due to reason: '${error1}'`);
86
34
  throw error1;
87
35
  }
88
- };
89
- Assertion.prototype.verifyIsNotEquals = function (object1, object2, controlDescription) {
90
- if (controlDescription === void 0) { controlDescription = ""; }
36
+ }
37
+ verifyIsNotEquals(object1, object2, controlDescription = "") {
91
38
  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);
39
+ const verificationResult = object1 != object2 ? "✅ PASSED" : "❌ FAILED";
40
+ let logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Expected: '${object1}' is NOT equals Actual: '${object2}'`;
41
+ (0, logs_core_1.logVerification)(logText);
42
+ test_1.expect.soft(object1, logText).not.toEqual(object2);
95
43
  }
96
44
  catch (error1) {
97
- (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Expected: '" + object1 + "' Actual: '" + object2 + "'");
45
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Expected: '${object1}' is NOT equal to Actual: '${object2}' due to reason: '${error1}'`);
98
46
  throw error1;
99
47
  }
100
- };
101
- Assertion.prototype.verifyIsEqualIgnorecase = function (object1, object2, controlDescription, caseInsensitive) {
102
- if (controlDescription === void 0) { controlDescription = ""; }
103
- if (caseInsensitive === void 0) { caseInsensitive = false; }
48
+ }
49
+ verifyIsEqualIgnorecase(object1, object2, controlDescription = "", caseInsensitive = false) {
104
50
  try {
105
- var expected = object1;
106
- var actual = object2;
51
+ let expected = object1;
52
+ let actual = object2;
107
53
  if (caseInsensitive && typeof object1 === 'string' && typeof object2 === 'string') {
108
54
  expected = object1.toLowerCase();
109
55
  actual = object2.toLowerCase();
110
56
  }
111
- var verificationResult = expected === actual ? "✅ PASSED" : "❌ FAILED";
112
- (0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". ").concat(controlDescription, " Expected: '").concat(object1, "' Actual: '").concat(object2, "'"));
57
+ const verificationResult = expected === actual ? "✅ PASSED" : "❌ FAILED";
58
+ let logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Expected: '${object1}' Actual: '${object2}'`;
59
+ (0, logs_core_1.logVerification)(logText);
113
60
  // Perform assertion based on case sensitivity
114
61
  if (caseInsensitive && typeof object1 === 'string' && typeof object2 === 'string') {
115
- test_1.expect.soft(object1.toLowerCase()).toEqual(object2.toLowerCase());
62
+ test_1.expect.soft(object1.toLowerCase(), logText).toEqual(object2.toLowerCase());
116
63
  }
117
64
  else {
118
- test_1.expect.soft(object1).toEqual(object2);
65
+ test_1.expect.soft(object1, logText).toEqual(object2);
119
66
  }
120
67
  }
121
68
  catch (error1) {
122
- (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Expected: '" + object1 + "' Actual: '" + object2 + "'");
69
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Expected: '${object1}' Actual: '${object2}' due to reason: '${error1}'`);
123
70
  throw error1;
124
71
  }
125
- };
72
+ }
126
73
  /**
127
74
  * Verify first value contains substring as second.
128
75
  * If expected value is present in actual value then test case gets passed else failed..
@@ -133,19 +80,18 @@ var Assertion = /** @class */ (function (_super) {
133
80
  *
134
81
  * verifyIsContains("Invalid username Test", "Invalid username");
135
82
  */
136
- Assertion.prototype.verifyIsContains = function (actual, expected, controlDescription) {
137
- if (controlDescription === void 0) { controlDescription = ""; }
83
+ verifyIsContains(actual, expected, controlDescription = "") {
138
84
  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(), "'");
85
+ const verificationResult = actual.trim().includes(expected.trim()) ? "✅ PASSED" : "❌ FAILED";
86
+ let logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Actual: '${actual}' contains Expected: '${expected.trim()}'`;
141
87
  (0, logs_core_1.logVerification)(logText);
142
88
  test_1.expect.soft(actual.trim(), logText).toContain(expected.trim());
143
89
  }
144
90
  catch (error1) {
145
- (0, logs_core_1.logError)("VERIFICATION: '❌ FAILED'. Actual: '" + expected + "' contains Expected: '" + actual + "'");
91
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Actual: '${actual}' should contain Expected: '${expected}' due to reason: '${error1}'`);
146
92
  throw error1;
147
93
  }
148
- };
94
+ }
149
95
  /**
150
96
  * Verify element's displayed/not displayed status as per expected value
151
97
  * If expected element's displayed status is as per expected then test case gets passed else failed..
@@ -158,36 +104,25 @@ var Assertion = /** @class */ (function (_super) {
158
104
  *
159
105
  * verifyIsDisplayed(loginBtn, true);
160
106
  */
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
- };
107
+ async verifyIsDisplayed(control, expectedIsDisplayed = true) {
108
+ if (expectedIsDisplayed) {
109
+ await this.waitTillElementIsPresent(control);
110
+ try {
111
+ const value = await this.isDisplayed(control);
112
+ const verificationResult = value === expectedIsDisplayed ? "✅ PASSED" : "❌ FAILED";
113
+ const logText = `VERIFICATION: '${verificationResult}' '${control.controlDescription}' displayed status is '${value}' Expected: '${expectedIsDisplayed}'`;
114
+ (0, logs_core_1.logVerification)(logText);
115
+ test_1.expect.soft(value, logText).toBe(expectedIsDisplayed);
116
+ }
117
+ catch (error) {
118
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. '${control.controlDescription}' displayed status could not be verified. Expected: '${expectedIsDisplayed}' due to reason: '${error}'`);
119
+ throw error;
120
+ }
121
+ }
122
+ else {
123
+ await this.verifyIsNotDisplayed(control);
124
+ }
125
+ }
191
126
  /**
192
127
  * Verify element is not displayed
193
128
  * If expected element's displayed status is false the test case gets passed else failed..
@@ -200,32 +135,19 @@ var Assertion = /** @class */ (function (_super) {
200
135
  *
201
136
  * verifyIsNotDisplayed(loginBtn, true);
202
137
  */
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
- };
138
+ async verifyIsNotDisplayed(control, isAlreadyHidden = false) {
139
+ try {
140
+ const value = await control.controlLocator.isHidden();
141
+ const verificationResult = value === true ? "✅ PASSED" : "❌ FAILED";
142
+ const logText = `VERIFICATION: '${verificationResult}'. '${control.controlDescription}' hidden status is '${value}' Expected: 'true'`;
143
+ (0, logs_core_1.logVerification)(logText);
144
+ test_1.expect.soft(value, logText).toBe(true);
145
+ }
146
+ catch (error) {
147
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. '${control.controlDescription}' hidden status could not be verified due to reason: '${error}'`);
148
+ throw error;
149
+ }
150
+ }
229
151
  /**
230
152
  * Verify attribute value of the control
231
153
  * If elements attribute value is as per expected value then test case gets passed else failed..
@@ -240,28 +162,19 @@ var Assertion = /** @class */ (function (_super) {
240
162
  *
241
163
  * verifyAttributeValue(loginBtn, "value", "Submit");
242
164
  */
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
- };
165
+ async verifyAttributeValue(control, attributeName, expectedAttributeValue) {
166
+ try {
167
+ const value = await this.getAttributeValue(control, attributeName);
168
+ const verificationResult = value?.trim() === expectedAttributeValue ? "✅ PASSED" : "❌ FAILED";
169
+ const logText = `VERIFICATION: '${verificationResult}'. Attribute value of ${control.controlDescription} Expected: '${expectedAttributeValue}' Actual : '${value}'`;
170
+ (0, logs_core_1.logVerification)(logText);
171
+ test_1.expect.soft(value, logText).toBe(expectedAttributeValue);
172
+ }
173
+ catch (error) {
174
+ (0, logs_core_1.logError)(`VERIFICATION: ' FAILED'. Attribute '${attributeName}' on '${control.controlDescription}' could not be verified due to reason: '${error}'`);
175
+ throw error;
176
+ }
177
+ }
265
178
  /**
266
179
  * Verify element's attribute value contains expected value
267
180
  * If element's attribute value contains expected value then test case gets passed else failed..
@@ -276,43 +189,26 @@ var Assertion = /** @class */ (function (_super) {
276
189
  *
277
190
  * verifyAttributeValueContains(loginBtn, "value", "Submit");
278
191
  */
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
- };
192
+ async verifyAttributeValueContains(control, attributeName, attributeValue) {
193
+ try {
194
+ const value = await this.getAttributeValue(control, attributeName);
195
+ if (value != null) {
196
+ const verificationResult = value.trim().includes(attributeValue) ? "✅ PASSED" : "❌ FAILED";
197
+ const logText = `VERIFICATION: '${verificationResult}'. Attribute value of ${control.controlDescription} Expected: '${attributeValue}' contained in Actual: '${value}'`;
198
+ (0, logs_core_1.logVerification)(logText);
199
+ test_1.expect.soft(value, logText).toContain(attributeValue);
200
+ }
201
+ else {
202
+ const failText = `VERIFICATION: '❌ FAILED'. Attribute '${attributeName}' on '${control.controlDescription}' is null. Expected to contain: '${attributeValue}'`;
203
+ (0, logs_core_1.logVerification)(failText);
204
+ test_1.expect.soft(value, failText).toContain(attributeValue);
205
+ }
206
+ }
207
+ catch (error) {
208
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Attribute '${attributeName}' contains check on '${control.controlDescription}' failed due to reason: '${error}'`);
209
+ throw error;
210
+ }
211
+ }
316
212
  /**
317
213
  * Verify element's enabled/disabled status as per expected value
318
214
  * If expected element's enabled status is as per expected then test case gets passed else failed..
@@ -325,59 +221,43 @@ var Assertion = /** @class */ (function (_super) {
325
221
  *
326
222
  * verifyIsEnabled(loginBtn, true);
327
223
  */
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
- };
224
+ async verifyIsEnabled(control, expValue = true) {
225
+ if (expValue == true) {
226
+ await this.page.waitForLoadState("load");
227
+ }
228
+ if (expValue) {
229
+ try {
230
+ const value = await control.controlLocator.isEnabled();
231
+ const verificationResult = value === true ? "✅ PASSED" : "❌ FAILED";
232
+ const logText = `VERIFICATION: '${verificationResult}'. '${control.controlDescription}' enabled status is: '${value}'`;
233
+ (0, logs_core_1.logVerification)(logText);
234
+ test_1.expect.soft(value, logText).toBe(true);
235
+ }
236
+ catch (error) {
237
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. '${control.controlDescription}' enabled status could not be verified due to reason: '${error}'`);
238
+ throw error;
239
+ }
240
+ }
241
+ else {
242
+ await this.verifyIsDisabled(control, true);
243
+ }
244
+ }
245
+ async verifyIsDisabled(control, expValue = true) {
246
+ if (expValue == true) {
247
+ await this.page.waitForLoadState("load");
248
+ }
249
+ try {
250
+ const value = await control.controlLocator.isDisabled();
251
+ const verificationResult = value === true ? "✅ PASSED" : "❌ FAILED";
252
+ const logText = `VERIFICATION: '${verificationResult}'. '${control.controlDescription}' disabled status is: '${value}'`;
253
+ (0, logs_core_1.logVerification)(logText);
254
+ test_1.expect.soft(value, logText).toBe(true);
255
+ }
256
+ catch (error) {
257
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. '${control.controlDescription}' disabled status could not be verified due to reason: '${error}'`);
258
+ throw error;
259
+ }
260
+ }
381
261
  /**
382
262
  * The function `verifyIsSelected` asynchronously verifies if a web control is selected with an
383
263
  * expected boolean value.
@@ -387,30 +267,22 @@ var Assertion = /** @class */ (function (_super) {
387
267
  * expected selection status of a web control. By default, it is set to `true`, meaning that the
388
268
  * control is expected to be selected.
389
269
  */
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
- };
270
+ async verifyIsSelected(control, expValue = true) {
271
+ if (expValue == true) {
272
+ await this.page.waitForLoadState("load");
273
+ }
274
+ try {
275
+ const isChecked = await control.controlLocator.first().isChecked();
276
+ const verificationResult = isChecked === expValue ? "✅ PASSED" : "❌ FAILED";
277
+ const logText = `VERIFICATION: '${verificationResult}' '${control.controlDescription}' selected status is: '${isChecked}' Expected: '${expValue}'`;
278
+ (0, logs_core_1.logVerification)(logText);
279
+ test_1.expect.soft(isChecked, logText).toBe(expValue);
280
+ }
281
+ catch (error) {
282
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. '${control.controlDescription}' selected status could not be verified due to reason: '${error}'`);
283
+ throw error;
284
+ }
285
+ }
414
286
  /**
415
287
  * Verify element's text as per expected value
416
288
  * If expected element's text is as per expected value then test case gets passed else failed..
@@ -423,23 +295,19 @@ var Assertion = /** @class */ (function (_super) {
423
295
  *
424
296
  * verifyDisplayedText(loginBtn, "Invalid Username Test User");
425
297
  */
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
- };
298
+ async verifyDisplayedText(control, expectedText) {
299
+ try {
300
+ const value = await this.getText(control);
301
+ const verificationResult = value?.trim() === expectedText.trim() ? "✅ PASSED" : "❌ FAILED";
302
+ const logText = `VERIFICATION: '${verificationResult}' Verify text of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
303
+ (0, logs_core_1.logVerification)(logText);
304
+ test_1.expect.soft(value?.trim(), logText).toBe(expectedText.trim());
305
+ }
306
+ catch (error) {
307
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Displayed text of '${control.controlDescription}' could not be verified due to reason: '${error}'`);
308
+ throw error;
309
+ }
310
+ }
443
311
  /**
444
312
  * Verify element's text contains partial expected value
445
313
  * If expected element's text contains expected value then test case gets passed else failed..
@@ -452,23 +320,19 @@ var Assertion = /** @class */ (function (_super) {
452
320
  *
453
321
  * verifyDisplayedTextContains(loginBtn, "Invalid Username");
454
322
  */
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
- };
323
+ async verifyDisplayedTextContains(control, expectedText) {
324
+ try {
325
+ const value = await this.getText(control);
326
+ const verificationResult = value?.trim().includes(expectedText.trim()) ? "✅ PASSED" : "❌ FAILED";
327
+ const logText = `VERIFICATION: '${verificationResult}'. Verify text of ${control.controlDescription} .Expected: '${expectedText.trim()}' is present in Actual: '${value?.trim()}'`;
328
+ (0, logs_core_1.logVerification)(logText);
329
+ test_1.expect.soft(value?.trim(), logText).toContain(expectedText.trim());
330
+ }
331
+ catch (error) {
332
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Text contains check on '${control.controlDescription}' could not be completed due to reason: '${error}'`);
333
+ throw error;
334
+ }
335
+ }
472
336
  /**
473
337
  * Verify element's text does not contains expected value
474
338
  * If expected element's text does not contains expected value then test case gets passed else failed..
@@ -481,23 +345,19 @@ var Assertion = /** @class */ (function (_super) {
481
345
  *
482
346
  * verifyDisplayedTextDoesNotContains(loginBtn, "Enter User");
483
347
  */
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
- };
348
+ async verifyDisplayedTextDoesNotContains(control, expectedText) {
349
+ try {
350
+ const value = await this.getText(control);
351
+ const verificationResult = !value?.trim().includes(expectedText.trim()) ? "✅ PASSED" : "❌ FAILED";
352
+ const logText = `VERIFICATION: '${verificationResult}'. Verify text of ${control.controlDescription} Expected: '${expectedText}' does not contain Actual: '${value}'`;
353
+ (0, logs_core_1.logVerification)(logText);
354
+ test_1.expect.soft(false, logText).toBe(value?.trim().includes(expectedText.trim()));
355
+ }
356
+ catch (error) {
357
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Text does-not-contain check on '${control.controlDescription}' could not be completed due to reason: '${error}'`);
358
+ throw error;
359
+ }
360
+ }
501
361
  /**
502
362
  * Verify element's textbox is equal to expected value
503
363
  * If expected element's textbox value to be expected value then test case gets passed else failed..
@@ -510,40 +370,32 @@ var Assertion = /** @class */ (function (_super) {
510
370
  *
511
371
  * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
512
372
  */
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
- };
373
+ async verifyTextboxValue(control, expectedText) {
374
+ try {
375
+ const value = await control.controlLocator.first().getAttribute("value");
376
+ const verificationResult = value?.trim() === expectedText ? "✅ PASSED" : "❌ FAILED";
377
+ const logText = `VERIFICATION: '${verificationResult}' Verify textbox value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
378
+ (0, logs_core_1.logVerification)(logText);
379
+ test_1.expect.soft(value?.trim(), logText).toEqual(expectedText);
380
+ }
381
+ catch (error) {
382
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Textbox value of '${control.controlDescription}' could not be verified due to reason: '${error}'`);
383
+ throw error;
384
+ }
385
+ }
386
+ async verifyTextboxValueContains(control, expectedText) {
387
+ try {
388
+ const value = await control.controlLocator.first().getAttribute("value");
389
+ const verificationResult = value?.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
390
+ const logText = `VERIFICATION: '${verificationResult}' Verify textbox value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
391
+ (0, logs_core_1.logVerification)(logText);
392
+ test_1.expect.soft(value?.trim(), logText).toContain(expectedText);
393
+ }
394
+ catch (error) {
395
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Textbox value contains check on '${control.controlDescription}' could not be completed due to reason: '${error}'`);
396
+ throw error;
397
+ }
398
+ }
547
399
  /**
548
400
  * Verify element's inner text is equal to expected value
549
401
  * If expected element's inner value to be expected value then test case gets passed else failed..
@@ -554,42 +406,34 @@ var Assertion = /** @class */ (function (_super) {
554
406
  *
555
407
  * usernameTxtbx = new WebControl(this.page.locator('#username'), 'Username textbox');
556
408
  *
557
- * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
409
+ * verifyTextboxValue(usernameTxtbx, "Test@Gmail.com");
558
410
  */
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
- };
411
+ async verifyInnerText(control, expectedText) {
412
+ try {
413
+ const value = await control.controlLocator.first().innerText();
414
+ const verificationResult = value.trim() === expectedText ? "✅ PASSED" : "❌ FAILED";
415
+ const logText = `VERIFICATION: '${verificationResult}' Verify value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
416
+ (0, logs_core_1.logVerification)(logText);
417
+ test_1.expect.soft(value.trim(), logText).toEqual(expectedText);
418
+ }
419
+ catch (error) {
420
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. innerText of '${control.controlDescription}' could not be verified due to reason: '${error}'`);
421
+ throw error;
422
+ }
423
+ }
424
+ async verifyInnerTextContains(control, expectedText) {
425
+ try {
426
+ const value = await control.controlLocator.first().innerText();
427
+ const verificationResult = value.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
428
+ const logText = `VERIFICATION: '${verificationResult}' Verify value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
429
+ (0, logs_core_1.logVerification)(logText);
430
+ test_1.expect.soft(value.trim(), logText).toContain(expectedText);
431
+ }
432
+ catch (error) {
433
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. innerText contains check on '${control.controlDescription}' could not be completed due to reason: '${error}'`);
434
+ throw error;
435
+ }
436
+ }
593
437
  /**
594
438
  * Verify element's input text is equal to expected value
595
439
  * If expected element's inner value to be expected value then test case gets passed else failed..
@@ -602,40 +446,32 @@ var Assertion = /** @class */ (function (_super) {
602
446
  *
603
447
  * verifyTextboxValue(usernameTxtbx, "Test@Adactin");
604
448
  */
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
- };
449
+ async verifyInputValue(control, expectedText) {
450
+ try {
451
+ const value = await control.controlLocator.first().inputValue();
452
+ const verificationResult = value.trim() === expectedText ? "✅ PASSED" : "❌ FAILED";
453
+ const logText = `VERIFICATION: '${verificationResult}' Verify value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
454
+ (0, logs_core_1.logVerification)(logText);
455
+ test_1.expect.soft(value.trim(), logText).toEqual(expectedText);
456
+ }
457
+ catch (error) {
458
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. inputValue of '${control.controlDescription}' could not be verified due to reason: '${error}'`);
459
+ throw error;
460
+ }
461
+ }
462
+ async verifyInputValueContains(control, expectedText) {
463
+ try {
464
+ const value = await control.controlLocator.first().inputValue();
465
+ const verificationResult = value.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
466
+ const logText = `VERIFICATION: '${verificationResult}' Verify value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
467
+ (0, logs_core_1.logVerification)(logText);
468
+ test_1.expect.soft(value.trim(), logText).toContain(expectedText);
469
+ }
470
+ catch (error) {
471
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. inputValue contains check on '${control.controlDescription}' could not be completed due to reason: '${error}'`);
472
+ throw error;
473
+ }
474
+ }
639
475
  /**
640
476
  * Verify element's checkbox/radio value is equal to expected value
641
477
  * If expected element's checkbox/radio value to be expected value then test case gets passed else failed..
@@ -648,23 +484,19 @@ var Assertion = /** @class */ (function (_super) {
648
484
  *
649
485
  * verifyCheckboxValue(isMinor, true);
650
486
  */
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
- };
487
+ async verifyCheckboxValue(control, value) {
488
+ try {
489
+ const isChecked = await this.isSelected(control);
490
+ const verificationResult = value === isChecked ? "✅ PASSED" : "❌ FAILED";
491
+ const logText = `VERIFICATION: '${verificationResult}' Verify checkbox value of ${control.controlDescription}. Expected: '${value}' Actual: '${isChecked}'`;
492
+ (0, logs_core_1.logVerification)(logText);
493
+ test_1.expect.soft(isChecked, logText).toBe(value);
494
+ }
495
+ catch (error) {
496
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Checkbox value of '${control.controlDescription}' could not be verified due to reason: '${error}'`);
497
+ throw error;
498
+ }
499
+ }
668
500
  /**
669
501
  * Verify element's tagname is equal to expected value
670
502
  * If expected element's Tagname is equal to expected value then test case gets passed else failed..
@@ -677,218 +509,111 @@ var Assertion = /** @class */ (function (_super) {
677
509
  *
678
510
  * verifyTagName(isMinor, "a");
679
511
  */
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*/];
512
+ async verifyTagName(control, expectedTagName) {
513
+ try {
514
+ const parent = control.controlLocator.first();
515
+ const tagName = await parent.evaluate((e) => e.tagName);
516
+ const verificationResult = tagName?.toLowerCase() == expectedTagName.toLowerCase() ? "✅ PASSED" : "❌ FAILED";
517
+ const logText = `VERIFICATION: '${verificationResult}' Verify Tagname of ${control.controlDescription}. Expected: '${expectedTagName.toLowerCase()}' Actual: '${tagName?.toLowerCase()}'`;
518
+ (0, logs_core_1.logVerification)(logText);
519
+ test_1.expect.soft(tagName?.toLowerCase(), logText).toBe(expectedTagName.toLowerCase());
520
+ }
521
+ catch (error) {
522
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Tag name of '${control.controlDescription}' could not be verified due to reason: '${error}'`);
523
+ throw error;
524
+ }
525
+ }
526
+ async verifyListContainsValue(control, valueToVerify) {
527
+ try {
528
+ const listOfElements = await control.controlLocator.all();
529
+ let count = 0;
530
+ for (const elem of listOfElements) {
531
+ const text = (await elem.innerText()).trim();
532
+ if (text.includes(valueToVerify)) {
533
+ count++;
778
534
  }
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*/];
535
+ }
536
+ const verificationResult = count >= 1 ? "✅ PASSED" : "❌ FAILED";
537
+ const logText = `VERIFICATION: '${verificationResult}'. '${valueToVerify}' is Present in list '${control.controlDescription}'`;
538
+ (0, logs_core_1.logVerification)(logText);
539
+ test_1.expect.soft(count, logText).toBeGreaterThanOrEqual(1);
540
+ }
541
+ catch (error) {
542
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. verifyListContainsValue for '${control.controlDescription}' due to reason: '${error}'`);
543
+ throw error;
544
+ }
545
+ }
546
+ async verifyListContainsMultipleValues(control, listOfValueToVerify, waitTillElementIsDisplayed = true) {
547
+ try {
548
+ if (waitTillElementIsDisplayed) {
549
+ await this.waitTillElementIsPresent(control);
550
+ }
551
+ for (const expectedValue of listOfValueToVerify) {
552
+ const listOfElements = await control.controlLocator.all();
553
+ let count = 0;
554
+ for (const element of listOfElements) {
555
+ const text = (await element.innerText()).trim();
556
+ if (text.includes(expectedValue)) {
557
+ count++;
558
+ }
840
559
  }
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*/];
560
+ const verificationResult = count >= 1 ? "✅ PASSED" : "❌ FAILED";
561
+ const logText = `VERIFICATION: '${verificationResult}'. '${expectedValue}' is Present in list '${control.controlDescription}'`;
562
+ (0, logs_core_1.logVerification)(logText);
563
+ test_1.expect.soft(count, logText).toBeGreaterThanOrEqual(1);
564
+ }
565
+ }
566
+ catch (error) {
567
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. verifyListContainsMultipleValues for '${control.controlDescription}' due to reason: '${error}'`);
568
+ throw error;
569
+ }
570
+ }
571
+ async verifyDropdownOptions(control, listOfValueToVerify, waitTillElementIsDisplayed = true) {
572
+ try {
573
+ if (waitTillElementIsDisplayed) {
574
+ await this.waitTillElementIsPresent(control);
575
+ }
576
+ const options = await control.controlLocator.locator('option').all();
577
+ const listOfOptions = [];
578
+ for (const option of options) {
579
+ const value = await option.innerText();
580
+ if (value) {
581
+ listOfOptions.push(value);
888
582
  }
889
- });
890
- });
891
- };
583
+ }
584
+ for (const expectedValue of listOfValueToVerify) {
585
+ const count = listOfOptions.filter((o) => o.trim().includes(expectedValue)).length;
586
+ const verificationResult = count >= 1 ? "✅ PASSED" : "❌ FAILED";
587
+ const logText = `VERIFICATION: '${verificationResult}'. '${expectedValue}' is Present in list '${control.controlDescription}'`;
588
+ (0, logs_core_1.logVerification)(logText);
589
+ test_1.expect.soft(count, logText).toBeGreaterThanOrEqual(1);
590
+ }
591
+ }
592
+ catch (error) {
593
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. verifyDropdownOptions for '${control.controlDescription}' due to reason: '${error}'`);
594
+ throw error;
595
+ }
596
+ }
597
+ async verifyListForMultipleValues(control, listOfValueToVerify, waitTillElementIsDisplayed = true) {
598
+ try {
599
+ if (waitTillElementIsDisplayed) {
600
+ await this.waitTillElementIsPresent(control);
601
+ }
602
+ const list = await control.controlLocator.all();
603
+ for (let i = 0; i < listOfValueToVerify.length; i++) {
604
+ await list[i].waitFor({ state: "visible" });
605
+ const value = await list[i].innerText();
606
+ const verificationResult = value.trim().includes(listOfValueToVerify[i]) ? "✅ PASSED" : "❌ FAILED";
607
+ const logText = `VERIFICATION: '${verificationResult}'. Expected: '${listOfValueToVerify[i]}' Actual: '${value}'`;
608
+ (0, logs_core_1.logVerification)(logText);
609
+ test_1.expect.soft(value.trim(), logText).toContain(listOfValueToVerify[i]);
610
+ }
611
+ }
612
+ catch (error) {
613
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. verifyListForMultipleValues for '${control.controlDescription}' due to reason: '${error}'`);
614
+ throw error;
615
+ }
616
+ }
892
617
  /**
893
618
  * Verify Alert text is equal to expected value
894
619
  * If alert text is equal to expected value then test case gets passed else failed..
@@ -898,24 +623,21 @@ var Assertion = /** @class */ (function (_super) {
898
623
  *
899
624
  * verifyAlertText("Password should be 8 digit.")
900
625
  */
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
- });
626
+ async verifyAlertText(expectedText) {
627
+ this.page.on('dialog', async (dialog) => {
628
+ try {
629
+ const message = dialog.message();
630
+ const verificationResult = message.trim().includes(expectedText.trim()) ? "✅ PASSED" : "❌ FAILED";
631
+ const logText = `VERIFICATION: '${verificationResult}' Verify alert text. Expected: '${expectedText}' Actual: '${message}'`;
632
+ (0, logs_core_1.logVerification)(logText);
633
+ test_1.expect.soft(message.trim(), logText).toContain(expectedText.trim());
634
+ }
635
+ catch (error) {
636
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. verifyAlertText could not be completed. Expected to contain: '${expectedText}' due to reason: '${error}'`);
637
+ throw error;
638
+ }
917
639
  });
918
- };
640
+ }
919
641
  /**
920
642
  * Verify URL contains expected value
921
643
  * If URL contains expected value then test case gets passed else failed..
@@ -925,23 +647,19 @@ var Assertion = /** @class */ (function (_super) {
925
647
  *
926
648
  * verifyURLContains("google.com");
927
649
  */
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
- };
650
+ async verifyURLContains(subString) {
651
+ try {
652
+ const value = await this.getURL();
653
+ const verificationResult = value.trim().includes(subString.trim()) ? "✅ PASSED" : "❌ FAILED";
654
+ const logText = `VERIFICATION: '${verificationResult}' Verify URL contains. Expected: '${subString}' Actual: '${value}'`;
655
+ (0, logs_core_1.logVerification)(logText);
656
+ test_1.expect.soft(value.trim(), logText).toContain(subString.trim());
657
+ }
658
+ catch (error) {
659
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. URL contains check for '${subString}' could not be completed due to reason: '${error}'`);
660
+ throw error;
661
+ }
662
+ }
945
663
  /**
946
664
  * Verify count of elements which matched the control
947
665
  * If count of elements is equal to expected value then test case will get passed else failed..
@@ -953,57 +671,45 @@ var Assertion = /** @class */ (function (_super) {
953
671
  * checkboxes = new WebControl(this.page.locator("xpath=//a"), 'checkboxes');
954
672
  * verifyCountOfElements(isMinor, 5);
955
673
  */
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
- };
674
+ async verifyCountOfElements(control, expectedCount) {
675
+ try {
676
+ const value = await control.controlLocator.count();
677
+ const verificationResult = value == expectedCount ? "✅ PASSED" : "❌ FAILED";
678
+ const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of ${control.controlDescription}. Expected: '${expectedCount}' Actual: '${value}'`;
679
+ (0, logs_core_1.logVerification)(logText);
680
+ test_1.expect.soft(value, logText).toBe(expectedCount);
681
+ }
682
+ catch (error) {
683
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. verifyCountOfElements for '${control.controlDescription}' could not be completed due to reason: '${error}'`);
684
+ throw error;
685
+ }
686
+ }
687
+ async verifyCountOfElementsIsGreaterOrEqual(control, expectedCount) {
688
+ try {
689
+ const value = await control.controlLocator.count();
690
+ const verificationResult = value >= expectedCount ? "✅ PASSED" : "❌ FAILED";
691
+ const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of ${control.controlDescription}. Expected: '${expectedCount}' Actual: '${value}'`;
692
+ (0, logs_core_1.logVerification)(logText);
693
+ test_1.expect.soft(value, logText).toBeGreaterThanOrEqual(expectedCount);
694
+ }
695
+ catch (error) {
696
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. verifyCountOfElementsIsGreaterOrEqual for '${control.controlDescription}' could not be completed due to reason: '${error}'`);
697
+ throw error;
698
+ }
699
+ }
700
+ async verifyCountOfElementsIsLesseOrEqual(control, expectedCount) {
701
+ try {
702
+ const value = await control.controlLocator.count();
703
+ const verificationResult = value <= expectedCount ? "✅ PASSED" : "❌ FAILED";
704
+ const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of ${control.controlDescription}. Expected: '${expectedCount}' Actual: '${value}'`;
705
+ (0, logs_core_1.logVerification)(logText);
706
+ test_1.expect.soft(value, logText).toBeLessThanOrEqual(expectedCount);
707
+ }
708
+ catch (error) {
709
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. verifyCountOfElementsIsLesseOrEqual for '${control.controlDescription}' could not be completed due to reason: '${error}'`);
710
+ throw error;
711
+ }
712
+ }
1007
713
  /**
1008
714
  * Verify title of web page contains expected value
1009
715
  * If title contains expected value then test case will get passed else failed..
@@ -1013,33 +719,18 @@ var Assertion = /** @class */ (function (_super) {
1013
719
  *
1014
720
  * verifyPageTitleContains("Google");
1015
721
  */
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));
722
+ async verifyPageTitleContains(expectedText) {
723
+ try {
724
+ const value = await this.page.title();
725
+ const verificationResult = value.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
726
+ const logText = `VERIFICATION: '${verificationResult}' Verify title contains. Expected: '${expectedText}' Actual: '${value}'`;
727
+ (0, logs_core_1.logVerification)(logText);
728
+ test_1.expect.soft(value.trim(), logText).toContain(expectedText);
729
+ }
730
+ catch (error) {
731
+ (0, logs_core_1.logError)(`VERIFICATION: ' FAILED'. Page title could not be verified. Expected: '${expectedText}' to be present in title due to reason: '${error}'`);
732
+ throw error;
733
+ }
734
+ }
735
+ }
1045
736
  exports.Assertion = Assertion;