playwright-ts-automationframework 1.1.20 → 1.1.21
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 +1 -0
- package/lib/core/actions.core.js +39 -27
- package/lib/core/assertion.core.d.ts +17 -17
- package/lib/core/assertion.core.js +121 -94
- package/lib/core/configuration.core.d.ts +7 -1
- package/lib/core/configuration.core.js +16 -4
- package/lib/core/logs.core.d.ts +2 -2
- package/lib/core/logs.core.js +4 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -3
- package/package.json +1 -1
|
@@ -332,6 +332,7 @@ export declare class Actions extends BasePage {
|
|
|
332
332
|
*/
|
|
333
333
|
sleep(timeInSeconds?: number): Promise<void>;
|
|
334
334
|
waitForPageTimeout(timeoutInSeconds?: number): Promise<void>;
|
|
335
|
+
waitForNetworkIdle(): Promise<void>;
|
|
335
336
|
/**
|
|
336
337
|
* Close the browser instance
|
|
337
338
|
*
|
package/lib/core/actions.core.js
CHANGED
|
@@ -82,8 +82,8 @@ var Actions = /** @class */ (function (_super) {
|
|
|
82
82
|
case 0: return [4 /*yield*/, control.controlLocator.first().click({ force: isforceful }).then(function () {
|
|
83
83
|
(0, logs_core_1.logAction)("Clicked on '" + control.controlDescription + "'");
|
|
84
84
|
}, function (error) {
|
|
85
|
-
(0, logs_core_1.
|
|
86
|
-
(0, logs_core_1.
|
|
85
|
+
(0, logs_core_1.logError)("Unable to click on '" + control.controlDescription + "'");
|
|
86
|
+
(0, logs_core_1.logConsole)("Error: '" + error + "'");
|
|
87
87
|
throw error;
|
|
88
88
|
})];
|
|
89
89
|
case 1:
|
|
@@ -111,8 +111,8 @@ var Actions = /** @class */ (function (_super) {
|
|
|
111
111
|
case 0: return [4 /*yield*/, control.controlLocator.first().hover().then(function () {
|
|
112
112
|
(0, logs_core_1.logAction)("Mouse hover to '" + control.controlDescription + "'");
|
|
113
113
|
}, function (error) {
|
|
114
|
-
(0, logs_core_1.
|
|
115
|
-
(0, logs_core_1.
|
|
114
|
+
(0, logs_core_1.logError)("Unable to mouse hover on :'" + control.controlDescription + "'");
|
|
115
|
+
(0, logs_core_1.logConsole)("Error: '" + error + "'");
|
|
116
116
|
})];
|
|
117
117
|
case 1:
|
|
118
118
|
_a.sent();
|
|
@@ -171,7 +171,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
171
171
|
(0, logs_core_1.logAction)("Entered '" + textTobeEntered + "' in '" + control.controlDescription + "' textbox");
|
|
172
172
|
}
|
|
173
173
|
}, function (error) {
|
|
174
|
-
(0, logs_core_1.
|
|
174
|
+
(0, logs_core_1.logError)("Unable to enter text in '" + control.controlDescription + "' textbox due to reason: " + error);
|
|
175
175
|
throw error;
|
|
176
176
|
})];
|
|
177
177
|
case 1:
|
|
@@ -226,8 +226,8 @@ var Actions = /** @class */ (function (_super) {
|
|
|
226
226
|
case 0: return [4 /*yield*/, control.controlLocator.first().selectOption({ value: optionTobeSelcted }).then(function () {
|
|
227
227
|
(0, logs_core_1.logAction)("Selected '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
|
|
228
228
|
}, function (error) {
|
|
229
|
-
(0, logs_core_1.
|
|
230
|
-
(0, logs_core_1.
|
|
229
|
+
(0, logs_core_1.logError)("Unable to select '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
|
|
230
|
+
(0, logs_core_1.logConsole)("Error: '" + error + "'");
|
|
231
231
|
throw error;
|
|
232
232
|
})];
|
|
233
233
|
case 1:
|
|
@@ -256,8 +256,8 @@ var Actions = /** @class */ (function (_super) {
|
|
|
256
256
|
case 0: return [4 /*yield*/, control.controlLocator.first().selectOption({ label: optionTobeSelcted }).then(function () {
|
|
257
257
|
(0, logs_core_1.logAction)("Selected '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
|
|
258
258
|
}, function (error) {
|
|
259
|
-
(0, logs_core_1.
|
|
260
|
-
(0, logs_core_1.
|
|
259
|
+
(0, logs_core_1.logError)("Unable to select '" + optionTobeSelcted + "' from '" + control.controlDescription + "");
|
|
260
|
+
(0, logs_core_1.logConsole)("Error: '" + error + "'");
|
|
261
261
|
throw error;
|
|
262
262
|
})];
|
|
263
263
|
case 1:
|
|
@@ -286,8 +286,8 @@ var Actions = /** @class */ (function (_super) {
|
|
|
286
286
|
case 0: return [4 /*yield*/, control.controlLocator.first().selectOption({ index: index }).then(function () {
|
|
287
287
|
(0, logs_core_1.logAction)("Selected '" + index + "' option from '" + control.controlDescription + "'");
|
|
288
288
|
}, function (error) {
|
|
289
|
-
(0, logs_core_1.
|
|
290
|
-
(0, logs_core_1.
|
|
289
|
+
(0, logs_core_1.logError)("Unable to select '" + index + "' option from '" + control.controlDescription + "'");
|
|
290
|
+
(0, logs_core_1.logError)("Error: '" + error + "'");
|
|
291
291
|
throw error;
|
|
292
292
|
})];
|
|
293
293
|
case 1:
|
|
@@ -321,14 +321,14 @@ var Actions = /** @class */ (function (_super) {
|
|
|
321
321
|
control.controlLocator.first().check().then(function () {
|
|
322
322
|
(0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as checked");
|
|
323
323
|
}, function (error) {
|
|
324
|
-
(0, logs_core_1.
|
|
324
|
+
(0, logs_core_1.logError)("Unable Set checkbox value of '" + control.controlDescription + "' as checked");
|
|
325
325
|
throw error;
|
|
326
326
|
});
|
|
327
327
|
return [3 /*break*/, 4];
|
|
328
328
|
case 2: return [4 /*yield*/, control.controlLocator.first().uncheck().then(function () {
|
|
329
329
|
(0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as unchecked");
|
|
330
330
|
}, function (error) {
|
|
331
|
-
(0, logs_core_1.
|
|
331
|
+
(0, logs_core_1.logError)("Unable Set checkbox value of '" + control.controlDescription + "' as unchecked");
|
|
332
332
|
throw error;
|
|
333
333
|
})];
|
|
334
334
|
case 3:
|
|
@@ -359,7 +359,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
359
359
|
case 0: return [4 /*yield*/, control.controlLocator.first().isChecked()];
|
|
360
360
|
case 1:
|
|
361
361
|
isChecked = _a.sent();
|
|
362
|
-
(0, logs_core_1.
|
|
362
|
+
(0, logs_core_1.logConsole)("'".concat(control.controlDescription, "' checkbox is ").concat(isChecked ? 'selected' : 'not selected'));
|
|
363
363
|
return [2 /*return*/, isChecked];
|
|
364
364
|
}
|
|
365
365
|
});
|
|
@@ -382,7 +382,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
382
382
|
return __generator(this, function (_a) {
|
|
383
383
|
switch (_a.label) {
|
|
384
384
|
case 0: return [4 /*yield*/, control.controlLocator.first().isEnabled().then(function (value) {
|
|
385
|
-
(0, logs_core_1.
|
|
385
|
+
(0, logs_core_1.logConsole)("'".concat(control.controlDescription, "' is ").concat(value ? 'enabled' : 'not enabled'));
|
|
386
386
|
return value;
|
|
387
387
|
})];
|
|
388
388
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -410,7 +410,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
410
410
|
case 0: return [4 /*yield*/, control.controlLocator.first().isVisible()];
|
|
411
411
|
case 1:
|
|
412
412
|
isVisible = _a.sent();
|
|
413
|
-
(0, logs_core_1.
|
|
413
|
+
(0, logs_core_1.logConsole)("'".concat(control.controlDescription, "' is ").concat(isVisible ? 'displayed' : 'not displayed'));
|
|
414
414
|
return [2 /*return*/, isVisible];
|
|
415
415
|
}
|
|
416
416
|
});
|
|
@@ -432,10 +432,10 @@ var Actions = /** @class */ (function (_super) {
|
|
|
432
432
|
return __generator(this, function (_a) {
|
|
433
433
|
switch (_a.label) {
|
|
434
434
|
case 0: return [4 /*yield*/, control.controlLocator.first().innerText().then(function (value) {
|
|
435
|
-
(0, logs_core_1.
|
|
435
|
+
(0, logs_core_1.logConsole)("Value is read from '" + control.controlDescription + "' is: '" + value + "'");
|
|
436
436
|
return value;
|
|
437
437
|
}, function (error) {
|
|
438
|
-
(0, logs_core_1.
|
|
438
|
+
(0, logs_core_1.logError)("Unable to read the text from '" + control.controlDescription + "' due to reason: " + error);
|
|
439
439
|
})];
|
|
440
440
|
case 1: return [2 /*return*/, _a.sent()];
|
|
441
441
|
}
|
|
@@ -458,10 +458,10 @@ var Actions = /** @class */ (function (_super) {
|
|
|
458
458
|
return __generator(this, function (_a) {
|
|
459
459
|
switch (_a.label) {
|
|
460
460
|
case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
|
|
461
|
-
(0, logs_core_1.
|
|
461
|
+
(0, logs_core_1.logConsole)("Value is read from textbox '" + control.controlDescription + "' is: '" + value + "'");
|
|
462
462
|
return value;
|
|
463
463
|
}, function (error) {
|
|
464
|
-
(0, logs_core_1.
|
|
464
|
+
(0, logs_core_1.logError)("Unable to read the value from '" + control.controlDescription + "' due to reason: " + error);
|
|
465
465
|
})];
|
|
466
466
|
case 1: return [2 /*return*/, _a.sent()];
|
|
467
467
|
}
|
|
@@ -484,10 +484,10 @@ var Actions = /** @class */ (function (_super) {
|
|
|
484
484
|
return __generator(this, function (_a) {
|
|
485
485
|
switch (_a.label) {
|
|
486
486
|
case 0: return [4 /*yield*/, control.controlLocator.first().inputValue().then(function (value) {
|
|
487
|
-
(0, logs_core_1.
|
|
487
|
+
(0, logs_core_1.logConsole)("Value is read from '" + control.controlDescription + "' is: '" + value + "'");
|
|
488
488
|
return value;
|
|
489
489
|
}, function (error) {
|
|
490
|
-
(0, logs_core_1.
|
|
490
|
+
(0, logs_core_1.logError)("Unable to read the value '" + control.controlDescription + "' due to reason: " + error);
|
|
491
491
|
})];
|
|
492
492
|
case 1: return [2 /*return*/, _a.sent()];
|
|
493
493
|
}
|
|
@@ -511,10 +511,10 @@ var Actions = /** @class */ (function (_super) {
|
|
|
511
511
|
return __generator(this, function (_a) {
|
|
512
512
|
switch (_a.label) {
|
|
513
513
|
case 0: return [4 /*yield*/, control.controlLocator.first().getAttribute(attributeName).then(function (value) {
|
|
514
|
-
(0, logs_core_1.
|
|
514
|
+
(0, logs_core_1.logConsole)("Attribute value for '" + control.controlDescription + "' is Attribute name: '" + attributeName + "' Value: '" + value + "'");
|
|
515
515
|
return value;
|
|
516
516
|
}, function (reason) {
|
|
517
|
-
(0, logs_core_1.
|
|
517
|
+
(0, logs_core_1.logError)("Unable to read attribute value from '" + control.controlDescription + "' reason: '" + reason + "'");
|
|
518
518
|
})];
|
|
519
519
|
case 1: return [2 /*return*/, _a.sent()];
|
|
520
520
|
}
|
|
@@ -585,7 +585,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
585
585
|
(0, logs_core_1.logAction)('Alert is accepted');
|
|
586
586
|
return true;
|
|
587
587
|
}, function (error) {
|
|
588
|
-
(0, logs_core_1.
|
|
588
|
+
(0, logs_core_1.logError)("Unable to accept alert: " + error);
|
|
589
589
|
throw error;
|
|
590
590
|
})];
|
|
591
591
|
case 1:
|
|
@@ -595,7 +595,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
595
595
|
(0, logs_core_1.logAction)('Alert is dismissed');
|
|
596
596
|
return false;
|
|
597
597
|
}, function (error) {
|
|
598
|
-
(0, logs_core_1.
|
|
598
|
+
(0, logs_core_1.logError)("Unable to dismiss alert: " + error);
|
|
599
599
|
throw error;
|
|
600
600
|
})];
|
|
601
601
|
case 3:
|
|
@@ -622,7 +622,7 @@ var Actions = /** @class */ (function (_super) {
|
|
|
622
622
|
return __generator(this, function (_a) {
|
|
623
623
|
this.page.on('dialog', function (dialog) { return __awaiter(_this, void 0, void 0, function () {
|
|
624
624
|
return __generator(this, function (_a) {
|
|
625
|
-
(0, logs_core_1.
|
|
625
|
+
(0, logs_core_1.logConsole)('Alert is Displayed with text: ' + dialog.message());
|
|
626
626
|
return [2 /*return*/];
|
|
627
627
|
});
|
|
628
628
|
}); });
|
|
@@ -865,6 +865,18 @@ var Actions = /** @class */ (function (_super) {
|
|
|
865
865
|
});
|
|
866
866
|
});
|
|
867
867
|
};
|
|
868
|
+
Actions.prototype.waitForNetworkIdle = function () {
|
|
869
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
870
|
+
return __generator(this, function (_a) {
|
|
871
|
+
switch (_a.label) {
|
|
872
|
+
case 0: return [4 /*yield*/, this.page.waitForLoadState("networkidle")];
|
|
873
|
+
case 1:
|
|
874
|
+
_a.sent();
|
|
875
|
+
return [2 /*return*/];
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
});
|
|
879
|
+
};
|
|
868
880
|
/**
|
|
869
881
|
* Close the browser instance
|
|
870
882
|
*
|
|
@@ -20,7 +20,7 @@ export declare class Assertion extends Actions {
|
|
|
20
20
|
verifyIsEquals(object1: any, object2: any): void;
|
|
21
21
|
/**
|
|
22
22
|
* Verify first value contains substring as second.
|
|
23
|
-
* If expected value is present in actual value then test case gets passsed else failed
|
|
23
|
+
* If expected value is present in actual value then test case gets passsed else failed..
|
|
24
24
|
*
|
|
25
25
|
* @param expected First object which has .
|
|
26
26
|
* @param actual Second object.
|
|
@@ -31,7 +31,7 @@ export declare class Assertion extends Actions {
|
|
|
31
31
|
verifyIsContains(actual: string, expected: string): void;
|
|
32
32
|
/**
|
|
33
33
|
* Verify element's displayed/not displayed status as per expected value
|
|
34
|
-
* If expected element's displayed status is as per expected then test case gets
|
|
34
|
+
* If expected element's displayed status is as per expected then test case gets passed else failed..
|
|
35
35
|
*
|
|
36
36
|
* @param control Control of which enable or disable status.
|
|
37
37
|
* @param expValue Expected value enabled as true or disabled as false.
|
|
@@ -44,7 +44,7 @@ export declare class Assertion extends Actions {
|
|
|
44
44
|
verifyIsDisplayed(control: WebControl, expectedIsDisplayed?: boolean): Promise<void>;
|
|
45
45
|
/**
|
|
46
46
|
* Verify element is not displayed
|
|
47
|
-
* If expected element's displayed status is false the test case gets passed else failed
|
|
47
|
+
* If expected element's displayed status is false the test case gets passed else failed..
|
|
48
48
|
*
|
|
49
49
|
* @param control Control for which not displayed status need to verify.
|
|
50
50
|
* @param isAlreadyHidden Is control already hidden or need to wait to get hidden.
|
|
@@ -57,7 +57,7 @@ export declare class Assertion extends Actions {
|
|
|
57
57
|
verifyIsNotDisplayed(control: WebControl, isAlreadyHidden?: boolean): Promise<void>;
|
|
58
58
|
/**
|
|
59
59
|
* Verify attribute value of the control
|
|
60
|
-
* If elements attribute value is as per expected value then test case gets passed else failed
|
|
60
|
+
* If elements attribute value is as per expected value then test case gets passed else failed..
|
|
61
61
|
*
|
|
62
62
|
* @param control Control for which attribute value need to verify.
|
|
63
63
|
* @param attributeName Attribute name.
|
|
@@ -72,7 +72,7 @@ export declare class Assertion extends Actions {
|
|
|
72
72
|
verifyAttributeValue(control: WebControl, attributeName: string, expectedAttributeValue: string): Promise<void>;
|
|
73
73
|
/**
|
|
74
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
|
|
75
|
+
* If element's attribute value contains expected value then test case gets passsed else failed..
|
|
76
76
|
*
|
|
77
77
|
* @param control Control of which attribute value need to verify.
|
|
78
78
|
* @param attributeName Attribute name
|
|
@@ -84,10 +84,10 @@ export declare class Assertion extends Actions {
|
|
|
84
84
|
*
|
|
85
85
|
* verifyAttributeValueContains(loginBtn, "value", "Submit");
|
|
86
86
|
*/
|
|
87
|
-
verifyAttributeValueContains(
|
|
87
|
+
verifyAttributeValueContains(control: WebControl, attributeName: string, attributeValue: string): Promise<void>;
|
|
88
88
|
/**
|
|
89
89
|
* Verify element's enabled/disabled status as per expected value
|
|
90
|
-
* If expected element's enabled status is as per expected then test case gets passsed else failed
|
|
90
|
+
* If expected element's enabled status is as per expected then test case gets passsed else failed..
|
|
91
91
|
*
|
|
92
92
|
* @param control Control of which enable or disable status.
|
|
93
93
|
* @param expValue Expected value enabled as true or disabled as false.
|
|
@@ -110,7 +110,7 @@ export declare class Assertion extends Actions {
|
|
|
110
110
|
verifyIsSelected(control: WebControl, expValue?: boolean): Promise<void>;
|
|
111
111
|
/**
|
|
112
112
|
* Verify element's text as per expected value
|
|
113
|
-
* If expected element's text is as per expected value then test case gets passsed else failed
|
|
113
|
+
* If expected element's text is as per expected value then test case gets passsed else failed..
|
|
114
114
|
*
|
|
115
115
|
* @param control Control of which text need to verify.
|
|
116
116
|
* @param expectedText Expected value.
|
|
@@ -123,7 +123,7 @@ export declare class Assertion extends Actions {
|
|
|
123
123
|
verifyDisplayedText(control: WebControl, expectedText: string): Promise<void>;
|
|
124
124
|
/**
|
|
125
125
|
* Verify element's text contains partial expected value
|
|
126
|
-
* If expected element's text contains expected value then test case gets passsed else failed
|
|
126
|
+
* If expected element's text contains expected value then test case gets passsed else failed..
|
|
127
127
|
*
|
|
128
128
|
* @param control Control of which text need to verify.
|
|
129
129
|
* @param expectedText Expected partial value.
|
|
@@ -136,7 +136,7 @@ export declare class Assertion extends Actions {
|
|
|
136
136
|
verifyDisplayedTextContains(control: WebControl, expectedText: string): Promise<void>;
|
|
137
137
|
/**
|
|
138
138
|
* Verify element's text does not contains expected value
|
|
139
|
-
* If expected element's text does not contains expected value then test case gets passsed else failed
|
|
139
|
+
* If expected element's text does not contains expected value then test case gets passsed else failed..
|
|
140
140
|
*
|
|
141
141
|
* @param control Control of which text need to verify.
|
|
142
142
|
* @param expectedText Expected partial value.
|
|
@@ -149,7 +149,7 @@ export declare class Assertion extends Actions {
|
|
|
149
149
|
verifyDisplayedTextDoesNotContains(control: WebControl, expectedText: string): Promise<void>;
|
|
150
150
|
/**
|
|
151
151
|
* Verify element's textbox is equal to expected value
|
|
152
|
-
* If expected element's textbox value to be expected value then test case gets passsed else failed
|
|
152
|
+
* If expected element's textbox value to be expected value then test case gets passsed else failed..
|
|
153
153
|
*
|
|
154
154
|
* @param control Textbox control.
|
|
155
155
|
* @param expectedText Expected value.
|
|
@@ -162,7 +162,7 @@ export declare class Assertion extends Actions {
|
|
|
162
162
|
verifyTextboxValue(control: WebControl, expectedText: string): Promise<void>;
|
|
163
163
|
/**
|
|
164
164
|
* Verify element's checkbox/radio value is equal to expected value
|
|
165
|
-
* If expected element's checkbox/radio value to be expected value then test case gets passsed else failed
|
|
165
|
+
* If expected element's checkbox/radio value to be expected value then test case gets passsed else failed..
|
|
166
166
|
*
|
|
167
167
|
* @param control Checkbox/radio control.
|
|
168
168
|
* @param expectedText Expected checkbox/radio value.
|
|
@@ -175,7 +175,7 @@ export declare class Assertion extends Actions {
|
|
|
175
175
|
verifyCheckboxValue(control: WebControl, value: boolean): Promise<void>;
|
|
176
176
|
/**
|
|
177
177
|
* Verify element's tagname is equal to expected value
|
|
178
|
-
* If expected element's Tagname is equal to expected value then test case gets passsed else failed
|
|
178
|
+
* If expected element's Tagname is equal to expected value then test case gets passsed else failed..
|
|
179
179
|
*
|
|
180
180
|
* @param control Checkbox/radio control.
|
|
181
181
|
* @param expectedText Expected checkbox/radio value.
|
|
@@ -191,7 +191,7 @@ export declare class Assertion extends Actions {
|
|
|
191
191
|
verifyListForMultipleValues(control: WebControl, listOfValueToVerify: string[], waitTillElementIsDisplayed?: boolean): Promise<void>;
|
|
192
192
|
/**
|
|
193
193
|
* Verify Alert text is equal to expected value
|
|
194
|
-
* If alert text is equal to expected value then test case gets passsed else failed
|
|
194
|
+
* If alert text is equal to expected value then test case gets passsed else failed..
|
|
195
195
|
*
|
|
196
196
|
* @param expectedText Expected alert text.
|
|
197
197
|
* Example:
|
|
@@ -201,7 +201,7 @@ export declare class Assertion extends Actions {
|
|
|
201
201
|
verifyAlertText(expectedText: string): Promise<void>;
|
|
202
202
|
/**
|
|
203
203
|
* Verify URL contains expected value
|
|
204
|
-
* If URL contains expected value then test case gets passsed else failed
|
|
204
|
+
* If URL contains expected value then test case gets passsed else failed..
|
|
205
205
|
*
|
|
206
206
|
* @param expectedText Expected partial URL.
|
|
207
207
|
* Example:
|
|
@@ -211,7 +211,7 @@ export declare class Assertion extends Actions {
|
|
|
211
211
|
verifyURLContains(subString: string): Promise<void>;
|
|
212
212
|
/**
|
|
213
213
|
* Verify count of elements which matched the control
|
|
214
|
-
* If count of elements is equal to expected value then test case will get passsed else failed
|
|
214
|
+
* If count of elements is equal to expected value then test case will get passsed else failed..
|
|
215
215
|
*
|
|
216
216
|
* @param control Control element.
|
|
217
217
|
* @param expectedCount Expected count of elements matching criteria
|
|
@@ -223,7 +223,7 @@ export declare class Assertion extends Actions {
|
|
|
223
223
|
verifyCountOfElements(control: WebControl, expectedCount: number): Promise<void>;
|
|
224
224
|
/**
|
|
225
225
|
* Verify title of web page contains expected value
|
|
226
|
-
* If title contains expected value then test case will get passsed else failed
|
|
226
|
+
* If title contains expected value then test case will get passsed else failed..
|
|
227
227
|
*
|
|
228
228
|
* @param expectedText Expected partial Title.
|
|
229
229
|
* Example:
|
|
@@ -76,18 +76,18 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
76
76
|
*/
|
|
77
77
|
Assertion.prototype.verifyIsEquals = function (object1, object2) {
|
|
78
78
|
try {
|
|
79
|
-
var verificationResult = object1 === object2 ? "PASSED" : "
|
|
79
|
+
var verificationResult = object1 === object2 ? "PASSED" : "FAILED";
|
|
80
80
|
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(object1, "' Actual: '").concat(object2, "'"));
|
|
81
81
|
(0, test_1.expect)(object1).toBe(object2);
|
|
82
82
|
}
|
|
83
83
|
catch (error1) {
|
|
84
|
-
(0, logs_core_1.
|
|
84
|
+
(0, logs_core_1.logError)("VERIFICATION: FAILED. Expected: '" + object1 + "' Actual: '" + object2 + "'");
|
|
85
85
|
throw error1;
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
/**
|
|
89
89
|
* Verify first value contains substring as second.
|
|
90
|
-
* If expected value is present in actual value then test case gets passsed else failed
|
|
90
|
+
* If expected value is present in actual value then test case gets passsed else failed..
|
|
91
91
|
*
|
|
92
92
|
* @param expected First object which has .
|
|
93
93
|
* @param actual Second object.
|
|
@@ -97,18 +97,19 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
97
97
|
*/
|
|
98
98
|
Assertion.prototype.verifyIsContains = function (actual, expected) {
|
|
99
99
|
try {
|
|
100
|
-
var verificationResult = actual.trim().includes(expected.trim()) ? "PASSED" : "
|
|
101
|
-
|
|
102
|
-
(0,
|
|
100
|
+
var verificationResult = actual.trim().includes(expected.trim()) ? "PASSED" : "FAILED";
|
|
101
|
+
var logText = "VERIFICATION: ".concat(verificationResult, ". Actual: '").concat(actual, "' contains Expected: '").concat(expected.trim(), "'");
|
|
102
|
+
(0, logs_core_1.logVerification)(logText);
|
|
103
|
+
(0, test_1.expect)(actual.trim(), logText).toContain(expected.trim());
|
|
103
104
|
}
|
|
104
105
|
catch (error1) {
|
|
105
|
-
(0, logs_core_1.
|
|
106
|
+
(0, logs_core_1.logError)("VERIFICATION: FAILED. Actual: '" + expected + "' contains Expected: '" + actual + "'");
|
|
106
107
|
throw error1;
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
110
|
/**
|
|
110
111
|
* Verify element's displayed/not displayed status as per expected value
|
|
111
|
-
* If expected element's displayed status is as per expected then test case gets
|
|
112
|
+
* If expected element's displayed status is as per expected then test case gets passed else failed..
|
|
112
113
|
*
|
|
113
114
|
* @param control Control of which enable or disable status.
|
|
114
115
|
* @param expValue Expected value enabled as true or disabled as false.
|
|
@@ -129,11 +130,12 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
129
130
|
case 1:
|
|
130
131
|
_a.sent();
|
|
131
132
|
return [4 /*yield*/, this.isDisplayed(control).then(function (value) {
|
|
132
|
-
var verificationResult = value === expectedIsDisplayed ? "PASSED" : "
|
|
133
|
-
|
|
134
|
-
(0,
|
|
133
|
+
var verificationResult = value === expectedIsDisplayed ? "PASSED" : "FAILED";
|
|
134
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' displayed status is '").concat(value, "' Expected: ").concat(expectedIsDisplayed);
|
|
135
|
+
(0, logs_core_1.logVerification)(logText);
|
|
136
|
+
(0, test_1.expect)(value, logText).toBe(expectedIsDisplayed);
|
|
135
137
|
}, function (reason) {
|
|
136
|
-
(0, logs_core_1.
|
|
138
|
+
(0, logs_core_1.logError)("VERIFICATION: FAILED. '" + control.controlDescription + "' displayed status is: '" + false + "' due to reason: " + reason);
|
|
137
139
|
})];
|
|
138
140
|
case 2:
|
|
139
141
|
_a.sent();
|
|
@@ -148,7 +150,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
148
150
|
};
|
|
149
151
|
/**
|
|
150
152
|
* Verify element is not displayed
|
|
151
|
-
* If expected element's displayed status is false the test case gets passed else failed
|
|
153
|
+
* If expected element's displayed status is false the test case gets passed else failed..
|
|
152
154
|
*
|
|
153
155
|
* @param control Control for which not displayed status need to verify.
|
|
154
156
|
* @param isAlreadyHidden Is control already hidden or need to wait to get hidden.
|
|
@@ -161,7 +163,6 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
161
163
|
Assertion.prototype.verifyIsNotDisplayed = function (control_1) {
|
|
162
164
|
return __awaiter(this, arguments, void 0, function (control, isAlreadyHidden) {
|
|
163
165
|
var element;
|
|
164
|
-
var _this = this;
|
|
165
166
|
if (isAlreadyHidden === void 0) { isAlreadyHidden = false; }
|
|
166
167
|
return __generator(this, function (_a) {
|
|
167
168
|
switch (_a.label) {
|
|
@@ -173,9 +174,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
173
174
|
_a.sent();
|
|
174
175
|
_a.label = 2;
|
|
175
176
|
case 2: return [4 /*yield*/, control.controlLocator.isHidden().then(function (value) {
|
|
176
|
-
var verificationResult = value === true ? "PASSED" : "
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
var verificationResult = value === true ? "PASSED" : "FAILED";
|
|
178
|
+
var logText = "VERIFICATION: ".concat(verificationResult, ". '").concat(control.controlDescription, "' hidden status is '").concat(value, "' Expected: false");
|
|
179
|
+
(0, logs_core_1.logVerification)(logText);
|
|
180
|
+
(0, test_1.expect)(control.controlLocator.isHidden(), logText).toBe(true);
|
|
179
181
|
})];
|
|
180
182
|
case 3:
|
|
181
183
|
_a.sent();
|
|
@@ -186,7 +188,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
186
188
|
};
|
|
187
189
|
/**
|
|
188
190
|
* Verify attribute value of the control
|
|
189
|
-
* If elements attribute value is as per expected value then test case gets passed else failed
|
|
191
|
+
* If elements attribute value is as per expected value then test case gets passed else failed..
|
|
190
192
|
*
|
|
191
193
|
* @param control Control for which attribute value need to verify.
|
|
192
194
|
* @param attributeName Attribute name.
|
|
@@ -203,9 +205,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
203
205
|
return __generator(this, function (_a) {
|
|
204
206
|
switch (_a.label) {
|
|
205
207
|
case 0: return [4 /*yield*/, this.getAttributeValue(control, attributeName).then(function (value) {
|
|
206
|
-
var verificationResult = value === expectedAttributeValue ? "PASSED" : "
|
|
207
|
-
|
|
208
|
-
(0,
|
|
208
|
+
var verificationResult = value === expectedAttributeValue ? "PASSED" : "FAILED";
|
|
209
|
+
var logText = "VERIFICATION: ".concat(verificationResult, ". Attribute value of ").concat(control.controlDescription, " Expected: '").concat(expectedAttributeValue, "' Actual : '").concat(value, "'");
|
|
210
|
+
(0, logs_core_1.logVerification)(logText);
|
|
211
|
+
(0, test_1.expect)(control.controlLocator, logText).toHaveAttribute(expectedAttributeValue);
|
|
209
212
|
})];
|
|
210
213
|
case 1:
|
|
211
214
|
_a.sent();
|
|
@@ -216,7 +219,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
216
219
|
};
|
|
217
220
|
/**
|
|
218
221
|
* Verify element's attribute value contains expected value
|
|
219
|
-
* If element's attribute value contains expected value then test case gets passsed else failed
|
|
222
|
+
* If element's attribute value contains expected value then test case gets passsed else failed..
|
|
220
223
|
*
|
|
221
224
|
* @param control Control of which attribute value need to verify.
|
|
222
225
|
* @param attributeName Attribute name
|
|
@@ -228,26 +231,38 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
228
231
|
*
|
|
229
232
|
* verifyAttributeValueContains(loginBtn, "value", "Submit");
|
|
230
233
|
*/
|
|
231
|
-
Assertion.prototype.verifyAttributeValueContains = function (
|
|
234
|
+
Assertion.prototype.verifyAttributeValueContains = function (control, attributeName, attributeValue) {
|
|
232
235
|
return __awaiter(this, void 0, void 0, function () {
|
|
233
|
-
var
|
|
234
|
-
return __generator(this, function (
|
|
235
|
-
switch (
|
|
236
|
-
case 0: return [4 /*yield*/, this.getAttributeValue(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
236
|
+
var _this = this;
|
|
237
|
+
return __generator(this, function (_a) {
|
|
238
|
+
switch (_a.label) {
|
|
239
|
+
case 0: return [4 /*yield*/, this.getAttributeValue(control, attributeName).then(function (value) { return __awaiter(_this, void 0, void 0, function () {
|
|
240
|
+
var verificationResult, logText, _a, _b;
|
|
241
|
+
return __generator(this, function (_c) {
|
|
242
|
+
switch (_c.label) {
|
|
243
|
+
case 0:
|
|
244
|
+
if (!(value != null)) return [3 /*break*/, 2];
|
|
245
|
+
verificationResult = value.includes(attributeValue) ? "PASSED" : "FAILED";
|
|
246
|
+
logText = "VERIFICATION: ".concat(verificationResult, ". Atribute value of ").concat(control.controlLocator, " Expected: '").concat(attributeValue, "' contains Actual : '").concat(value, "'");
|
|
247
|
+
(0, logs_core_1.logVerification)(logText);
|
|
248
|
+
_a = test_1.expect;
|
|
249
|
+
return [4 /*yield*/, this.getAttributeValue(control, attributeName)];
|
|
250
|
+
case 1:
|
|
251
|
+
_a.apply(void 0, [_c.sent(), logText]).toContain(attributeValue);
|
|
252
|
+
return [3 /*break*/, 4];
|
|
253
|
+
case 2:
|
|
254
|
+
(0, logs_core_1.logVerification)("VERIFICATION: FAILED. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'"));
|
|
255
|
+
_b = test_1.expect;
|
|
256
|
+
return [4 /*yield*/, this.getAttributeValue(control, attributeName)];
|
|
257
|
+
case 3:
|
|
258
|
+
_b.apply(void 0, [_c.sent(), "VERIFICATION: FAILED. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'")]).toContain(attributeValue);
|
|
259
|
+
_c.label = 4;
|
|
260
|
+
case 4: return [2 /*return*/];
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}); })];
|
|
245
264
|
case 1:
|
|
246
|
-
|
|
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);
|
|
265
|
+
_a.sent();
|
|
251
266
|
return [2 /*return*/];
|
|
252
267
|
}
|
|
253
268
|
});
|
|
@@ -255,7 +270,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
255
270
|
};
|
|
256
271
|
/**
|
|
257
272
|
* Verify element's enabled/disabled status as per expected value
|
|
258
|
-
* If expected element's enabled status is as per expected then test case gets passsed else failed
|
|
273
|
+
* If expected element's enabled status is as per expected then test case gets passsed else failed..
|
|
259
274
|
*
|
|
260
275
|
* @param control Control of which enable or disable status.
|
|
261
276
|
* @param expValue Expected value enabled as true or disabled as false.
|
|
@@ -277,9 +292,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
277
292
|
_a.sent();
|
|
278
293
|
_a.label = 2;
|
|
279
294
|
case 2: return [4 /*yield*/, control.controlLocator.isEnabled().then(function (value) {
|
|
280
|
-
var verificationResult = value === expValue ? "PASSED" : "
|
|
281
|
-
|
|
282
|
-
(0,
|
|
295
|
+
var verificationResult = value === expValue ? "PASSED" : "FAILED";
|
|
296
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' enabled status is: '").concat(value, "' Expected: ").concat(expValue);
|
|
297
|
+
(0, logs_core_1.logVerification)(logText);
|
|
298
|
+
(0, test_1.expect)(value, logText).toBe(expValue);
|
|
283
299
|
})];
|
|
284
300
|
case 3:
|
|
285
301
|
_a.sent();
|
|
@@ -310,8 +326,9 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
310
326
|
_a.label = 2;
|
|
311
327
|
case 2: return [4 /*yield*/, control.controlLocator.isChecked().then(function (isChecked) {
|
|
312
328
|
var verificationResult = isChecked === expValue ? "PASSED" : "FAILED";
|
|
313
|
-
|
|
314
|
-
(0,
|
|
329
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' selected status is: '").concat(isChecked, "' Expected: ").concat(expValue);
|
|
330
|
+
(0, logs_core_1.logVerification)(logText);
|
|
331
|
+
(0, test_1.expect)(isChecked, logText).toBe(expValue);
|
|
315
332
|
})];
|
|
316
333
|
case 3:
|
|
317
334
|
_a.sent();
|
|
@@ -322,7 +339,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
322
339
|
};
|
|
323
340
|
/**
|
|
324
341
|
* Verify element's text as per expected value
|
|
325
|
-
* If expected element's text is as per expected value then test case gets passsed else failed
|
|
342
|
+
* If expected element's text is as per expected value then test case gets passsed else failed..
|
|
326
343
|
*
|
|
327
344
|
* @param control Control of which text need to verify.
|
|
328
345
|
* @param expectedText Expected value.
|
|
@@ -337,9 +354,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
337
354
|
return __generator(this, function (_a) {
|
|
338
355
|
switch (_a.label) {
|
|
339
356
|
case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
|
|
340
|
-
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText.trim() ? "PASSED" : "
|
|
341
|
-
|
|
342
|
-
(0,
|
|
357
|
+
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText.trim() ? "PASSED" : "FAILED";
|
|
358
|
+
var logText = "VERIFICATION: '".concat(verificationResult, "' Verify text of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
359
|
+
(0, logs_core_1.logVerification)(logText);
|
|
360
|
+
(0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toBe(expectedText.trim());
|
|
343
361
|
})];
|
|
344
362
|
case 1:
|
|
345
363
|
_a.sent();
|
|
@@ -350,7 +368,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
350
368
|
};
|
|
351
369
|
/**
|
|
352
370
|
* Verify element's text contains partial expected value
|
|
353
|
-
* If expected element's text contains expected value then test case gets passsed else failed
|
|
371
|
+
* If expected element's text contains expected value then test case gets passsed else failed..
|
|
354
372
|
*
|
|
355
373
|
* @param control Control of which text need to verify.
|
|
356
374
|
* @param expectedText Expected partial value.
|
|
@@ -365,9 +383,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
365
383
|
return __generator(this, function (_a) {
|
|
366
384
|
switch (_a.label) {
|
|
367
385
|
case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
|
|
368
|
-
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim())) ? "PASSED" : "
|
|
369
|
-
|
|
370
|
-
(0,
|
|
386
|
+
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim())) ? "PASSED" : "FAILED";
|
|
387
|
+
var logText = "VERIFICATION: ".concat(verificationResult, ". Verify text of ").concat(control.controlDescription, " .Expected: '").concat(expectedText.trim(), "' is present in Actual: '").concat(value === null || value === void 0 ? void 0 : value.trim(), "'");
|
|
388
|
+
(0, logs_core_1.logVerification)(logText);
|
|
389
|
+
(0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toContain(expectedText.trim());
|
|
371
390
|
})];
|
|
372
391
|
case 1:
|
|
373
392
|
_a.sent();
|
|
@@ -378,7 +397,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
378
397
|
};
|
|
379
398
|
/**
|
|
380
399
|
* Verify element's text does not contains expected value
|
|
381
|
-
* If expected element's text does not contains expected value then test case gets passsed else failed
|
|
400
|
+
* If expected element's text does not contains expected value then test case gets passsed else failed..
|
|
382
401
|
*
|
|
383
402
|
* @param control Control of which text need to verify.
|
|
384
403
|
* @param expectedText Expected partial value.
|
|
@@ -393,9 +412,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
393
412
|
return __generator(this, function (_a) {
|
|
394
413
|
switch (_a.label) {
|
|
395
414
|
case 0: return [4 /*yield*/, this.getText(control).then(function (value) {
|
|
396
|
-
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "PASSED" : "
|
|
397
|
-
|
|
398
|
-
(0,
|
|
415
|
+
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "PASSED" : "FAILED";
|
|
416
|
+
var logText = "VERIFICATION: ".concat(verificationResult, ". Verify text of ").concat(control.controlDescription, " Expected: '").concat(expectedText, "' does not contains Actual: '").concat(value, "'");
|
|
417
|
+
(0, logs_core_1.logVerification)(logText);
|
|
418
|
+
(0, test_1.expect)(false, logText).toBe(value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim()));
|
|
399
419
|
})];
|
|
400
420
|
case 1:
|
|
401
421
|
_a.sent();
|
|
@@ -406,7 +426,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
406
426
|
};
|
|
407
427
|
/**
|
|
408
428
|
* Verify element's textbox is equal to expected value
|
|
409
|
-
* If expected element's textbox value to be expected value then test case gets passsed else failed
|
|
429
|
+
* If expected element's textbox value to be expected value then test case gets passsed else failed..
|
|
410
430
|
*
|
|
411
431
|
* @param control Textbox control.
|
|
412
432
|
* @param expectedText Expected value.
|
|
@@ -420,10 +440,11 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
420
440
|
return __awaiter(this, void 0, void 0, function () {
|
|
421
441
|
return __generator(this, function (_a) {
|
|
422
442
|
switch (_a.label) {
|
|
423
|
-
case 0: return [4 /*yield*/, control.controlLocator.
|
|
424
|
-
var verificationResult = value === expectedText ? "PASSED" : "
|
|
425
|
-
|
|
426
|
-
(0,
|
|
443
|
+
case 0: return [4 /*yield*/, control.controlLocator.getAttribute("value").then(function (value) {
|
|
444
|
+
var verificationResult = value === expectedText ? "PASSED" : "FAILED";
|
|
445
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
446
|
+
(0, logs_core_1.logVerification)(logText);
|
|
447
|
+
(0, test_1.expect)(value, logText).toEqual(expectedText);
|
|
427
448
|
})];
|
|
428
449
|
case 1:
|
|
429
450
|
_a.sent();
|
|
@@ -434,7 +455,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
434
455
|
};
|
|
435
456
|
/**
|
|
436
457
|
* Verify element's checkbox/radio value is equal to expected value
|
|
437
|
-
* If expected element's checkbox/radio value to be expected value then test case gets passsed else failed
|
|
458
|
+
* If expected element's checkbox/radio value to be expected value then test case gets passsed else failed..
|
|
438
459
|
*
|
|
439
460
|
* @param control Checkbox/radio control.
|
|
440
461
|
* @param expectedText Expected checkbox/radio value.
|
|
@@ -449,9 +470,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
449
470
|
return __generator(this, function (_a) {
|
|
450
471
|
switch (_a.label) {
|
|
451
472
|
case 0: return [4 /*yield*/, this.isSelected(control).then(function (isChecked) {
|
|
452
|
-
var verificationResult = value === isChecked ? "PASSED" : "
|
|
453
|
-
|
|
454
|
-
(0,
|
|
473
|
+
var verificationResult = value === isChecked ? "PASSED" : "FAILED";
|
|
474
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify checkbox value of ").concat(control.controlDescription, ". Expected: '").concat(value, "' Actual: '").concat(isChecked, "'");
|
|
475
|
+
(0, logs_core_1.logVerification)(logText);
|
|
476
|
+
(0, test_1.expect)(isChecked, logText).toBe(value);
|
|
455
477
|
})];
|
|
456
478
|
case 1:
|
|
457
479
|
_a.sent();
|
|
@@ -462,7 +484,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
462
484
|
};
|
|
463
485
|
/**
|
|
464
486
|
* Verify element's tagname is equal to expected value
|
|
465
|
-
* If expected element's Tagname is equal to expected value then test case gets passsed else failed
|
|
487
|
+
* If expected element's Tagname is equal to expected value then test case gets passsed else failed..
|
|
466
488
|
*
|
|
467
489
|
* @param control Checkbox/radio control.
|
|
468
490
|
* @param expectedText Expected checkbox/radio value.
|
|
@@ -474,7 +496,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
474
496
|
*/
|
|
475
497
|
Assertion.prototype.verifyTagName = function (control, expectedTagName) {
|
|
476
498
|
return __awaiter(this, void 0, void 0, function () {
|
|
477
|
-
var tagName, parent, verificationResult;
|
|
499
|
+
var tagName, parent, verificationResult, logText;
|
|
478
500
|
return __generator(this, function (_a) {
|
|
479
501
|
switch (_a.label) {
|
|
480
502
|
case 0:
|
|
@@ -485,9 +507,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
485
507
|
tagName = _a.sent();
|
|
486
508
|
_a.label = 2;
|
|
487
509
|
case 2:
|
|
488
|
-
verificationResult = (tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase()) == expectedTagName.toLowerCase() ? "PASSED" : "
|
|
489
|
-
|
|
490
|
-
(0,
|
|
510
|
+
verificationResult = (tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase()) == expectedTagName.toLowerCase() ? "PASSED" : "FAILED";
|
|
511
|
+
logText = "VERIFICATION: ".concat(verificationResult, " Verify Tagname of ").concat(control.controlDescription, ". Expected: '").concat(expectedTagName.toLowerCase(), "' Actual: '").concat(tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase(), "'");
|
|
512
|
+
(0, logs_core_1.logVerification)(logText);
|
|
513
|
+
(0, test_1.expect)(tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase(), logText).toBe(expectedTagName.toLowerCase());
|
|
491
514
|
return [2 /*return*/];
|
|
492
515
|
}
|
|
493
516
|
});
|
|
@@ -517,7 +540,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
517
540
|
});
|
|
518
541
|
});
|
|
519
542
|
}).length;
|
|
520
|
-
verificationResult = count >= 1 ? "PASSED" : "
|
|
543
|
+
verificationResult = count >= 1 ? "PASSED" : "FAILED";
|
|
521
544
|
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". '").concat(valueToVerify, "' is Present in list '").concat(control.controlDescription, "'"));
|
|
522
545
|
(0, test_1.expect)(count).toBeGreaterThanOrEqual(1);
|
|
523
546
|
return [2 /*return*/];
|
|
@@ -561,7 +584,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
561
584
|
});
|
|
562
585
|
});
|
|
563
586
|
}).length;
|
|
564
|
-
verificationResult = count >= 1 ? "PASSED" : "
|
|
587
|
+
verificationResult = count >= 1 ? "PASSED" : "FAILED";
|
|
565
588
|
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". '").concat(expectedValue, "' is Present in list '").concat(control.controlDescription, "'"));
|
|
566
589
|
(0, test_1.expect)(count).toBeGreaterThanOrEqual(1);
|
|
567
590
|
return [2 /*return*/];
|
|
@@ -595,7 +618,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
595
618
|
case 1:
|
|
596
619
|
_b.sent();
|
|
597
620
|
return [4 /*yield*/, list[i].innerText().then(function (value) {
|
|
598
|
-
var verificationResult = value.trim().includes(listOfValueToVerify[i]) ? "PASSED" : "
|
|
621
|
+
var verificationResult = value.trim().includes(listOfValueToVerify[i]) ? "PASSED" : "FAILED";
|
|
599
622
|
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(listOfValueToVerify[i], "' Actual: '").concat(value, "'"));
|
|
600
623
|
(0, test_1.expect)(value.trim()).toContain(listOfValueToVerify[i]);
|
|
601
624
|
})];
|
|
@@ -623,7 +646,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
623
646
|
};
|
|
624
647
|
/**
|
|
625
648
|
* Verify Alert text is equal to expected value
|
|
626
|
-
* If alert text is equal to expected value then test case gets passsed else failed
|
|
649
|
+
* If alert text is equal to expected value then test case gets passsed else failed..
|
|
627
650
|
*
|
|
628
651
|
* @param expectedText Expected alert text.
|
|
629
652
|
* Example:
|
|
@@ -635,11 +658,12 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
635
658
|
var _this = this;
|
|
636
659
|
return __generator(this, function (_a) {
|
|
637
660
|
this.page.on('dialog', function (dialog) { return __awaiter(_this, void 0, void 0, function () {
|
|
638
|
-
var verificationResult;
|
|
661
|
+
var verificationResult, logText;
|
|
639
662
|
return __generator(this, function (_a) {
|
|
640
|
-
verificationResult = dialog.message().includes(expectedText) ? "PASSED" : "
|
|
641
|
-
|
|
642
|
-
(0,
|
|
663
|
+
verificationResult = dialog.message().includes(expectedText) ? "PASSED" : "FAILED";
|
|
664
|
+
logText = "VERIFICATION: ".concat(verificationResult, " Verify alert text. Expected: '").concat(expectedText, "' Actual: '").concat(dialog.message(), "'");
|
|
665
|
+
(0, logs_core_1.logVerification)(logText);
|
|
666
|
+
(0, test_1.expect)(dialog.message(), logText).toContain(expectedText);
|
|
643
667
|
return [2 /*return*/];
|
|
644
668
|
});
|
|
645
669
|
}); });
|
|
@@ -649,7 +673,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
649
673
|
};
|
|
650
674
|
/**
|
|
651
675
|
* Verify URL contains expected value
|
|
652
|
-
* If URL contains expected value then test case gets passsed else failed
|
|
676
|
+
* If URL contains expected value then test case gets passsed else failed..
|
|
653
677
|
*
|
|
654
678
|
* @param expectedText Expected partial URL.
|
|
655
679
|
* Example:
|
|
@@ -661,9 +685,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
661
685
|
return __generator(this, function (_a) {
|
|
662
686
|
switch (_a.label) {
|
|
663
687
|
case 0: return [4 /*yield*/, this.getURL().then(function (value) {
|
|
664
|
-
var verificationResult = value.includes(subString) ? "PASSED" : "
|
|
665
|
-
|
|
666
|
-
(0,
|
|
688
|
+
var verificationResult = value.includes(subString) ? "PASSED" : "FAILED";
|
|
689
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify URL contains. Expected: '").concat(subString, "' Actual: '").concat(value, "'");
|
|
690
|
+
(0, logs_core_1.logVerification)(logText);
|
|
691
|
+
(0, test_1.expect)(value, logText).toContain(subString);
|
|
667
692
|
})];
|
|
668
693
|
case 1:
|
|
669
694
|
_a.sent();
|
|
@@ -674,7 +699,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
674
699
|
};
|
|
675
700
|
/**
|
|
676
701
|
* Verify count of elements which matched the control
|
|
677
|
-
* If count of elements is equal to expected value then test case will get passsed else failed
|
|
702
|
+
* If count of elements is equal to expected value then test case will get passsed else failed..
|
|
678
703
|
*
|
|
679
704
|
* @param control Control element.
|
|
680
705
|
* @param expectedCount Expected count of elements matching criteria
|
|
@@ -688,9 +713,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
688
713
|
return __generator(this, function (_a) {
|
|
689
714
|
switch (_a.label) {
|
|
690
715
|
case 0: return [4 /*yield*/, control.controlLocator.count().then(function (value) {
|
|
691
|
-
var verificationResult = value >= expectedCount ? "PASSED" : "
|
|
692
|
-
|
|
693
|
-
(0,
|
|
716
|
+
var verificationResult = value >= expectedCount ? "PASSED" : "FAILED";
|
|
717
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements. Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
|
|
718
|
+
(0, logs_core_1.logVerification)(logText);
|
|
719
|
+
(0, test_1.expect)(value, logText).toBeGreaterThanOrEqual(expectedCount);
|
|
694
720
|
})];
|
|
695
721
|
case 1:
|
|
696
722
|
_a.sent();
|
|
@@ -701,7 +727,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
701
727
|
};
|
|
702
728
|
/**
|
|
703
729
|
* Verify title of web page contains expected value
|
|
704
|
-
* If title contains expected value then test case will get passsed else failed
|
|
730
|
+
* If title contains expected value then test case will get passsed else failed..
|
|
705
731
|
*
|
|
706
732
|
* @param expectedText Expected partial Title.
|
|
707
733
|
* Example:
|
|
@@ -716,18 +742,19 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
716
742
|
case 0:
|
|
717
743
|
_a.trys.push([0, 2, , 3]);
|
|
718
744
|
return [4 /*yield*/, this.page.title().then(function (value) {
|
|
719
|
-
var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "
|
|
720
|
-
|
|
721
|
-
(0,
|
|
745
|
+
var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
|
|
746
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify title contains. Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
747
|
+
(0, logs_core_1.logVerification)(logText);
|
|
748
|
+
(0, test_1.expect)(value.trim(), logText).toContain(expectedText);
|
|
722
749
|
}, function (reason) {
|
|
723
|
-
(0, logs_core_1.
|
|
750
|
+
(0, logs_core_1.logError)('Error : ' + reason);
|
|
724
751
|
})];
|
|
725
752
|
case 1:
|
|
726
753
|
_a.sent();
|
|
727
754
|
return [3 /*break*/, 3];
|
|
728
755
|
case 2:
|
|
729
756
|
error1_1 = _a.sent();
|
|
730
|
-
(0, logs_core_1.
|
|
757
|
+
(0, logs_core_1.logError)("VERIFICATION: FAILED. Expected: '" + expectedText + "'is NOT present in title.");
|
|
731
758
|
throw error1_1;
|
|
732
759
|
case 3: return [2 /*return*/];
|
|
733
760
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Class to
|
|
2
|
+
* Class to initialize all variables required for execution
|
|
3
3
|
* @author Ketan Pardeshi
|
|
4
4
|
* */
|
|
5
5
|
export declare class Configuration {
|
|
@@ -13,4 +13,10 @@ export declare class Configuration {
|
|
|
13
13
|
static get senderPassword(): any;
|
|
14
14
|
static get configurationData(): JSON;
|
|
15
15
|
static get(key: string): any;
|
|
16
|
+
/**
|
|
17
|
+
* Sets the value of a key in the configuration data and saves to the JSON file.
|
|
18
|
+
* @param key - The key to set.
|
|
19
|
+
* @param value - The value to set for the key.
|
|
20
|
+
*/
|
|
21
|
+
static set(key: string, value: any): void;
|
|
16
22
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Configuration = void 0;
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var path = require('path');
|
|
4
6
|
var automationSettings = require('../../../../ExecutionSettings.json');
|
|
5
|
-
var
|
|
7
|
+
var appConfigurationsPath = path.resolve(__dirname, '../../../../AppConfigurations.json');
|
|
8
|
+
var appConfigurations = require(appConfigurationsPath);
|
|
6
9
|
/**
|
|
7
|
-
* Class to
|
|
10
|
+
* Class to initialize all variables required for execution
|
|
8
11
|
* @author Ketan Pardeshi
|
|
9
12
|
* */
|
|
10
13
|
var Configuration = /** @class */ (function () {
|
|
@@ -60,8 +63,17 @@ var Configuration = /** @class */ (function () {
|
|
|
60
63
|
Configuration.get = function (key) {
|
|
61
64
|
var jsonData = Configuration.configurationData;
|
|
62
65
|
var jsonString = JSON.stringify(jsonData);
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
return JSON.parse(jsonString)[key];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Sets the value of a key in the configuration data and saves to the JSON file.
|
|
70
|
+
* @param key - The key to set.
|
|
71
|
+
* @param value - The value to set for the key.
|
|
72
|
+
*/
|
|
73
|
+
Configuration.set = function (key, value) {
|
|
74
|
+
var envConfig = appConfigurations[Configuration.environment];
|
|
75
|
+
envConfig[key] = value;
|
|
76
|
+
fs.writeFileSync(appConfigurationsPath, JSON.stringify(appConfigurations, null, 2));
|
|
65
77
|
};
|
|
66
78
|
Configuration.Environment = "QA";
|
|
67
79
|
Configuration.EmailRecievers = ";";
|
package/lib/core/logs.core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function logAction(message: string): void;
|
|
2
2
|
export declare function logVerification(message: string): void;
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function logError(message: string): void;
|
|
4
|
+
export declare function logConsole(message: string): void;
|
|
5
5
|
export declare function logTestResult(message: string): void;
|
package/lib/core/logs.core.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logAction = logAction;
|
|
4
4
|
exports.logVerification = logVerification;
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
5
|
+
exports.logError = logError;
|
|
6
|
+
exports.logConsole = logConsole;
|
|
7
7
|
exports.logTestResult = logTestResult;
|
|
8
8
|
var log4js = require('log4js');
|
|
9
9
|
var dateTimeStamp = getCurrentDateTimeWithHHMM();
|
|
@@ -30,11 +30,11 @@ function logVerification(message) {
|
|
|
30
30
|
console.log(message);
|
|
31
31
|
logger.info(message);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function logError(message) {
|
|
34
34
|
console.log('ERROR: ' + message);
|
|
35
35
|
logger.error('ERROR: ' + message);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function logConsole(message) {
|
|
38
38
|
console.log("INFO: " + message);
|
|
39
39
|
}
|
|
40
40
|
function logTestResult(message) {
|
package/lib/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { WebControl } from './core/webControl.core';
|
|
|
5
5
|
export { Configuration } from './core/configuration.core';
|
|
6
6
|
export { globalSetup } from './core/global.setup';
|
|
7
7
|
export { globalTearDown } from './core/global.tearDown';
|
|
8
|
-
export { logAction, logVerification,
|
|
8
|
+
export { logAction, logVerification, logError, logConsole, logTestResult } from './core/logs.core';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logTestResult = exports.
|
|
3
|
+
exports.logTestResult = exports.logConsole = exports.logError = exports.logVerification = exports.logAction = exports.globalTearDown = exports.globalSetup = exports.Configuration = exports.WebControl = exports.Actions = exports.Assertion = exports.BasePage = void 0;
|
|
4
4
|
var basePage_core_1 = require("./core/basePage.core");
|
|
5
5
|
Object.defineProperty(exports, "BasePage", { enumerable: true, get: function () { return basePage_core_1.BasePage; } });
|
|
6
6
|
var assertion_core_1 = require("./core/assertion.core");
|
|
@@ -18,6 +18,6 @@ Object.defineProperty(exports, "globalTearDown", { enumerable: true, get: functi
|
|
|
18
18
|
var logs_core_1 = require("./core/logs.core");
|
|
19
19
|
Object.defineProperty(exports, "logAction", { enumerable: true, get: function () { return logs_core_1.logAction; } });
|
|
20
20
|
Object.defineProperty(exports, "logVerification", { enumerable: true, get: function () { return logs_core_1.logVerification; } });
|
|
21
|
-
Object.defineProperty(exports, "
|
|
22
|
-
Object.defineProperty(exports, "
|
|
21
|
+
Object.defineProperty(exports, "logError", { enumerable: true, get: function () { return logs_core_1.logError; } });
|
|
22
|
+
Object.defineProperty(exports, "logConsole", { enumerable: true, get: function () { return logs_core_1.logConsole; } });
|
|
23
23
|
Object.defineProperty(exports, "logTestResult", { enumerable: true, get: function () { return logs_core_1.logTestResult; } });
|