playwright-ts-automationframework 1.1.68 → 1.1.70
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 +13 -1
- package/lib/core/actions.core.js +433 -735
- package/lib/core/assertion.core.d.ts +1 -1
- package/lib/core/assertion.core.js +466 -775
- package/lib/core/basePage.core.js +19 -66
- package/lib/core/configuration.core.js +44 -67
- package/lib/core/global.setup.js +7 -55
- package/lib/core/global.tearDown.js +4 -51
- package/lib/core/logs.core.js +12 -12
- package/lib/core/sendEmail.js +38 -93
- package/lib/core/webControl.core.js +5 -4
- package/lib/src/core/actions.core.d.ts +349 -0
- package/lib/src/core/actions.core.js +1056 -0
- package/lib/src/core/assertion.core.d.ts +269 -0
- package/lib/src/core/assertion.core.js +1045 -0
- package/lib/src/core/basePage.core.d.ts +17 -0
- package/lib/src/core/basePage.core.js +86 -0
- package/lib/src/core/configuration.core.d.ts +22 -0
- package/lib/src/core/configuration.core.js +84 -0
- package/lib/src/core/global.setup.d.ts +3 -0
- package/lib/src/core/global.setup.js +60 -0
- package/lib/src/core/global.tearDown.d.ts +3 -0
- package/lib/src/core/global.tearDown.js +56 -0
- package/lib/src/core/logs.core.d.ts +5 -0
- package/lib/src/core/logs.core.js +54 -0
- package/lib/src/core/sendEmail.d.ts +7 -0
- package/lib/src/core/sendEmail.js +102 -0
- package/lib/src/core/webControl.core.d.ts +10 -0
- package/lib/src/core/webControl.core.js +15 -0
- package/lib/src/index.d.ts +8 -0
- package/lib/src/index.js +23 -0
- package/package.json +6 -6
|
@@ -1,50 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.BasePage = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
const logs_core_1 = require("./logs.core");
|
|
5
|
+
const configuration_core_1 = require("./configuration.core");
|
|
42
6
|
/**
|
|
43
7
|
* Browser Initilization
|
|
44
8
|
* @author Ketan Pardeshi
|
|
45
9
|
* */
|
|
46
|
-
|
|
47
|
-
|
|
10
|
+
class BasePage {
|
|
11
|
+
page;
|
|
12
|
+
constructor(page) {
|
|
48
13
|
this.page = page;
|
|
49
14
|
}
|
|
50
15
|
/**
|
|
@@ -52,35 +17,23 @@ var BasePage = /** @class */ (function () {
|
|
|
52
17
|
* given environment(ExecutionSettings.json)
|
|
53
18
|
* and URL provided in AppConfigurations.json
|
|
54
19
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
waitUntil: "load",
|
|
62
|
-
timeout: 60000
|
|
63
|
-
}).then(function () {
|
|
64
|
-
(0, logs_core_1.logAction)("Navigated to URL: '" + url + "'");
|
|
65
|
-
})];
|
|
66
|
-
case 1:
|
|
67
|
-
_a.sent();
|
|
68
|
-
return [2 /*return*/];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
20
|
+
async initializeBrowser(url = configuration_core_1.Configuration.get("URL")) {
|
|
21
|
+
await this.page.goto(url, {
|
|
22
|
+
waitUntil: "load",
|
|
23
|
+
timeout: 60000
|
|
24
|
+
}).then(() => {
|
|
25
|
+
(0, logs_core_1.logAction)("Navigated to URL: '" + url + "'");
|
|
71
26
|
});
|
|
72
|
-
}
|
|
73
|
-
|
|
27
|
+
}
|
|
28
|
+
static setTestCaseID(testInfo) {
|
|
74
29
|
(0, logs_core_1.logTestResult)('');
|
|
75
|
-
(0, logs_core_1.logTestResult)(
|
|
30
|
+
(0, logs_core_1.logTestResult)(`===== START Of Execution For Title: '${testInfo.title}' ======`);
|
|
76
31
|
(0, logs_core_1.logTestResult)('');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
var _a;
|
|
32
|
+
}
|
|
33
|
+
static executionCompleted(testInfo) {
|
|
80
34
|
(0, logs_core_1.logTestResult)('');
|
|
81
|
-
(0, logs_core_1.logTestResult)(
|
|
35
|
+
(0, logs_core_1.logTestResult)(`===== END Of Execution For Test Case: ${testInfo.title} ' ${testInfo.title} ' With Test Result: ' ${testInfo.status?.toUpperCase()}' =====`);
|
|
82
36
|
(0, logs_core_1.logTestResult)('');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
}());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
86
39
|
exports.BasePage = BasePage;
|
|
@@ -1,84 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Configuration = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const automationSettings = require('../../../../ExecutionSettings.json');
|
|
7
|
+
const appConfigurationsPath = path.resolve(__dirname, '../../../../AppConfigurations.json');
|
|
8
|
+
let appConfigurations = require(appConfigurationsPath);
|
|
9
9
|
/**
|
|
10
10
|
* Class to initialize all variables required for execution
|
|
11
11
|
* @author Ketan Pardeshi
|
|
12
12
|
* */
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
class Configuration {
|
|
14
|
+
static Environment = "QA";
|
|
15
|
+
static EmailRecievers = ";";
|
|
16
|
+
static SenderEmail = ";";
|
|
17
|
+
static SenderPassword = ";";
|
|
18
|
+
static get environment() {
|
|
19
|
+
if (!automationSettings.environment.includes("#{environment}#")) {
|
|
20
|
+
return automationSettings.environment;
|
|
21
|
+
}
|
|
22
|
+
return Configuration.Environment;
|
|
15
23
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
return "";
|
|
42
|
-
},
|
|
43
|
-
enumerable: false,
|
|
44
|
-
configurable: true
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(Configuration, "senderPassword", {
|
|
47
|
-
get: function () {
|
|
48
|
-
if (!automationSettings.senderPassword.includes("#{senderPassword}#")) {
|
|
49
|
-
return automationSettings.senderPassword;
|
|
50
|
-
}
|
|
51
|
-
return "";
|
|
52
|
-
},
|
|
53
|
-
enumerable: false,
|
|
54
|
-
configurable: true
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(Configuration, "configurationData", {
|
|
57
|
-
get: function () {
|
|
58
|
-
return appConfigurations[Configuration.environment];
|
|
59
|
-
},
|
|
60
|
-
enumerable: false,
|
|
61
|
-
configurable: true
|
|
62
|
-
});
|
|
63
|
-
Configuration.get = function (key) {
|
|
64
|
-
var jsonData = Configuration.configurationData;
|
|
65
|
-
var jsonString = JSON.stringify(jsonData);
|
|
24
|
+
static get emailRecievers() {
|
|
25
|
+
if (!automationSettings.emailRecievers.includes("#{emailRecievers}#")) {
|
|
26
|
+
return automationSettings.emailRecievers;
|
|
27
|
+
}
|
|
28
|
+
return Configuration.EmailRecievers;
|
|
29
|
+
}
|
|
30
|
+
static get senderEmail() {
|
|
31
|
+
if (!automationSettings.senderEmail.includes("#{senderEmail}#")) {
|
|
32
|
+
return automationSettings.senderEmail;
|
|
33
|
+
}
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
static get senderPassword() {
|
|
37
|
+
if (!automationSettings.senderPassword.includes("#{senderPassword}#")) {
|
|
38
|
+
return automationSettings.senderPassword;
|
|
39
|
+
}
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
static get configurationData() {
|
|
43
|
+
return appConfigurations[Configuration.environment];
|
|
44
|
+
}
|
|
45
|
+
static get(key) {
|
|
46
|
+
const jsonData = Configuration.configurationData;
|
|
47
|
+
let jsonString = JSON.stringify(jsonData);
|
|
66
48
|
return JSON.parse(jsonString)[key];
|
|
67
|
-
}
|
|
49
|
+
}
|
|
68
50
|
/**
|
|
69
51
|
* Sets the value of a key in the configuration data and saves to the JSON file.
|
|
70
52
|
* @param key - The key to set.
|
|
71
53
|
* @param value - The value to set for the key.
|
|
72
54
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
static set(key, value) {
|
|
56
|
+
const envConfig = appConfigurations[Configuration.environment];
|
|
75
57
|
envConfig[key] = value;
|
|
76
58
|
fs.writeFileSync(appConfigurationsPath, JSON.stringify(appConfigurations, null, 2));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
Configuration.EmailRecievers = ";";
|
|
80
|
-
Configuration.SenderEmail = ";";
|
|
81
|
-
Configuration.SenderPassword = ";";
|
|
82
|
-
return Configuration;
|
|
83
|
-
}());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
84
61
|
exports.Configuration = Configuration;
|
package/lib/core/global.setup.js
CHANGED
|
@@ -1,60 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.globalSetup = globalSetup;
|
|
40
|
-
|
|
41
|
-
function globalSetup(config) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_a.trys.push([0, 2, , 3]);
|
|
48
|
-
return [4 /*yield*/, (0, promises_1.unlink)('../../../../Logs/ExecutionLogs.log')];
|
|
49
|
-
case 1:
|
|
50
|
-
_a.sent();
|
|
51
|
-
return [3 /*break*/, 3];
|
|
52
|
-
case 2:
|
|
53
|
-
error_1 = _a.sent();
|
|
54
|
-
return [3 /*break*/, 3];
|
|
55
|
-
case 3: return [2 /*return*/];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
});
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
async function globalSetup(config) {
|
|
6
|
+
try {
|
|
7
|
+
await (0, promises_1.unlink)('../../../../Logs/ExecutionLogs.log');
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
}
|
|
59
11
|
}
|
|
60
12
|
exports.default = globalSetup;
|
|
@@ -1,56 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.globalTearDown = globalTearDown;
|
|
40
|
-
|
|
41
|
-
function globalTearDown(config) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return __generator(this, function (_a) {
|
|
45
|
-
switch (_a.label) {
|
|
46
|
-
case 0:
|
|
47
|
-
sendEmail = new sendEmail_1.SendEmail();
|
|
48
|
-
return [4 /*yield*/, sendEmail.SendExecutionResultReport()];
|
|
49
|
-
case 1:
|
|
50
|
-
_a.sent();
|
|
51
|
-
return [2 /*return*/];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|
|
4
|
+
const sendEmail_1 = require("./sendEmail");
|
|
5
|
+
async function globalTearDown(config) {
|
|
6
|
+
let sendEmail = new sendEmail_1.SendEmail();
|
|
7
|
+
await sendEmail.SendExecutionResultReport();
|
|
55
8
|
}
|
|
56
9
|
exports.default = globalTearDown;
|
package/lib/core/logs.core.js
CHANGED
|
@@ -5,9 +5,9 @@ exports.logVerification = logVerification;
|
|
|
5
5
|
exports.logError = logError;
|
|
6
6
|
exports.logConsole = logConsole;
|
|
7
7
|
exports.logTestResult = logTestResult;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const log4js = require('log4js');
|
|
9
|
+
const dateTimeStamp = getCurrentDateTimeWithHHMM();
|
|
10
|
+
let logFileName = './Logs/ExecutionLogs.log';
|
|
11
11
|
log4js.configure({
|
|
12
12
|
appenders: {
|
|
13
13
|
Logs: {
|
|
@@ -21,7 +21,7 @@ log4js.configure({
|
|
|
21
21
|
},
|
|
22
22
|
categories: { default: { appenders: ['Logs'], level: 'info' } }
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
const logger = log4js.getLogger('Logs');
|
|
25
25
|
function logAction(message) {
|
|
26
26
|
console.log("ACTION: " + message);
|
|
27
27
|
logger.info("ACTION: " + message);
|
|
@@ -42,13 +42,13 @@ function logTestResult(message) {
|
|
|
42
42
|
logger.info(message);
|
|
43
43
|
}
|
|
44
44
|
function getCurrentDateTimeWithHHMM() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
const now = new Date();
|
|
46
|
+
const year = now.getFullYear();
|
|
47
|
+
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
48
|
+
const day = String(now.getDate()).padStart(2, '0');
|
|
49
|
+
const hours = String(now.getHours()).padStart(2, '0');
|
|
50
|
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
51
|
+
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
52
|
+
const formattedDateTime = `${day}_${month}_${year}_${hours}_${minutes}_${seconds}`;
|
|
53
53
|
return formattedDateTime;
|
|
54
54
|
}
|
package/lib/core/sendEmail.js
CHANGED
|
@@ -1,102 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.SendEmail = void 0;
|
|
40
|
-
|
|
4
|
+
const configuration_core_1 = require("./configuration.core");
|
|
41
5
|
/**
|
|
42
6
|
* Send Execution email to stakeholders
|
|
43
7
|
* @author Ketan Pardeshi
|
|
44
8
|
* */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
host: "smtp.gmail.com",
|
|
58
|
-
port: 465,
|
|
59
|
-
secure: true,
|
|
60
|
-
auth: {
|
|
61
|
-
user: configuration_core_1.Configuration.senderEmail,
|
|
62
|
-
pass: configuration_core_1.Configuration.SenderPassword
|
|
63
|
-
}
|
|
64
|
-
})];
|
|
65
|
-
case 1:
|
|
66
|
-
transporter = _a.sent();
|
|
67
|
-
mailOptions = {
|
|
68
|
-
from: configuration_core_1.Configuration.senderEmail,
|
|
69
|
-
to: configuration_core_1.Configuration.emailRecievers,
|
|
70
|
-
subject: 'Execution Results',
|
|
71
|
-
html: '<br>Hi, </br><div></div><br> Please find attachment for execution report.</br><br><div></div><br>Regards,</br><div></div><div>Automation Team</div>',
|
|
72
|
-
attachments: [
|
|
73
|
-
{
|
|
74
|
-
filename: 'ExecutionReport.html',
|
|
75
|
-
path: __dirname + '../../../../../playwright-report/index.html'
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
filename: 'ExecutionLogs.log',
|
|
79
|
-
path: __dirname + '../../../../../Logs/ExecutionLogs.log'
|
|
80
|
-
},
|
|
81
|
-
]
|
|
82
|
-
};
|
|
83
|
-
_a.label = 2;
|
|
84
|
-
case 2:
|
|
85
|
-
_a.trys.push([2, 4, , 5]);
|
|
86
|
-
return [4 /*yield*/, transporter.sendMail(mailOptions)];
|
|
87
|
-
case 3:
|
|
88
|
-
info = _a.sent();
|
|
89
|
-
console.log('Email sent: ' + info.response);
|
|
90
|
-
return [3 /*break*/, 5];
|
|
91
|
-
case 4:
|
|
92
|
-
error_1 = _a.sent();
|
|
93
|
-
console.error('Error sending email:', error_1);
|
|
94
|
-
return [3 /*break*/, 5];
|
|
95
|
-
case 5: return [2 /*return*/];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
9
|
+
class SendEmail {
|
|
10
|
+
async SendExecutionResultReport() {
|
|
11
|
+
var nodemailer = require('nodemailer');
|
|
12
|
+
const transporter = await nodemailer.createTransport({
|
|
13
|
+
service: "gmail",
|
|
14
|
+
host: "smtp.gmail.com",
|
|
15
|
+
port: 465,
|
|
16
|
+
secure: true,
|
|
17
|
+
auth: {
|
|
18
|
+
user: configuration_core_1.Configuration.senderEmail,
|
|
19
|
+
pass: configuration_core_1.Configuration.SenderPassword
|
|
20
|
+
}
|
|
98
21
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
22
|
+
const mailOptions = {
|
|
23
|
+
from: configuration_core_1.Configuration.senderEmail,
|
|
24
|
+
to: configuration_core_1.Configuration.emailRecievers,
|
|
25
|
+
subject: 'Execution Results',
|
|
26
|
+
html: '<br>Hi, </br><div></div><br> Please find attachment for execution report.</br><br><div></div><br>Regards,</br><div></div><div>Automation Team</div>',
|
|
27
|
+
attachments: [
|
|
28
|
+
{
|
|
29
|
+
filename: 'ExecutionReport.html',
|
|
30
|
+
path: __dirname + '../../../../../playwright-report/index.html'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
filename: 'ExecutionLogs.log',
|
|
34
|
+
path: __dirname + '../../../../../Logs/ExecutionLogs.log'
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
try {
|
|
39
|
+
const info = await transporter.sendMail(mailOptions);
|
|
40
|
+
console.log('Email sent: ' + info.response);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('Error sending email:', error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
102
47
|
exports.SendEmail = SendEmail;
|
|
@@ -5,11 +5,12 @@ exports.WebControl = void 0;
|
|
|
5
5
|
* Playwright Locator Object wrapped object
|
|
6
6
|
* @author Ketan Pardeshi
|
|
7
7
|
* */
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
class WebControl {
|
|
9
|
+
controlLocator;
|
|
10
|
+
controlDescription;
|
|
11
|
+
constructor(controlLocator, controlDescription) {
|
|
10
12
|
this.controlLocator = controlLocator;
|
|
11
13
|
this.controlDescription = controlDescription;
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
}());
|
|
15
|
+
}
|
|
15
16
|
exports.WebControl = WebControl;
|