playwright-ts-automationframework 1.1.18 → 1.1.19
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/assertion.core.d.ts +25 -15
- package/lib/core/assertion.core.js +71 -39
- package/package.json +5 -5
|
@@ -70,6 +70,21 @@ export declare class Assertion extends Actions {
|
|
|
70
70
|
* verifyAttributeValue(loginBtn, "value", "Submit");
|
|
71
71
|
*/
|
|
72
72
|
verifyAttributeValue(control: WebControl, attributeName: string, expectedAttributeValue: string): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Verify element's attribute value contains expected value
|
|
75
|
+
* If element's attribute value contains expected value then test case gets passsed else failed.
|
|
76
|
+
*
|
|
77
|
+
* @param control Control of which attribute value need to verify.
|
|
78
|
+
* @param attributeName Attribute name
|
|
79
|
+
* @param expectedText Expected partial value.
|
|
80
|
+
*
|
|
81
|
+
* Example:
|
|
82
|
+
*
|
|
83
|
+
* loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
|
|
84
|
+
*
|
|
85
|
+
* verifyAttributeValueContains(loginBtn, "value", "Submit");
|
|
86
|
+
*/
|
|
87
|
+
verifyAttributeValueContains(locator: WebControl, attributeName: string, attributeValue: string): Promise<void>;
|
|
73
88
|
/**
|
|
74
89
|
* Verify element's enabled/disabled status as per expected value
|
|
75
90
|
* If expected element's enabled status is as per expected then test case gets passsed else failed.
|
|
@@ -83,6 +98,16 @@ export declare class Assertion extends Actions {
|
|
|
83
98
|
* verifyIsEnabled(loginBtn, true);
|
|
84
99
|
*/
|
|
85
100
|
verifyIsEnabled(control: WebControl, expValue?: boolean): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* The function `verifyIsSelected` asynchronously verifies if a web control is selected with an
|
|
103
|
+
* expected boolean value.
|
|
104
|
+
* @param {WebControl} control - The `control` parameter is a WebControl object that represents an
|
|
105
|
+
* element on a web page that you want to verify the selected status of.
|
|
106
|
+
* @param {boolean} [expValue=true] - The `expValue` parameter is a boolean value that represents the
|
|
107
|
+
* expected selection status of a web control. By default, it is set to `true`, meaning that the
|
|
108
|
+
* control is expected to be selected.
|
|
109
|
+
*/
|
|
110
|
+
verifyIsSelected(control: WebControl, expValue?: boolean): Promise<void>;
|
|
86
111
|
/**
|
|
87
112
|
* Verify element's text as per expected value
|
|
88
113
|
* If expected element's text is as per expected value then test case gets passsed else failed.
|
|
@@ -149,21 +174,6 @@ export declare class Assertion extends Actions {
|
|
|
149
174
|
*/
|
|
150
175
|
verifyCheckboxValue(control: WebControl, value: boolean): Promise<void>;
|
|
151
176
|
/**
|
|
152
|
-
* Verify element's attribute value contains expected value
|
|
153
|
-
* If element's attribute value contains expected value then test case gets passsed else failed.
|
|
154
|
-
*
|
|
155
|
-
* @param control Control of which attribute value need to verify.
|
|
156
|
-
* @param attributeName Attribute name
|
|
157
|
-
* @param expectedText Expected partial value.
|
|
158
|
-
*
|
|
159
|
-
* Example:
|
|
160
|
-
*
|
|
161
|
-
* loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
|
|
162
|
-
*
|
|
163
|
-
* verifyAttributeValueContains(loginBtn, "value", "Submit");
|
|
164
|
-
*/
|
|
165
|
-
verifyAttributeValueContains(locator: WebControl, attributeName: string, attributeValue: string): Promise<void>;
|
|
166
|
-
/**
|
|
167
177
|
* Verify element's tagname is equal to expected value
|
|
168
178
|
* If expected element's Tagname is equal to expected value then test case gets passsed else failed.
|
|
169
179
|
*
|
|
@@ -214,6 +214,45 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
214
214
|
});
|
|
215
215
|
});
|
|
216
216
|
};
|
|
217
|
+
/**
|
|
218
|
+
* Verify element's attribute value contains expected value
|
|
219
|
+
* If element's attribute value contains expected value then test case gets passsed else failed.
|
|
220
|
+
*
|
|
221
|
+
* @param control Control of which attribute value need to verify.
|
|
222
|
+
* @param attributeName Attribute name
|
|
223
|
+
* @param expectedText Expected partial value.
|
|
224
|
+
*
|
|
225
|
+
* Example:
|
|
226
|
+
*
|
|
227
|
+
* loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
|
|
228
|
+
*
|
|
229
|
+
* verifyAttributeValueContains(loginBtn, "value", "Submit");
|
|
230
|
+
*/
|
|
231
|
+
Assertion.prototype.verifyAttributeValueContains = function (locator, attributeName, attributeValue) {
|
|
232
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
233
|
+
var _a;
|
|
234
|
+
return __generator(this, function (_b) {
|
|
235
|
+
switch (_b.label) {
|
|
236
|
+
case 0: return [4 /*yield*/, this.getAttributeValue(locator, attributeName).then(function (value) {
|
|
237
|
+
if (value != null) {
|
|
238
|
+
var verificationResult = value.includes(attributeValue) ? "PASSED" : "Failed";
|
|
239
|
+
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(attributeValue, "' contains Actual : '").concat(value, "'"));
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
(0, logs_core_1.logVerification)("VERIFICATION: Failed. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'"));
|
|
243
|
+
}
|
|
244
|
+
})];
|
|
245
|
+
case 1:
|
|
246
|
+
_b.sent();
|
|
247
|
+
_a = test_1.expect;
|
|
248
|
+
return [4 /*yield*/, this.getAttributeValue(locator, attributeName)];
|
|
249
|
+
case 2:
|
|
250
|
+
_a.apply(void 0, [_b.sent()]).toContain(attributeValue);
|
|
251
|
+
return [2 /*return*/];
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
};
|
|
217
256
|
/**
|
|
218
257
|
* Verify element's enabled/disabled status as per expected value
|
|
219
258
|
* If expected element's enabled status is as per expected then test case gets passsed else failed.
|
|
@@ -249,6 +288,38 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
249
288
|
});
|
|
250
289
|
});
|
|
251
290
|
};
|
|
291
|
+
/**
|
|
292
|
+
* The function `verifyIsSelected` asynchronously verifies if a web control is selected with an
|
|
293
|
+
* expected boolean value.
|
|
294
|
+
* @param {WebControl} control - The `control` parameter is a WebControl object that represents an
|
|
295
|
+
* element on a web page that you want to verify the selected status of.
|
|
296
|
+
* @param {boolean} [expValue=true] - The `expValue` parameter is a boolean value that represents the
|
|
297
|
+
* expected selection status of a web control. By default, it is set to `true`, meaning that the
|
|
298
|
+
* control is expected to be selected.
|
|
299
|
+
*/
|
|
300
|
+
Assertion.prototype.verifyIsSelected = function (control_1) {
|
|
301
|
+
return __awaiter(this, arguments, void 0, function (control, expValue) {
|
|
302
|
+
if (expValue === void 0) { expValue = true; }
|
|
303
|
+
return __generator(this, function (_a) {
|
|
304
|
+
switch (_a.label) {
|
|
305
|
+
case 0:
|
|
306
|
+
if (!(expValue == true)) return [3 /*break*/, 2];
|
|
307
|
+
return [4 /*yield*/, this.page.waitForLoadState("load")];
|
|
308
|
+
case 1:
|
|
309
|
+
_a.sent();
|
|
310
|
+
_a.label = 2;
|
|
311
|
+
case 2: return [4 /*yield*/, control.controlLocator.isChecked().then(function (isChecked) {
|
|
312
|
+
var verificationResult = isChecked === expValue ? "PASSED" : "FAILED";
|
|
313
|
+
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' selected status is: '").concat(isChecked, "'"));
|
|
314
|
+
(0, test_1.expect)(isChecked).toBe(expValue);
|
|
315
|
+
})];
|
|
316
|
+
case 3:
|
|
317
|
+
_a.sent();
|
|
318
|
+
return [2 /*return*/];
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
};
|
|
252
323
|
/**
|
|
253
324
|
* Verify element's text as per expected value
|
|
254
325
|
* If expected element's text is as per expected value then test case gets passsed else failed.
|
|
@@ -390,45 +461,6 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
390
461
|
});
|
|
391
462
|
};
|
|
392
463
|
/**
|
|
393
|
-
* Verify element's attribute value contains expected value
|
|
394
|
-
* If element's attribute value contains expected value then test case gets passsed else failed.
|
|
395
|
-
*
|
|
396
|
-
* @param control Control of which attribute value need to verify.
|
|
397
|
-
* @param attributeName Attribute name
|
|
398
|
-
* @param expectedText Expected partial value.
|
|
399
|
-
*
|
|
400
|
-
* Example:
|
|
401
|
-
*
|
|
402
|
-
* loginBtn = new WebControl(this.page.locator('#login'), 'Login button');
|
|
403
|
-
*
|
|
404
|
-
* verifyAttributeValueContains(loginBtn, "value", "Submit");
|
|
405
|
-
*/
|
|
406
|
-
Assertion.prototype.verifyAttributeValueContains = function (locator, attributeName, attributeValue) {
|
|
407
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
408
|
-
var _a;
|
|
409
|
-
return __generator(this, function (_b) {
|
|
410
|
-
switch (_b.label) {
|
|
411
|
-
case 0: return [4 /*yield*/, this.getAttributeValue(locator, attributeName).then(function (value) {
|
|
412
|
-
if (value != null) {
|
|
413
|
-
var verificationResult = value.includes(attributeValue) ? "PASSED" : "Failed";
|
|
414
|
-
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(attributeValue, "' contains Actual : '").concat(value, "'"));
|
|
415
|
-
}
|
|
416
|
-
else {
|
|
417
|
-
(0, logs_core_1.logVerification)("VERIFICATION: Failed. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'"));
|
|
418
|
-
}
|
|
419
|
-
})];
|
|
420
|
-
case 1:
|
|
421
|
-
_b.sent();
|
|
422
|
-
_a = test_1.expect;
|
|
423
|
-
return [4 /*yield*/, this.getAttributeValue(locator, attributeName)];
|
|
424
|
-
case 2:
|
|
425
|
-
_a.apply(void 0, [_b.sent()]).toContain(attributeValue);
|
|
426
|
-
return [2 /*return*/];
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
});
|
|
430
|
-
};
|
|
431
|
-
/**
|
|
432
464
|
* Verify element's tagname is equal to expected value
|
|
433
465
|
* If expected element's Tagname is equal to expected value then test case gets passsed else failed.
|
|
434
466
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright-ts-automationframework",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"ignore-case": "^0.1.0"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@playwright/test": "^1.
|
|
23
|
-
"@types/node": "^20.16.
|
|
22
|
+
"@playwright/test": "^1.48.0",
|
|
23
|
+
"@types/node": "^20.16.11",
|
|
24
24
|
"log4js": "^6.9.1",
|
|
25
25
|
"nodemailer": "^6.9.15",
|
|
26
|
-
"npm": "^10.
|
|
26
|
+
"npm": "^10.9.0",
|
|
27
27
|
"path": "^0.12.7",
|
|
28
|
-
"typescript": "^5.6.
|
|
28
|
+
"typescript": "^5.6.3"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"lib/**/**"
|