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.
@@ -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
- var logs_core_1 = require("./logs.core");
41
- var configuration_core_1 = require("./configuration.core");
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
- var BasePage = /** @class */ (function () {
47
- function BasePage(page) {
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
- BasePage.prototype.initializeBrowser = function () {
56
- return __awaiter(this, arguments, void 0, function (url) {
57
- if (url === void 0) { url = configuration_core_1.Configuration.get("URL"); }
58
- return __generator(this, function (_a) {
59
- switch (_a.label) {
60
- case 0: return [4 /*yield*/, this.page.goto(url, {
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
- BasePage.setTestCaseID = function (testInfo) {
27
+ }
28
+ static setTestCaseID(testInfo) {
74
29
  (0, logs_core_1.logTestResult)('');
75
- (0, logs_core_1.logTestResult)("===== START Of Execution For Title: '".concat(testInfo.title, "' ======"));
30
+ (0, logs_core_1.logTestResult)(`===== START Of Execution For Title: '${testInfo.title}' ======`);
76
31
  (0, logs_core_1.logTestResult)('');
77
- };
78
- BasePage.executionCompleted = function (testInfo) {
79
- var _a;
32
+ }
33
+ static executionCompleted(testInfo) {
80
34
  (0, logs_core_1.logTestResult)('');
81
- (0, logs_core_1.logTestResult)("===== END Of Execution For Test Case: ".concat(testInfo.title, " ' ").concat(testInfo.title, " ' With Test Result: ' ").concat((_a = testInfo.status) === null || _a === void 0 ? void 0 : _a.toUpperCase(), "' ====="));
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
- return BasePage;
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
- var fs = require('fs');
5
- var path = require('path');
6
- var automationSettings = require('../../../../ExecutionSettings.json');
7
- var appConfigurationsPath = path.resolve(__dirname, '../../../../AppConfigurations.json');
8
- var appConfigurations = require(appConfigurationsPath);
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
- var Configuration = /** @class */ (function () {
14
- function Configuration() {
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
- Object.defineProperty(Configuration, "environment", {
17
- get: function () {
18
- if (!automationSettings.environment.includes("#{environment}#")) {
19
- return automationSettings.environment;
20
- }
21
- return Configuration.Environment;
22
- },
23
- enumerable: false,
24
- configurable: true
25
- });
26
- Object.defineProperty(Configuration, "emailRecievers", {
27
- get: function () {
28
- if (!automationSettings.emailRecievers.includes("#{emailRecievers}#")) {
29
- return automationSettings.emailRecievers;
30
- }
31
- return Configuration.EmailRecievers;
32
- },
33
- enumerable: false,
34
- configurable: true
35
- });
36
- Object.defineProperty(Configuration, "senderEmail", {
37
- get: function () {
38
- if (!automationSettings.senderEmail.includes("#{senderEmail}#")) {
39
- return automationSettings.senderEmail;
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
- Configuration.set = function (key, value) {
74
- var envConfig = appConfigurations[Configuration.environment];
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
- Configuration.Environment = "QA";
79
- Configuration.EmailRecievers = ";";
80
- Configuration.SenderEmail = ";";
81
- Configuration.SenderPassword = ";";
82
- return Configuration;
83
- }());
59
+ }
60
+ }
84
61
  exports.Configuration = Configuration;
@@ -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
- var promises_1 = require("node:fs/promises");
41
- function globalSetup(config) {
42
- return __awaiter(this, void 0, void 0, function () {
43
- var error_1;
44
- return __generator(this, function (_a) {
45
- switch (_a.label) {
46
- case 0:
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
- var sendEmail_1 = require("./sendEmail");
41
- function globalTearDown(config) {
42
- return __awaiter(this, void 0, void 0, function () {
43
- var sendEmail;
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;
@@ -5,9 +5,9 @@ exports.logVerification = logVerification;
5
5
  exports.logError = logError;
6
6
  exports.logConsole = logConsole;
7
7
  exports.logTestResult = logTestResult;
8
- var log4js = require('log4js');
9
- var dateTimeStamp = getCurrentDateTimeWithHHMM();
10
- var logFileName = './Logs/ExecutionLogs.log';
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
- var logger = log4js.getLogger('Logs');
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
- var now = new Date();
46
- var year = now.getFullYear();
47
- var month = String(now.getMonth() + 1).padStart(2, '0');
48
- var day = String(now.getDate()).padStart(2, '0');
49
- var hours = String(now.getHours()).padStart(2, '0');
50
- var minutes = String(now.getMinutes()).padStart(2, '0');
51
- var seconds = String(now.getSeconds()).padStart(2, '0');
52
- var formattedDateTime = "".concat(day, "_").concat(month, "_").concat(year, "_").concat(hours, "_").concat(minutes, "_").concat(seconds);
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
  }
@@ -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
- var configuration_core_1 = require("./configuration.core");
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
- var SendEmail = /** @class */ (function () {
46
- function SendEmail() {
47
- }
48
- SendEmail.prototype.SendExecutionResultReport = function () {
49
- return __awaiter(this, void 0, void 0, function () {
50
- var nodemailer, transporter, mailOptions, info, error_1;
51
- return __generator(this, function (_a) {
52
- switch (_a.label) {
53
- case 0:
54
- nodemailer = require('nodemailer');
55
- return [4 /*yield*/, nodemailer.createTransport({
56
- service: "gmail",
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
- return SendEmail;
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
- var WebControl = /** @class */ (function () {
9
- function WebControl(controlLocator, controlDescription) {
8
+ class WebControl {
9
+ controlLocator;
10
+ controlDescription;
11
+ constructor(controlLocator, controlDescription) {
10
12
  this.controlLocator = controlLocator;
11
13
  this.controlDescription = controlDescription;
12
14
  }
13
- return WebControl;
14
- }());
15
+ }
15
16
  exports.WebControl = WebControl;