playwright-ts-automationframework 1.1.20 → 1.1.22
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 +133 -95
- 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.
|
|
@@ -172,11 +174,22 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
172
174
|
case 1:
|
|
173
175
|
_a.sent();
|
|
174
176
|
_a.label = 2;
|
|
175
|
-
case 2: return [4 /*yield*/, control.controlLocator.isHidden().then(function (value) {
|
|
176
|
-
var verificationResult
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
case 2: return [4 /*yield*/, control.controlLocator.isHidden().then(function (value) { return __awaiter(_this, void 0, void 0, function () {
|
|
178
|
+
var verificationResult, logText, _a;
|
|
179
|
+
return __generator(this, function (_b) {
|
|
180
|
+
switch (_b.label) {
|
|
181
|
+
case 0:
|
|
182
|
+
verificationResult = value === true ? "PASSED" : "FAILED";
|
|
183
|
+
logText = "VERIFICATION: ".concat(verificationResult, ". '").concat(control.controlDescription, "' hidden status is '").concat(value, "' Expected: false");
|
|
184
|
+
(0, logs_core_1.logVerification)(logText);
|
|
185
|
+
_a = test_1.expect;
|
|
186
|
+
return [4 /*yield*/, control.controlLocator.isHidden()];
|
|
187
|
+
case 1:
|
|
188
|
+
_a.apply(void 0, [_b.sent(), logText]).toBe(true);
|
|
189
|
+
return [2 /*return*/];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}); })];
|
|
180
193
|
case 3:
|
|
181
194
|
_a.sent();
|
|
182
195
|
return [2 /*return*/];
|
|
@@ -186,7 +199,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
186
199
|
};
|
|
187
200
|
/**
|
|
188
201
|
* Verify attribute value of the control
|
|
189
|
-
* If elements attribute value is as per expected value then test case gets passed else failed
|
|
202
|
+
* If elements attribute value is as per expected value then test case gets passed else failed..
|
|
190
203
|
*
|
|
191
204
|
* @param control Control for which attribute value need to verify.
|
|
192
205
|
* @param attributeName Attribute name.
|
|
@@ -203,9 +216,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
203
216
|
return __generator(this, function (_a) {
|
|
204
217
|
switch (_a.label) {
|
|
205
218
|
case 0: return [4 /*yield*/, this.getAttributeValue(control, attributeName).then(function (value) {
|
|
206
|
-
var verificationResult = value === expectedAttributeValue ? "PASSED" : "
|
|
207
|
-
|
|
208
|
-
(0,
|
|
219
|
+
var verificationResult = value === expectedAttributeValue ? "PASSED" : "FAILED";
|
|
220
|
+
var logText = "VERIFICATION: ".concat(verificationResult, ". Attribute value of ").concat(control.controlDescription, " Expected: '").concat(expectedAttributeValue, "' Actual : '").concat(value, "'");
|
|
221
|
+
(0, logs_core_1.logVerification)(logText);
|
|
222
|
+
(0, test_1.expect)(control.controlLocator, logText).toHaveAttribute(expectedAttributeValue);
|
|
209
223
|
})];
|
|
210
224
|
case 1:
|
|
211
225
|
_a.sent();
|
|
@@ -216,7 +230,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
216
230
|
};
|
|
217
231
|
/**
|
|
218
232
|
* Verify element's attribute value contains expected value
|
|
219
|
-
* If element's attribute value contains expected value then test case gets passsed else failed
|
|
233
|
+
* If element's attribute value contains expected value then test case gets passsed else failed..
|
|
220
234
|
*
|
|
221
235
|
* @param control Control of which attribute value need to verify.
|
|
222
236
|
* @param attributeName Attribute name
|
|
@@ -228,26 +242,38 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
228
242
|
*
|
|
229
243
|
* verifyAttributeValueContains(loginBtn, "value", "Submit");
|
|
230
244
|
*/
|
|
231
|
-
Assertion.prototype.verifyAttributeValueContains = function (
|
|
245
|
+
Assertion.prototype.verifyAttributeValueContains = function (control, attributeName, attributeValue) {
|
|
232
246
|
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
|
-
|
|
247
|
+
var _this = this;
|
|
248
|
+
return __generator(this, function (_a) {
|
|
249
|
+
switch (_a.label) {
|
|
250
|
+
case 0: return [4 /*yield*/, this.getAttributeValue(control, attributeName).then(function (value) { return __awaiter(_this, void 0, void 0, function () {
|
|
251
|
+
var verificationResult, logText, _a, _b;
|
|
252
|
+
return __generator(this, function (_c) {
|
|
253
|
+
switch (_c.label) {
|
|
254
|
+
case 0:
|
|
255
|
+
if (!(value != null)) return [3 /*break*/, 2];
|
|
256
|
+
verificationResult = value.includes(attributeValue) ? "PASSED" : "FAILED";
|
|
257
|
+
logText = "VERIFICATION: ".concat(verificationResult, ". Atribute value of ").concat(control.controlLocator, " Expected: '").concat(attributeValue, "' contains Actual : '").concat(value, "'");
|
|
258
|
+
(0, logs_core_1.logVerification)(logText);
|
|
259
|
+
_a = test_1.expect;
|
|
260
|
+
return [4 /*yield*/, this.getAttributeValue(control, attributeName)];
|
|
261
|
+
case 1:
|
|
262
|
+
_a.apply(void 0, [_c.sent(), logText]).toContain(attributeValue);
|
|
263
|
+
return [3 /*break*/, 4];
|
|
264
|
+
case 2:
|
|
265
|
+
(0, logs_core_1.logVerification)("VERIFICATION: FAILED. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'"));
|
|
266
|
+
_b = test_1.expect;
|
|
267
|
+
return [4 /*yield*/, this.getAttributeValue(control, attributeName)];
|
|
268
|
+
case 3:
|
|
269
|
+
_b.apply(void 0, [_c.sent(), "VERIFICATION: FAILED. Expected: '".concat(attributeValue, "' does not contains Actual: '").concat(value, "'")]).toContain(attributeValue);
|
|
270
|
+
_c.label = 4;
|
|
271
|
+
case 4: return [2 /*return*/];
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}); })];
|
|
245
275
|
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);
|
|
276
|
+
_a.sent();
|
|
251
277
|
return [2 /*return*/];
|
|
252
278
|
}
|
|
253
279
|
});
|
|
@@ -255,7 +281,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
255
281
|
};
|
|
256
282
|
/**
|
|
257
283
|
* 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
|
|
284
|
+
* If expected element's enabled status is as per expected then test case gets passsed else failed..
|
|
259
285
|
*
|
|
260
286
|
* @param control Control of which enable or disable status.
|
|
261
287
|
* @param expValue Expected value enabled as true or disabled as false.
|
|
@@ -277,9 +303,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
277
303
|
_a.sent();
|
|
278
304
|
_a.label = 2;
|
|
279
305
|
case 2: return [4 /*yield*/, control.controlLocator.isEnabled().then(function (value) {
|
|
280
|
-
var verificationResult = value === expValue ? "PASSED" : "
|
|
281
|
-
|
|
282
|
-
(0,
|
|
306
|
+
var verificationResult = value === expValue ? "PASSED" : "FAILED";
|
|
307
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' enabled status is: '").concat(value, "' Expected: ").concat(expValue);
|
|
308
|
+
(0, logs_core_1.logVerification)(logText);
|
|
309
|
+
(0, test_1.expect)(value, logText).toBe(expValue);
|
|
283
310
|
})];
|
|
284
311
|
case 3:
|
|
285
312
|
_a.sent();
|
|
@@ -310,8 +337,9 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
310
337
|
_a.label = 2;
|
|
311
338
|
case 2: return [4 /*yield*/, control.controlLocator.isChecked().then(function (isChecked) {
|
|
312
339
|
var verificationResult = isChecked === expValue ? "PASSED" : "FAILED";
|
|
313
|
-
|
|
314
|
-
(0,
|
|
340
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " '").concat(control.controlDescription, "' selected status is: '").concat(isChecked, "' Expected: ").concat(expValue);
|
|
341
|
+
(0, logs_core_1.logVerification)(logText);
|
|
342
|
+
(0, test_1.expect)(isChecked, logText).toBe(expValue);
|
|
315
343
|
})];
|
|
316
344
|
case 3:
|
|
317
345
|
_a.sent();
|
|
@@ -322,7 +350,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
322
350
|
};
|
|
323
351
|
/**
|
|
324
352
|
* 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
|
|
353
|
+
* If expected element's text is as per expected value then test case gets passsed else failed..
|
|
326
354
|
*
|
|
327
355
|
* @param control Control of which text need to verify.
|
|
328
356
|
* @param expectedText Expected value.
|
|
@@ -337,9 +365,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
337
365
|
return __generator(this, function (_a) {
|
|
338
366
|
switch (_a.label) {
|
|
339
367
|
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,
|
|
368
|
+
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText.trim() ? "PASSED" : "FAILED";
|
|
369
|
+
var logText = "VERIFICATION: '".concat(verificationResult, "' Verify text of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
370
|
+
(0, logs_core_1.logVerification)(logText);
|
|
371
|
+
(0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toBe(expectedText.trim());
|
|
343
372
|
})];
|
|
344
373
|
case 1:
|
|
345
374
|
_a.sent();
|
|
@@ -350,7 +379,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
350
379
|
};
|
|
351
380
|
/**
|
|
352
381
|
* Verify element's text contains partial expected value
|
|
353
|
-
* If expected element's text contains expected value then test case gets passsed else failed
|
|
382
|
+
* If expected element's text contains expected value then test case gets passsed else failed..
|
|
354
383
|
*
|
|
355
384
|
* @param control Control of which text need to verify.
|
|
356
385
|
* @param expectedText Expected partial value.
|
|
@@ -365,9 +394,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
365
394
|
return __generator(this, function (_a) {
|
|
366
395
|
switch (_a.label) {
|
|
367
396
|
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,
|
|
397
|
+
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim())) ? "PASSED" : "FAILED";
|
|
398
|
+
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(), "'");
|
|
399
|
+
(0, logs_core_1.logVerification)(logText);
|
|
400
|
+
(0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toContain(expectedText.trim());
|
|
371
401
|
})];
|
|
372
402
|
case 1:
|
|
373
403
|
_a.sent();
|
|
@@ -378,7 +408,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
378
408
|
};
|
|
379
409
|
/**
|
|
380
410
|
* 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
|
|
411
|
+
* If expected element's text does not contains expected value then test case gets passsed else failed..
|
|
382
412
|
*
|
|
383
413
|
* @param control Control of which text need to verify.
|
|
384
414
|
* @param expectedText Expected partial value.
|
|
@@ -393,9 +423,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
393
423
|
return __generator(this, function (_a) {
|
|
394
424
|
switch (_a.label) {
|
|
395
425
|
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,
|
|
426
|
+
var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "PASSED" : "FAILED";
|
|
427
|
+
var logText = "VERIFICATION: ".concat(verificationResult, ". Verify text of ").concat(control.controlDescription, " Expected: '").concat(expectedText, "' does not contains Actual: '").concat(value, "'");
|
|
428
|
+
(0, logs_core_1.logVerification)(logText);
|
|
429
|
+
(0, test_1.expect)(false, logText).toBe(value === null || value === void 0 ? void 0 : value.trim().includes(expectedText.trim()));
|
|
399
430
|
})];
|
|
400
431
|
case 1:
|
|
401
432
|
_a.sent();
|
|
@@ -406,7 +437,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
406
437
|
};
|
|
407
438
|
/**
|
|
408
439
|
* 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
|
|
440
|
+
* If expected element's textbox value to be expected value then test case gets passsed else failed..
|
|
410
441
|
*
|
|
411
442
|
* @param control Textbox control.
|
|
412
443
|
* @param expectedText Expected value.
|
|
@@ -420,10 +451,11 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
420
451
|
return __awaiter(this, void 0, void 0, function () {
|
|
421
452
|
return __generator(this, function (_a) {
|
|
422
453
|
switch (_a.label) {
|
|
423
|
-
case 0: return [4 /*yield*/, control.controlLocator.
|
|
424
|
-
var verificationResult = value === expectedText ? "PASSED" : "
|
|
425
|
-
|
|
426
|
-
(0,
|
|
454
|
+
case 0: return [4 /*yield*/, control.controlLocator.getAttribute("value").then(function (value) {
|
|
455
|
+
var verificationResult = value === expectedText ? "PASSED" : "FAILED";
|
|
456
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
457
|
+
(0, logs_core_1.logVerification)(logText);
|
|
458
|
+
(0, test_1.expect)(value, logText).toEqual(expectedText);
|
|
427
459
|
})];
|
|
428
460
|
case 1:
|
|
429
461
|
_a.sent();
|
|
@@ -434,7 +466,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
434
466
|
};
|
|
435
467
|
/**
|
|
436
468
|
* 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
|
|
469
|
+
* If expected element's checkbox/radio value to be expected value then test case gets passsed else failed..
|
|
438
470
|
*
|
|
439
471
|
* @param control Checkbox/radio control.
|
|
440
472
|
* @param expectedText Expected checkbox/radio value.
|
|
@@ -449,9 +481,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
449
481
|
return __generator(this, function (_a) {
|
|
450
482
|
switch (_a.label) {
|
|
451
483
|
case 0: return [4 /*yield*/, this.isSelected(control).then(function (isChecked) {
|
|
452
|
-
var verificationResult = value === isChecked ? "PASSED" : "
|
|
453
|
-
|
|
454
|
-
(0,
|
|
484
|
+
var verificationResult = value === isChecked ? "PASSED" : "FAILED";
|
|
485
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify checkbox value of ").concat(control.controlDescription, ". Expected: '").concat(value, "' Actual: '").concat(isChecked, "'");
|
|
486
|
+
(0, logs_core_1.logVerification)(logText);
|
|
487
|
+
(0, test_1.expect)(isChecked, logText).toBe(value);
|
|
455
488
|
})];
|
|
456
489
|
case 1:
|
|
457
490
|
_a.sent();
|
|
@@ -462,7 +495,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
462
495
|
};
|
|
463
496
|
/**
|
|
464
497
|
* 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
|
|
498
|
+
* If expected element's Tagname is equal to expected value then test case gets passsed else failed..
|
|
466
499
|
*
|
|
467
500
|
* @param control Checkbox/radio control.
|
|
468
501
|
* @param expectedText Expected checkbox/radio value.
|
|
@@ -474,7 +507,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
474
507
|
*/
|
|
475
508
|
Assertion.prototype.verifyTagName = function (control, expectedTagName) {
|
|
476
509
|
return __awaiter(this, void 0, void 0, function () {
|
|
477
|
-
var tagName, parent, verificationResult;
|
|
510
|
+
var tagName, parent, verificationResult, logText;
|
|
478
511
|
return __generator(this, function (_a) {
|
|
479
512
|
switch (_a.label) {
|
|
480
513
|
case 0:
|
|
@@ -485,9 +518,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
485
518
|
tagName = _a.sent();
|
|
486
519
|
_a.label = 2;
|
|
487
520
|
case 2:
|
|
488
|
-
verificationResult = (tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase()) == expectedTagName.toLowerCase() ? "PASSED" : "
|
|
489
|
-
|
|
490
|
-
(0,
|
|
521
|
+
verificationResult = (tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase()) == expectedTagName.toLowerCase() ? "PASSED" : "FAILED";
|
|
522
|
+
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(), "'");
|
|
523
|
+
(0, logs_core_1.logVerification)(logText);
|
|
524
|
+
(0, test_1.expect)(tagName === null || tagName === void 0 ? void 0 : tagName.toLowerCase(), logText).toBe(expectedTagName.toLowerCase());
|
|
491
525
|
return [2 /*return*/];
|
|
492
526
|
}
|
|
493
527
|
});
|
|
@@ -517,7 +551,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
517
551
|
});
|
|
518
552
|
});
|
|
519
553
|
}).length;
|
|
520
|
-
verificationResult = count >= 1 ? "PASSED" : "
|
|
554
|
+
verificationResult = count >= 1 ? "PASSED" : "FAILED";
|
|
521
555
|
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". '").concat(valueToVerify, "' is Present in list '").concat(control.controlDescription, "'"));
|
|
522
556
|
(0, test_1.expect)(count).toBeGreaterThanOrEqual(1);
|
|
523
557
|
return [2 /*return*/];
|
|
@@ -561,7 +595,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
561
595
|
});
|
|
562
596
|
});
|
|
563
597
|
}).length;
|
|
564
|
-
verificationResult = count >= 1 ? "PASSED" : "
|
|
598
|
+
verificationResult = count >= 1 ? "PASSED" : "FAILED";
|
|
565
599
|
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". '").concat(expectedValue, "' is Present in list '").concat(control.controlDescription, "'"));
|
|
566
600
|
(0, test_1.expect)(count).toBeGreaterThanOrEqual(1);
|
|
567
601
|
return [2 /*return*/];
|
|
@@ -595,7 +629,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
595
629
|
case 1:
|
|
596
630
|
_b.sent();
|
|
597
631
|
return [4 /*yield*/, list[i].innerText().then(function (value) {
|
|
598
|
-
var verificationResult = value.trim().includes(listOfValueToVerify[i]) ? "PASSED" : "
|
|
632
|
+
var verificationResult = value.trim().includes(listOfValueToVerify[i]) ? "PASSED" : "FAILED";
|
|
599
633
|
(0, logs_core_1.logVerification)("VERIFICATION: ".concat(verificationResult, ". Expected: '").concat(listOfValueToVerify[i], "' Actual: '").concat(value, "'"));
|
|
600
634
|
(0, test_1.expect)(value.trim()).toContain(listOfValueToVerify[i]);
|
|
601
635
|
})];
|
|
@@ -623,7 +657,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
623
657
|
};
|
|
624
658
|
/**
|
|
625
659
|
* Verify Alert text is equal to expected value
|
|
626
|
-
* If alert text is equal to expected value then test case gets passsed else failed
|
|
660
|
+
* If alert text is equal to expected value then test case gets passsed else failed..
|
|
627
661
|
*
|
|
628
662
|
* @param expectedText Expected alert text.
|
|
629
663
|
* Example:
|
|
@@ -635,11 +669,12 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
635
669
|
var _this = this;
|
|
636
670
|
return __generator(this, function (_a) {
|
|
637
671
|
this.page.on('dialog', function (dialog) { return __awaiter(_this, void 0, void 0, function () {
|
|
638
|
-
var verificationResult;
|
|
672
|
+
var verificationResult, logText;
|
|
639
673
|
return __generator(this, function (_a) {
|
|
640
|
-
verificationResult = dialog.message().includes(expectedText) ? "PASSED" : "
|
|
641
|
-
|
|
642
|
-
(0,
|
|
674
|
+
verificationResult = dialog.message().includes(expectedText) ? "PASSED" : "FAILED";
|
|
675
|
+
logText = "VERIFICATION: ".concat(verificationResult, " Verify alert text. Expected: '").concat(expectedText, "' Actual: '").concat(dialog.message(), "'");
|
|
676
|
+
(0, logs_core_1.logVerification)(logText);
|
|
677
|
+
(0, test_1.expect)(dialog.message(), logText).toContain(expectedText);
|
|
643
678
|
return [2 /*return*/];
|
|
644
679
|
});
|
|
645
680
|
}); });
|
|
@@ -649,7 +684,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
649
684
|
};
|
|
650
685
|
/**
|
|
651
686
|
* Verify URL contains expected value
|
|
652
|
-
* If URL contains expected value then test case gets passsed else failed
|
|
687
|
+
* If URL contains expected value then test case gets passsed else failed..
|
|
653
688
|
*
|
|
654
689
|
* @param expectedText Expected partial URL.
|
|
655
690
|
* Example:
|
|
@@ -661,9 +696,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
661
696
|
return __generator(this, function (_a) {
|
|
662
697
|
switch (_a.label) {
|
|
663
698
|
case 0: return [4 /*yield*/, this.getURL().then(function (value) {
|
|
664
|
-
var verificationResult = value.includes(subString) ? "PASSED" : "
|
|
665
|
-
|
|
666
|
-
(0,
|
|
699
|
+
var verificationResult = value.includes(subString) ? "PASSED" : "FAILED";
|
|
700
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify URL contains. Expected: '").concat(subString, "' Actual: '").concat(value, "'");
|
|
701
|
+
(0, logs_core_1.logVerification)(logText);
|
|
702
|
+
(0, test_1.expect)(value, logText).toContain(subString);
|
|
667
703
|
})];
|
|
668
704
|
case 1:
|
|
669
705
|
_a.sent();
|
|
@@ -674,7 +710,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
674
710
|
};
|
|
675
711
|
/**
|
|
676
712
|
* 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
|
|
713
|
+
* If count of elements is equal to expected value then test case will get passsed else failed..
|
|
678
714
|
*
|
|
679
715
|
* @param control Control element.
|
|
680
716
|
* @param expectedCount Expected count of elements matching criteria
|
|
@@ -688,9 +724,10 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
688
724
|
return __generator(this, function (_a) {
|
|
689
725
|
switch (_a.label) {
|
|
690
726
|
case 0: return [4 /*yield*/, control.controlLocator.count().then(function (value) {
|
|
691
|
-
var verificationResult = value >= expectedCount ? "PASSED" : "
|
|
692
|
-
|
|
693
|
-
(0,
|
|
727
|
+
var verificationResult = value >= expectedCount ? "PASSED" : "FAILED";
|
|
728
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify count of elements. Expected: '").concat(expectedCount, "' Actual: '").concat(value, "'");
|
|
729
|
+
(0, logs_core_1.logVerification)(logText);
|
|
730
|
+
(0, test_1.expect)(value, logText).toBeGreaterThanOrEqual(expectedCount);
|
|
694
731
|
})];
|
|
695
732
|
case 1:
|
|
696
733
|
_a.sent();
|
|
@@ -701,7 +738,7 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
701
738
|
};
|
|
702
739
|
/**
|
|
703
740
|
* Verify title of web page contains expected value
|
|
704
|
-
* If title contains expected value then test case will get passsed else failed
|
|
741
|
+
* If title contains expected value then test case will get passsed else failed..
|
|
705
742
|
*
|
|
706
743
|
* @param expectedText Expected partial Title.
|
|
707
744
|
* Example:
|
|
@@ -716,18 +753,19 @@ var Assertion = /** @class */ (function (_super) {
|
|
|
716
753
|
case 0:
|
|
717
754
|
_a.trys.push([0, 2, , 3]);
|
|
718
755
|
return [4 /*yield*/, this.page.title().then(function (value) {
|
|
719
|
-
var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "
|
|
720
|
-
|
|
721
|
-
(0,
|
|
756
|
+
var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
|
|
757
|
+
var logText = "VERIFICATION: ".concat(verificationResult, " Verify title contains. Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
|
|
758
|
+
(0, logs_core_1.logVerification)(logText);
|
|
759
|
+
(0, test_1.expect)(value.trim(), logText).toContain(expectedText);
|
|
722
760
|
}, function (reason) {
|
|
723
|
-
(0, logs_core_1.
|
|
761
|
+
(0, logs_core_1.logError)('Error : ' + reason);
|
|
724
762
|
})];
|
|
725
763
|
case 1:
|
|
726
764
|
_a.sent();
|
|
727
765
|
return [3 /*break*/, 3];
|
|
728
766
|
case 2:
|
|
729
767
|
error1_1 = _a.sent();
|
|
730
|
-
(0, logs_core_1.
|
|
768
|
+
(0, logs_core_1.logError)("VERIFICATION: FAILED. Expected: '" + expectedText + "'is NOT present in title.");
|
|
731
769
|
throw error1_1;
|
|
732
770
|
case 3: return [2 /*return*/];
|
|
733
771
|
}
|
|
@@ -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; } });
|