playwright-ts-automationframework 1.1.48 → 1.1.50
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.
|
@@ -96,6 +96,7 @@ export declare class Actions extends BasePage {
|
|
|
96
96
|
* selectDropDownByText(cityDrpdwn, "Sydney");
|
|
97
97
|
*/
|
|
98
98
|
selectDropDownByText(control: WebControl, optionTobeSelcted: string): Promise<void>;
|
|
99
|
+
selectDropDownByPartialText(control: WebControl, partialText: string): Promise<void>;
|
|
99
100
|
/**
|
|
100
101
|
* Select dropdown element by index.
|
|
101
102
|
*
|
package/lib/core/actions.core.js
CHANGED
|
@@ -289,6 +289,33 @@ var Actions = /** @class */ (function (_super) {
|
|
|
289
289
|
});
|
|
290
290
|
});
|
|
291
291
|
};
|
|
292
|
+
Actions.prototype.selectDropDownByPartialText = function (control, partialText) {
|
|
293
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
294
|
+
var options, matchingOption;
|
|
295
|
+
return __generator(this, function (_a) {
|
|
296
|
+
switch (_a.label) {
|
|
297
|
+
case 0: return [4 /*yield*/, control.controlLocator.first().locator('option').allInnerTexts()];
|
|
298
|
+
case 1:
|
|
299
|
+
options = _a.sent();
|
|
300
|
+
matchingOption = options.find(function (option) { return option.includes(partialText); });
|
|
301
|
+
if (!matchingOption) {
|
|
302
|
+
(0, logs_core_1.logError)("No option found containing '".concat(partialText, "' in '").concat(control.controlDescription, "'"));
|
|
303
|
+
throw new Error("No matching option found for '".concat(partialText, "'"));
|
|
304
|
+
}
|
|
305
|
+
return [4 /*yield*/, control.controlLocator.first().selectOption({ label: matchingOption }).then(function () {
|
|
306
|
+
(0, logs_core_1.logAction)("Selected '".concat(matchingOption, "' from '").concat(control.controlDescription, "'"));
|
|
307
|
+
}, function (error) {
|
|
308
|
+
(0, logs_core_1.logError)("Unable to select '".concat(matchingOption, "' from '").concat(control.controlDescription, "'"));
|
|
309
|
+
(0, logs_core_1.logConsole)("Error: '".concat(error, "'"));
|
|
310
|
+
throw error;
|
|
311
|
+
})];
|
|
312
|
+
case 2:
|
|
313
|
+
_a.sent();
|
|
314
|
+
return [2 /*return*/];
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
};
|
|
292
319
|
/**
|
|
293
320
|
* Select dropdown element by index.
|
|
294
321
|
*
|
|
@@ -160,6 +160,7 @@ export declare class Assertion extends Actions {
|
|
|
160
160
|
* verifyTextboxValue(usernameTxtbx, "Test@Adactin");
|
|
161
161
|
*/
|
|
162
162
|
verifyTextboxValue(control: WebControl, expectedText: string): Promise<void>;
|
|
163
|
+
verifyTextboxValueContains(control: WebControl, expectedText: string): Promise<void>;
|
|
163
164
|
/**
|
|
164
165
|
* Verify element's inner text is equal to expected value
|
|
165
166
|
* If expected element's inner value to be expected value then test case gets passed else failed..
|
|
@@ -173,6 +174,7 @@ export declare class Assertion extends Actions {
|
|
|
173
174
|
* verifyTextboxValue(usernameTxtbx, "Test@Adactin");
|
|
174
175
|
*/
|
|
175
176
|
verifyInnerText(control: WebControl, expectedText: string): Promise<void>;
|
|
177
|
+
verifyInnerTextContains(control: WebControl, expectedText: string): Promise<void>;
|
|
176
178
|
/**
|
|
177
179
|
* Verify element's input text is equal to expected value
|
|
178
180
|
* If expected element's inner value to be expected value then test case gets passed else failed..
|
|
@@ -186,6 +188,7 @@ export declare class Assertion extends Actions {
|
|
|
186
188
|
* verifyTextboxValue(usernameTxtbx, "Test@Adactin");
|
|
187
189
|
*/
|
|
188
190
|
verifyInputValue(control: WebControl, expectedText: string): Promise<void>;
|
|
191
|
+
verifyInputValueContains(control: WebControl, expectedText: string): Promise<void>;
|
|
189
192
|
/**
|
|
190
193
|
* Verify element's checkbox/radio value is equal to expected value
|
|
191
194
|
* If expected element's checkbox/radio value to be expected value then test case gets passed else failed..
|
|
@@ -466,6 +466,23 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
466
466
|
});
|
|
467
467
|
});
|
|
468
468
|
};
|
|
469
|
+
Assertion.prototype.verifyTextboxValueContains = function (control, expectedText) {
|
|
470
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
471
|
+
return __generator(this, function (_a) {
|
|
472
|
+
switch (_a.label) {
|
|
473
|
+
case 0: return [4 /*yield*/, control.controlLocator.first().getAttribute("value").then(function (value) {
|
|
474
|
+
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "PASSED" : "FAILED";
|
|
475
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
476
|
+
(0, logs_core_1.logVerification)(logText);
|
|
477
|
+
(0, test_1.expect)(value, logText).toContain(expectedText);
|
|
478
|
+
})];
|
|
479
|
+
case 1:
|
|
480
|
+
_a.sent();
|
|
481
|
+
return [2 /*return*/];
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
};
|
|
469
486
|
/**
|
|
470
487
|
* Verify element's inner text is equal to expected value
|
|
471
488
|
* If expected element's inner value to be expected value then test case gets passed else failed..
|
|
@@ -495,6 +512,23 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
495
512
|
});
|
|
496
513
|
});
|
|
497
514
|
};
|
|
515
|
+
Assertion.prototype.verifyInnerTextContains = function (control, expectedText) {
|
|
516
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
517
|
+
return __generator(this, function (_a) {
|
|
518
|
+
switch (_a.label) {
|
|
519
|
+
case 0: return [4 /*yield*/, control.controlLocator.first().innerText().then(function (value) {
|
|
520
|
+
var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
|
|
521
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
522
|
+
(0, logs_core_1.logVerification)(logText);
|
|
523
|
+
(0, test_1.expect)(value, logText).toContain(expectedText);
|
|
524
|
+
})];
|
|
525
|
+
case 1:
|
|
526
|
+
_a.sent();
|
|
527
|
+
return [2 /*return*/];
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
});
|
|
531
|
+
};
|
|
498
532
|
/**
|
|
499
533
|
* Verify element's input text is equal to expected value
|
|
500
534
|
* If expected element's inner value to be expected value then test case gets passed else failed..
|
|
@@ -524,6 +558,23 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
524
558
|
});
|
|
525
559
|
});
|
|
526
560
|
};
|
|
561
|
+
Assertion.prototype.verifyInputValueContains = function (control, expectedText) {
|
|
562
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
563
|
+
return __generator(this, function (_a) {
|
|
564
|
+
switch (_a.label) {
|
|
565
|
+
case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
|
|
566
|
+
var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
|
|
567
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
568
|
+
(0, logs_core_1.logVerification)(logText);
|
|
569
|
+
(0, test_1.expect)(value, logText).toContain(expectedText);
|
|
570
|
+
})];
|
|
571
|
+
case 1:
|
|
572
|
+
_a.sent();
|
|
573
|
+
return [2 /*return*/];
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
};
|
|
527
578
|
/**
|
|
528
579
|
* Verify element's checkbox/radio value is equal to expected value
|
|
529
580
|
* If expected element's checkbox/radio value to be expected value then test case gets passed else failed..
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright-ts-automationframework",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.50",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"ignore-case": "^0.1.0"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@playwright/test": "^1.51.
|
|
23
|
-
"@types/node": "^22.13.
|
|
22
|
+
"@playwright/test": "^1.51.1",
|
|
23
|
+
"@types/node": "^22.13.13",
|
|
24
24
|
"log4js": "^6.9.1",
|
|
25
25
|
"nodemailer": "^6.10.0",
|
|
26
|
-
"npm": "^
|
|
26
|
+
"npm": "^11.2.0",
|
|
27
27
|
"path": "^0.12.7",
|
|
28
28
|
"typescript": "^5.8.2"
|
|
29
29
|
},
|