playwright-ts-automationframework 1.1.57 → 1.1.59
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 +4 -4
- package/lib/core/actions.core.js +55 -46
- package/package.json +4 -4
|
@@ -336,10 +336,10 @@ export declare class Actions extends BasePage {
|
|
|
336
336
|
*/
|
|
337
337
|
sleep(timeInSeconds?: number): Promise<void>;
|
|
338
338
|
waitForPageTimeout(timeoutInSeconds?: number): Promise<void>;
|
|
339
|
-
waitForPageLoad(): Promise<void>;
|
|
340
|
-
waitForPageDOMcontentLoaded(): Promise<void>;
|
|
341
|
-
waitForNetworkIdle(): Promise<void>;
|
|
342
|
-
refreshWebPage(): Promise<void>;
|
|
339
|
+
waitForPageLoad(timeInSeconds?: number): Promise<void>;
|
|
340
|
+
waitForPageDOMcontentLoaded(timeInSeconds?: number): Promise<void>;
|
|
341
|
+
waitForNetworkIdle(timeInSeconds?: number): Promise<void>;
|
|
342
|
+
refreshWebPage(timeInSeconds?: number): Promise<void>;
|
|
343
343
|
/**
|
|
344
344
|
* Close the browser instance
|
|
345
345
|
*
|
package/lib/core/actions.core.js
CHANGED
|
@@ -360,30 +360,33 @@ var Actions = /** @class */ (function (_super) {
|
|
|
360
360
|
*/
|
|
361
361
|
Actions.prototype.selectCheckbox = function (control_1) {
|
|
362
362
|
return __awaiter(this, arguments, void 0, function (control, expectedCheckboxValue) {
|
|
363
|
+
var error_1;
|
|
363
364
|
if (expectedCheckboxValue === void 0) { expectedCheckboxValue = true; }
|
|
364
365
|
return __generator(this, function (_a) {
|
|
365
366
|
switch (_a.label) {
|
|
366
367
|
case 0: return [4 /*yield*/, this.waitTillElementIsPresent(control)];
|
|
367
368
|
case 1:
|
|
368
369
|
_a.sent();
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
throw error;
|
|
375
|
-
});
|
|
376
|
-
return [3 /*break*/, 4];
|
|
377
|
-
case 2: return [4 /*yield*/, control.controlLocator.first().uncheck().then(function () {
|
|
378
|
-
(0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as unchecked");
|
|
379
|
-
}, function (error) {
|
|
380
|
-
(0, logs_core_1.logError)("\u274C Unable to set checkbox value of '".concat(control.controlDescription, "' as unchecked"));
|
|
381
|
-
throw error;
|
|
382
|
-
})];
|
|
370
|
+
_a.label = 2;
|
|
371
|
+
case 2:
|
|
372
|
+
_a.trys.push([2, 7, , 8]);
|
|
373
|
+
if (!expectedCheckboxValue) return [3 /*break*/, 4];
|
|
374
|
+
return [4 /*yield*/, control.controlLocator.first().check()];
|
|
383
375
|
case 3:
|
|
384
376
|
_a.sent();
|
|
385
|
-
|
|
386
|
-
|
|
377
|
+
(0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as checked");
|
|
378
|
+
return [3 /*break*/, 6];
|
|
379
|
+
case 4: return [4 /*yield*/, control.controlLocator.first().uncheck()];
|
|
380
|
+
case 5:
|
|
381
|
+
_a.sent();
|
|
382
|
+
(0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as unchecked");
|
|
383
|
+
_a.label = 6;
|
|
384
|
+
case 6: return [3 /*break*/, 8];
|
|
385
|
+
case 7:
|
|
386
|
+
error_1 = _a.sent();
|
|
387
|
+
(0, logs_core_1.logError)("\u274C Unable to set checkbox value of '".concat(control.controlDescription, "' as ").concat(expectedCheckboxValue ? "checked" : "unchecked"));
|
|
388
|
+
throw error_1;
|
|
389
|
+
case 8: return [2 /*return*/];
|
|
387
390
|
}
|
|
388
391
|
});
|
|
389
392
|
});
|
|
@@ -487,7 +490,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
487
490
|
*/
|
|
488
491
|
Actions.prototype.getText = function (control) {
|
|
489
492
|
return __awaiter(this, void 0, void 0, function () {
|
|
490
|
-
var text,
|
|
493
|
+
var text, error_2;
|
|
491
494
|
return __generator(this, function (_a) {
|
|
492
495
|
switch (_a.label) {
|
|
493
496
|
case 0:
|
|
@@ -498,8 +501,8 @@ var Actions = /** @class */ (function (_super) {
|
|
|
498
501
|
(0, logs_core_1.logConsole)("Value read from '".concat(control.controlDescription, "' is: '").concat(text, "'"));
|
|
499
502
|
return [2 /*return*/, text];
|
|
500
503
|
case 2:
|
|
501
|
-
|
|
502
|
-
(0, logs_core_1.logError)("\u274C Unable to read the text from '".concat(control.controlDescription, "' due to reason: ").concat(
|
|
504
|
+
error_2 = _a.sent();
|
|
505
|
+
(0, logs_core_1.logError)("\u274C Unable to read the text from '".concat(control.controlDescription, "' due to reason: ").concat(error_2));
|
|
503
506
|
return [2 /*return*/, '']; // Return an empty string or handle it as needed
|
|
504
507
|
case 3: return [2 /*return*/];
|
|
505
508
|
}
|
|
@@ -519,7 +522,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
519
522
|
*/
|
|
520
523
|
Actions.prototype.getTextboxValue = function (control) {
|
|
521
524
|
return __awaiter(this, void 0, void 0, function () {
|
|
522
|
-
var value,
|
|
525
|
+
var value, error_3;
|
|
523
526
|
return __generator(this, function (_a) {
|
|
524
527
|
switch (_a.label) {
|
|
525
528
|
case 0:
|
|
@@ -530,8 +533,8 @@ var Actions = /** @class */ (function (_super) {
|
|
|
530
533
|
(0, logs_core_1.logConsole)("Value read from textbox '".concat(control.controlDescription, "' is: '").concat(value, "'"));
|
|
531
534
|
return [2 /*return*/, value];
|
|
532
535
|
case 2:
|
|
533
|
-
|
|
534
|
-
(0, logs_core_1.logError)("\u274C Unable to read the value from '".concat(control.controlDescription, "' due to reason: ").concat(
|
|
536
|
+
error_3 = _a.sent();
|
|
537
|
+
(0, logs_core_1.logError)("\u274C Unable to read the value from '".concat(control.controlDescription, "' due to reason: ").concat(error_3));
|
|
535
538
|
return [2 /*return*/, '']; // Return an empty string or handle it as needed
|
|
536
539
|
case 3: return [2 /*return*/];
|
|
537
540
|
}
|
|
@@ -551,7 +554,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
551
554
|
*/
|
|
552
555
|
Actions.prototype.getSelectedItemFromDropdown = function (control) {
|
|
553
556
|
return __awaiter(this, void 0, void 0, function () {
|
|
554
|
-
var value,
|
|
557
|
+
var value, error_4;
|
|
555
558
|
return __generator(this, function (_a) {
|
|
556
559
|
switch (_a.label) {
|
|
557
560
|
case 0:
|
|
@@ -562,8 +565,8 @@ var Actions = /** @class */ (function (_super) {
|
|
|
562
565
|
(0, logs_core_1.logConsole)("Value read from '".concat(control.controlDescription, "' is: '").concat(value, "'"));
|
|
563
566
|
return [2 /*return*/, value];
|
|
564
567
|
case 2:
|
|
565
|
-
|
|
566
|
-
(0, logs_core_1.logError)("\u274C Unable to read the value from '".concat(control.controlDescription, "' due to reason: ").concat(
|
|
568
|
+
error_4 = _a.sent();
|
|
569
|
+
(0, logs_core_1.logError)("\u274C Unable to read the value from '".concat(control.controlDescription, "' due to reason: ").concat(error_4));
|
|
567
570
|
return [2 /*return*/, '']; // Return an empty string or handle it as needed
|
|
568
571
|
case 3: return [2 /*return*/];
|
|
569
572
|
}
|
|
@@ -584,7 +587,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
584
587
|
*/
|
|
585
588
|
Actions.prototype.getAttributeValue = function (control, attributeName) {
|
|
586
589
|
return __awaiter(this, void 0, void 0, function () {
|
|
587
|
-
var value,
|
|
590
|
+
var value, error_5;
|
|
588
591
|
return __generator(this, function (_a) {
|
|
589
592
|
switch (_a.label) {
|
|
590
593
|
case 0:
|
|
@@ -595,9 +598,9 @@ var Actions = /** @class */ (function (_super) {
|
|
|
595
598
|
(0, logs_core_1.logConsole)("Attribute value for '".concat(control.controlDescription, "' - Attribute Name: '").concat(attributeName, "', Value: '").concat(value, "'"));
|
|
596
599
|
return [2 /*return*/, value];
|
|
597
600
|
case 2:
|
|
598
|
-
|
|
599
|
-
(0, logs_core_1.logError)("\u274C Unable to read attribute value from '".concat(control.controlDescription, "' - Reason: ").concat(
|
|
600
|
-
return [2 /*return*/,
|
|
601
|
+
error_5 = _a.sent();
|
|
602
|
+
(0, logs_core_1.logError)("\u274C Unable to read attribute value from '".concat(control.controlDescription, "' - Reason: ").concat(error_5));
|
|
603
|
+
return [2 /*return*/, ''];
|
|
601
604
|
case 3: return [2 /*return*/];
|
|
602
605
|
}
|
|
603
606
|
});
|
|
@@ -815,7 +818,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
815
818
|
*/
|
|
816
819
|
Actions.prototype.waitTillPageURLContains = function (url_1) {
|
|
817
820
|
return __awaiter(this, arguments, void 0, function (url, timeoutInSeconds) {
|
|
818
|
-
var
|
|
821
|
+
var error_6;
|
|
819
822
|
if (timeoutInSeconds === void 0) { timeoutInSeconds = 60; }
|
|
820
823
|
return __generator(this, function (_a) {
|
|
821
824
|
switch (_a.label) {
|
|
@@ -827,7 +830,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
827
830
|
})];
|
|
828
831
|
case 1: return [2 /*return*/, _a.sent()];
|
|
829
832
|
case 2:
|
|
830
|
-
|
|
833
|
+
error_6 = _a.sent();
|
|
831
834
|
return [3 /*break*/, 3];
|
|
832
835
|
case 3: return [2 /*return*/];
|
|
833
836
|
}
|
|
@@ -847,7 +850,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
847
850
|
*/
|
|
848
851
|
Actions.prototype.waitTillElementIsPresent = function (control_1) {
|
|
849
852
|
return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
|
|
850
|
-
var
|
|
853
|
+
var error_7;
|
|
851
854
|
if (timeoutInSeconds === void 0) { timeoutInSeconds = 60; }
|
|
852
855
|
return __generator(this, function (_a) {
|
|
853
856
|
switch (_a.label) {
|
|
@@ -865,7 +868,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
865
868
|
_a.sent();
|
|
866
869
|
return [3 /*break*/, 5];
|
|
867
870
|
case 4:
|
|
868
|
-
|
|
871
|
+
error_7 = _a.sent();
|
|
869
872
|
return [3 /*break*/, 5];
|
|
870
873
|
case 5: return [2 /*return*/];
|
|
871
874
|
}
|
|
@@ -885,7 +888,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
885
888
|
*/
|
|
886
889
|
Actions.prototype.waitTillElementIsAttached = function (control_1) {
|
|
887
890
|
return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
|
|
888
|
-
var
|
|
891
|
+
var error_8;
|
|
889
892
|
if (timeoutInSeconds === void 0) { timeoutInSeconds = 60; }
|
|
890
893
|
return __generator(this, function (_a) {
|
|
891
894
|
switch (_a.label) {
|
|
@@ -903,7 +906,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
903
906
|
_a.sent();
|
|
904
907
|
return [3 /*break*/, 5];
|
|
905
908
|
case 4:
|
|
906
|
-
|
|
909
|
+
error_8 = _a.sent();
|
|
907
910
|
return [3 /*break*/, 5];
|
|
908
911
|
case 5: return [2 /*return*/];
|
|
909
912
|
}
|
|
@@ -923,7 +926,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
923
926
|
*/
|
|
924
927
|
Actions.prototype.waitTillElementIsNotPresent = function (control_1) {
|
|
925
928
|
return __awaiter(this, arguments, void 0, function (control, timeoutInSeconds) {
|
|
926
|
-
var
|
|
929
|
+
var error_9;
|
|
927
930
|
if (timeoutInSeconds === void 0) { timeoutInSeconds = 60; }
|
|
928
931
|
return __generator(this, function (_a) {
|
|
929
932
|
switch (_a.label) {
|
|
@@ -937,7 +940,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
937
940
|
_a.sent();
|
|
938
941
|
return [3 /*break*/, 3];
|
|
939
942
|
case 2:
|
|
940
|
-
|
|
943
|
+
error_9 = _a.sent();
|
|
941
944
|
return [3 /*break*/, 3];
|
|
942
945
|
case 3: return [2 /*return*/];
|
|
943
946
|
}
|
|
@@ -980,10 +983,11 @@ var Actions = /** @class */ (function (_super) {
|
|
|
980
983
|
});
|
|
981
984
|
};
|
|
982
985
|
Actions.prototype.waitForPageLoad = function () {
|
|
983
|
-
return __awaiter(this,
|
|
986
|
+
return __awaiter(this, arguments, void 0, function (timeInSeconds) {
|
|
987
|
+
if (timeInSeconds === void 0) { timeInSeconds = 30; }
|
|
984
988
|
return __generator(this, function (_a) {
|
|
985
989
|
switch (_a.label) {
|
|
986
|
-
case 0: return [4 /*yield*/, this.page.waitForLoadState("load")];
|
|
990
|
+
case 0: return [4 /*yield*/, this.page.waitForLoadState("load", { timeout: timeInSeconds * 1000 })];
|
|
987
991
|
case 1:
|
|
988
992
|
_a.sent();
|
|
989
993
|
return [2 /*return*/];
|
|
@@ -992,10 +996,11 @@ var Actions = /** @class */ (function (_super) {
|
|
|
992
996
|
});
|
|
993
997
|
};
|
|
994
998
|
Actions.prototype.waitForPageDOMcontentLoaded = function () {
|
|
995
|
-
return __awaiter(this,
|
|
999
|
+
return __awaiter(this, arguments, void 0, function (timeInSeconds) {
|
|
1000
|
+
if (timeInSeconds === void 0) { timeInSeconds = 30; }
|
|
996
1001
|
return __generator(this, function (_a) {
|
|
997
1002
|
switch (_a.label) {
|
|
998
|
-
case 0: return [4 /*yield*/, this.page.waitForLoadState("domcontentloaded")];
|
|
1003
|
+
case 0: return [4 /*yield*/, this.page.waitForLoadState("domcontentloaded", { timeout: timeInSeconds * 1000 })];
|
|
999
1004
|
case 1:
|
|
1000
1005
|
_a.sent();
|
|
1001
1006
|
return [2 /*return*/];
|
|
@@ -1004,10 +1009,11 @@ var Actions = /** @class */ (function (_super) {
|
|
|
1004
1009
|
});
|
|
1005
1010
|
};
|
|
1006
1011
|
Actions.prototype.waitForNetworkIdle = function () {
|
|
1007
|
-
return __awaiter(this,
|
|
1012
|
+
return __awaiter(this, arguments, void 0, function (timeInSeconds) {
|
|
1013
|
+
if (timeInSeconds === void 0) { timeInSeconds = 30; }
|
|
1008
1014
|
return __generator(this, function (_a) {
|
|
1009
1015
|
switch (_a.label) {
|
|
1010
|
-
case 0: return [4 /*yield*/, this.page.waitForLoadState("networkidle")];
|
|
1016
|
+
case 0: return [4 /*yield*/, this.page.waitForLoadState("networkidle", { timeout: timeInSeconds * 1000 })];
|
|
1011
1017
|
case 1:
|
|
1012
1018
|
_a.sent();
|
|
1013
1019
|
return [2 /*return*/];
|
|
@@ -1016,10 +1022,11 @@ var Actions = /** @class */ (function (_super) {
|
|
|
1016
1022
|
});
|
|
1017
1023
|
};
|
|
1018
1024
|
Actions.prototype.refreshWebPage = function () {
|
|
1019
|
-
return __awaiter(this,
|
|
1025
|
+
return __awaiter(this, arguments, void 0, function (timeInSeconds) {
|
|
1026
|
+
if (timeInSeconds === void 0) { timeInSeconds = 30; }
|
|
1020
1027
|
return __generator(this, function (_a) {
|
|
1021
1028
|
switch (_a.label) {
|
|
1022
|
-
case 0: return [4 /*yield*/, this.page.reload()];
|
|
1029
|
+
case 0: return [4 /*yield*/, this.page.reload({ waitUntil: "load", timeout: timeInSeconds * 1000 })];
|
|
1023
1030
|
case 1:
|
|
1024
1031
|
_a.sent();
|
|
1025
1032
|
return [2 /*return*/];
|
|
@@ -1037,7 +1044,9 @@ var Actions = /** @class */ (function (_super) {
|
|
|
1037
1044
|
return __generator(this, function (_a) {
|
|
1038
1045
|
switch (_a.label) {
|
|
1039
1046
|
case 0: return [4 /*yield*/, this.page.close()];
|
|
1040
|
-
case 1:
|
|
1047
|
+
case 1:
|
|
1048
|
+
_a.sent();
|
|
1049
|
+
return [2 /*return*/];
|
|
1041
1050
|
}
|
|
1042
1051
|
});
|
|
1043
1052
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright-ts-automationframework",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.59",
|
|
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.
|
|
23
|
-
"@types/node": "^
|
|
22
|
+
"@playwright/test": "^1.53.0",
|
|
23
|
+
"@types/node": "^24.0.0",
|
|
24
24
|
"log4js": "^6.9.1",
|
|
25
25
|
"nodemailer": "^7.0.3",
|
|
26
|
-
"npm": "^11.4.
|
|
26
|
+
"npm": "^11.4.1",
|
|
27
27
|
"path": "^0.12.7",
|
|
28
28
|
"typescript": "^5.8.3"
|
|
29
29
|
},
|