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.
- package/lib/core/actions.core.d.ts +13 -1
- package/lib/core/actions.core.js +433 -735
- package/lib/core/assertion.core.d.ts +1 -1
- package/lib/core/assertion.core.js +466 -775
- package/lib/core/basePage.core.js +19 -66
- package/lib/core/configuration.core.js +44 -67
- package/lib/core/global.setup.js +7 -55
- package/lib/core/global.tearDown.js +4 -51
- package/lib/core/logs.core.js +12 -12
- package/lib/core/sendEmail.js +38 -93
- package/lib/core/webControl.core.js +5 -4
- package/lib/src/core/actions.core.d.ts +349 -0
- package/lib/src/core/actions.core.js +1056 -0
- package/lib/src/core/assertion.core.d.ts +269 -0
- package/lib/src/core/assertion.core.js +1045 -0
- package/lib/src/core/basePage.core.d.ts +17 -0
- package/lib/src/core/basePage.core.js +86 -0
- package/lib/src/core/configuration.core.d.ts +22 -0
- package/lib/src/core/configuration.core.js +84 -0
- package/lib/src/core/global.setup.d.ts +3 -0
- package/lib/src/core/global.setup.js +60 -0
- package/lib/src/core/global.tearDown.d.ts +3 -0
- package/lib/src/core/global.tearDown.js +56 -0
- package/lib/src/core/logs.core.d.ts +5 -0
- package/lib/src/core/logs.core.js +54 -0
- package/lib/src/core/sendEmail.d.ts +7 -0
- package/lib/src/core/sendEmail.js +102 -0
- package/lib/src/core/webControl.core.d.ts +10 -0
- package/lib/src/core/webControl.core.js +15 -0
- package/lib/src/index.d.ts +8 -0
- package/lib/src/index.js +23 -0
- package/package.json +6 -6
|
@@ -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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
78
|
-
if (controlDescription === void 0) { controlDescription = ""; }
|
|
25
|
+
verifyIsEquals(object1, object2, controlDescription = "") {
|
|
79
26
|
try {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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)(
|
|
33
|
+
(0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Expected: '${object1}' Actual: '${object2}' due to reason: '${error1}'`);
|
|
86
34
|
throw error1;
|
|
87
35
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (controlDescription === void 0) { controlDescription = ""; }
|
|
36
|
+
}
|
|
37
|
+
verifyIsNotEquals(object1, object2, controlDescription = "") {
|
|
91
38
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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)(
|
|
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
|
-
|
|
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
|
-
|
|
106
|
-
|
|
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
|
-
|
|
112
|
-
|
|
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)(
|
|
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
|
-
|
|
137
|
-
if (controlDescription === void 0) { controlDescription = ""; }
|
|
83
|
+
verifyIsContains(actual, expected, controlDescription = "") {
|
|
138
84
|
try {
|
|
139
|
-
|
|
140
|
-
|
|
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)(
|
|
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
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
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
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
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
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
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
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
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@
|
|
409
|
+
* verifyTextboxValue(usernameTxtbx, "Test@Gmail.com");
|
|
558
410
|
*/
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
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
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
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
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
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
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
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
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
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
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
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
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
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
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
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
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
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
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
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;
|