playwright-ts-automationframework 1.0.3 → 1.0.6
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/package.json +2 -2
- package/lib/core/actions.core.d.ts +0 -323
- package/lib/core/actions.core.js +0 -829
- package/lib/core/assertion.core.d.ts +0 -224
- package/lib/core/assertion.core.js +0 -706
- package/lib/core/basePage.core.d.ts +0 -17
- package/lib/core/basePage.core.js +0 -88
- package/lib/core/configuration.core.d.ts +0 -16
- package/lib/core/configuration.core.js +0 -83
- package/lib/core/global.setup.d.ts +0 -3
- package/lib/core/global.setup.js +0 -61
- package/lib/core/global.tearDown.d.ts +0 -3
- package/lib/core/global.tearDown.js +0 -57
- package/lib/core/logs.core.d.ts +0 -5
- package/lib/core/logs.core.js +0 -55
- package/lib/core/sendEmail.d.ts +0 -7
- package/lib/core/sendEmail.js +0 -102
- package/lib/core/webControl.core.d.ts +0 -10
- package/lib/core/webControl.core.js +0 -15
- package/lib/index.d.ts +0 -8
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Page, TestInfo } from '@playwright/test';
|
|
2
|
-
/**
|
|
3
|
-
* Browser Initilization
|
|
4
|
-
* @author Ketan Pardeshi
|
|
5
|
-
* */
|
|
6
|
-
export declare class BasePage {
|
|
7
|
-
protected page: Page;
|
|
8
|
-
constructor(page: Page);
|
|
9
|
-
/**
|
|
10
|
-
* This will Initilize browser and open URL as per
|
|
11
|
-
* given environment(ExecutionSettings.json)
|
|
12
|
-
* and URL provided in AppConfigurations.json
|
|
13
|
-
*/
|
|
14
|
-
initializeBrowser(url?: string): Promise<void>;
|
|
15
|
-
static setTestCaseID(testInfo: TestInfo, testCaseID?: number): void;
|
|
16
|
-
static executionCompleted(testinfo: TestInfo): void;
|
|
17
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
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;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.BasePage = void 0;
|
|
40
|
-
var logs_core_1 = require("./logs.core");
|
|
41
|
-
var configuration_core_1 = require("./configuration.core");
|
|
42
|
-
/**
|
|
43
|
-
* Browser Initilization
|
|
44
|
-
* @author Ketan Pardeshi
|
|
45
|
-
* */
|
|
46
|
-
var BasePage = /** @class */ (function () {
|
|
47
|
-
function BasePage(page) {
|
|
48
|
-
this.page = page;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* This will Initilize browser and open URL as per
|
|
52
|
-
* given environment(ExecutionSettings.json)
|
|
53
|
-
* and URL provided in AppConfigurations.json
|
|
54
|
-
*/
|
|
55
|
-
BasePage.prototype.initializeBrowser = function (url) {
|
|
56
|
-
if (url === void 0) { url = configuration_core_1.Configuration.get("URL"); }
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
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: 20000
|
|
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
|
-
});
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
BasePage.setTestCaseID = function (testInfo, testCaseID) {
|
|
74
|
-
if (testCaseID === void 0) { testCaseID = 0; }
|
|
75
|
-
testInfo.testId = testCaseID.toString();
|
|
76
|
-
(0, logs_core_1.logTestResult)('');
|
|
77
|
-
(0, logs_core_1.logTestResult)("===== START Of Execution For TestCase ID: " + testCaseID + " Title: '" + testInfo.title + "' ======");
|
|
78
|
-
(0, logs_core_1.logTestResult)('');
|
|
79
|
-
};
|
|
80
|
-
BasePage.executionCompleted = function (testinfo) {
|
|
81
|
-
var _a;
|
|
82
|
-
(0, logs_core_1.logTestResult)('');
|
|
83
|
-
(0, logs_core_1.logTestResult)("===== END Of Execution For Test Case: '" + testinfo.title + "' With Test Result: '" + ((_a = testinfo.status) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + "' =====");
|
|
84
|
-
(0, logs_core_1.logTestResult)('');
|
|
85
|
-
};
|
|
86
|
-
return BasePage;
|
|
87
|
-
}());
|
|
88
|
-
exports.BasePage = BasePage;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class to initilize all variables required for execution
|
|
3
|
-
* @author Ketan Pardeshi
|
|
4
|
-
* */
|
|
5
|
-
export declare class Configuration {
|
|
6
|
-
static Environment: string;
|
|
7
|
-
static EmailRecievers: string;
|
|
8
|
-
static SenderEmail: string;
|
|
9
|
-
static SenderPassword: string;
|
|
10
|
-
static get environment(): any;
|
|
11
|
-
static get emailRecievers(): any;
|
|
12
|
-
static get senderEmail(): any;
|
|
13
|
-
static get senderPassword(): any;
|
|
14
|
-
static get configurationData(): JSON;
|
|
15
|
-
static get(key: string): any;
|
|
16
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Configuration = void 0;
|
|
4
|
-
var automationSettings = require('../../../../ExecutionSettings.json');
|
|
5
|
-
var appConfigurations = require('../../../../AppConfigurations.json');
|
|
6
|
-
/**
|
|
7
|
-
* Class to initilize all variables required for execution
|
|
8
|
-
* @author Ketan Pardeshi
|
|
9
|
-
* */
|
|
10
|
-
var Configuration = /** @class */ (function () {
|
|
11
|
-
function Configuration() {
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(Configuration, "environment", {
|
|
14
|
-
get: function () {
|
|
15
|
-
if (!automationSettings.environment.includes("#{environment}#")) {
|
|
16
|
-
return automationSettings.environment;
|
|
17
|
-
}
|
|
18
|
-
return Configuration.Environment;
|
|
19
|
-
},
|
|
20
|
-
enumerable: false,
|
|
21
|
-
configurable: true
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(Configuration, "emailRecievers", {
|
|
24
|
-
get: function () {
|
|
25
|
-
if (!automationSettings.emailRecievers.includes("#{emailRecievers}#")) {
|
|
26
|
-
return automationSettings.emailRecievers;
|
|
27
|
-
}
|
|
28
|
-
return Configuration.EmailRecievers;
|
|
29
|
-
},
|
|
30
|
-
enumerable: false,
|
|
31
|
-
configurable: true
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(Configuration, "senderEmail", {
|
|
34
|
-
get: function () {
|
|
35
|
-
if (!automationSettings.senderEmail.includes("#{senderEmail}#")) {
|
|
36
|
-
return automationSettings.senderEmail;
|
|
37
|
-
}
|
|
38
|
-
return "";
|
|
39
|
-
},
|
|
40
|
-
enumerable: false,
|
|
41
|
-
configurable: true
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(Configuration, "senderPassword", {
|
|
44
|
-
get: function () {
|
|
45
|
-
if (!automationSettings.senderPassword.includes("#{senderPassword}#")) {
|
|
46
|
-
return automationSettings.senderPassword;
|
|
47
|
-
}
|
|
48
|
-
return "";
|
|
49
|
-
},
|
|
50
|
-
enumerable: false,
|
|
51
|
-
configurable: true
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(Configuration, "configurationData", {
|
|
54
|
-
get: function () {
|
|
55
|
-
if (Configuration.environment.toUpperCase() == "QA") {
|
|
56
|
-
return appConfigurations.QA;
|
|
57
|
-
}
|
|
58
|
-
else if (Configuration.environment.toUpperCase() == "STAGE") {
|
|
59
|
-
return appConfigurations.STAGE;
|
|
60
|
-
}
|
|
61
|
-
else if (Configuration.environment.toUpperCase() == "PROD") {
|
|
62
|
-
return appConfigurations.PROD;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
return appConfigurations.QA;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
enumerable: false,
|
|
69
|
-
configurable: true
|
|
70
|
-
});
|
|
71
|
-
Configuration.get = function (key) {
|
|
72
|
-
var jsonData = Configuration.configurationData;
|
|
73
|
-
var jsonString = JSON.stringify(jsonData);
|
|
74
|
-
var value = JSON.parse(jsonString)[key];
|
|
75
|
-
return value;
|
|
76
|
-
};
|
|
77
|
-
Configuration.Environment = "QA";
|
|
78
|
-
Configuration.EmailRecievers = ";";
|
|
79
|
-
Configuration.SenderEmail = ";";
|
|
80
|
-
Configuration.SenderPassword = ";";
|
|
81
|
-
return Configuration;
|
|
82
|
-
}());
|
|
83
|
-
exports.Configuration = Configuration;
|
package/lib/core/global.setup.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.globalSetup = void 0;
|
|
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
|
-
});
|
|
59
|
-
}
|
|
60
|
-
exports.globalSetup = globalSetup;
|
|
61
|
-
exports.default = globalSetup;
|
|
@@ -1,57 +0,0 @@
|
|
|
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;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.globalTearDown = void 0;
|
|
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
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.globalTearDown = globalTearDown;
|
|
57
|
-
exports.default = globalTearDown;
|
package/lib/core/logs.core.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function logAction(message: string): void;
|
|
2
|
-
export declare function logVerification(message: string): void;
|
|
3
|
-
export declare function errorLog(message: string): void;
|
|
4
|
-
export declare function consoleLog(message: string): void;
|
|
5
|
-
export declare function logTestResult(message: string): void;
|
package/lib/core/logs.core.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logTestResult = exports.consoleLog = exports.errorLog = exports.logVerification = exports.logAction = void 0;
|
|
4
|
-
var log4js = require('log4js');
|
|
5
|
-
var dateTimeStamp = getCurrentDateTimeWithHHMM();
|
|
6
|
-
var logFileName = './Logs/ExecutionLogs.log';
|
|
7
|
-
log4js.configure({
|
|
8
|
-
appenders: {
|
|
9
|
-
Logs: {
|
|
10
|
-
type: 'file',
|
|
11
|
-
filename: logFileName,
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"layout": {
|
|
15
|
-
"type": "pattern",
|
|
16
|
-
"pattern": "[%d{yyyy-MM-dd hh:mm:ss}] [%p] %c - %m%n"
|
|
17
|
-
},
|
|
18
|
-
categories: { default: { appenders: ['Logs'], level: 'info' } }
|
|
19
|
-
});
|
|
20
|
-
var logger = log4js.getLogger('Logs');
|
|
21
|
-
function logAction(message) {
|
|
22
|
-
console.log("ACTION: " + message);
|
|
23
|
-
logger.info("ACTION: " + message);
|
|
24
|
-
}
|
|
25
|
-
exports.logAction = logAction;
|
|
26
|
-
function logVerification(message) {
|
|
27
|
-
console.log(message);
|
|
28
|
-
logger.info(message);
|
|
29
|
-
}
|
|
30
|
-
exports.logVerification = logVerification;
|
|
31
|
-
function errorLog(message) {
|
|
32
|
-
console.log('ERROR: ' + message);
|
|
33
|
-
logger.error('ERROR: ' + message);
|
|
34
|
-
}
|
|
35
|
-
exports.errorLog = errorLog;
|
|
36
|
-
function consoleLog(message) {
|
|
37
|
-
console.log("INFO: " + message);
|
|
38
|
-
}
|
|
39
|
-
exports.consoleLog = consoleLog;
|
|
40
|
-
function logTestResult(message) {
|
|
41
|
-
console.log(message);
|
|
42
|
-
logger.info(message);
|
|
43
|
-
}
|
|
44
|
-
exports.logTestResult = logTestResult;
|
|
45
|
-
function getCurrentDateTimeWithHHMM() {
|
|
46
|
-
var now = new Date();
|
|
47
|
-
var year = now.getFullYear();
|
|
48
|
-
var month = String(now.getMonth() + 1).padStart(2, '0');
|
|
49
|
-
var day = String(now.getDate()).padStart(2, '0');
|
|
50
|
-
var hours = String(now.getHours()).padStart(2, '0');
|
|
51
|
-
var minutes = String(now.getMinutes()).padStart(2, '0');
|
|
52
|
-
var seconds = String(now.getSeconds()).padStart(2, '0');
|
|
53
|
-
var formattedDateTime = "".concat(day, "_").concat(month, "_").concat(year, "_").concat(hours, "_").concat(minutes, "_").concat(seconds);
|
|
54
|
-
return formattedDateTime;
|
|
55
|
-
}
|
package/lib/core/sendEmail.d.ts
DELETED
package/lib/core/sendEmail.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
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;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.SendEmail = void 0;
|
|
40
|
-
var configuration_core_1 = require("./configuration.core");
|
|
41
|
-
/**
|
|
42
|
-
* Send Execution email to stakeholders
|
|
43
|
-
* @author Ketan Pardeshi
|
|
44
|
-
* */
|
|
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
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
return SendEmail;
|
|
101
|
-
}());
|
|
102
|
-
exports.SendEmail = SendEmail;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Locator } from "@playwright/test";
|
|
2
|
-
/**
|
|
3
|
-
* Playwright Locator Object wrapped object
|
|
4
|
-
* @author Ketan Pardeshi
|
|
5
|
-
* */
|
|
6
|
-
export declare class WebControl {
|
|
7
|
-
controlLocator: Locator;
|
|
8
|
-
controlDescription: string;
|
|
9
|
-
constructor(controlLocator: Locator, controlDescription: string);
|
|
10
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebControl = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Playwright Locator Object wrapped object
|
|
6
|
-
* @author Ketan Pardeshi
|
|
7
|
-
* */
|
|
8
|
-
var WebControl = /** @class */ (function () {
|
|
9
|
-
function WebControl(controlLocator, controlDescription) {
|
|
10
|
-
this.controlLocator = controlLocator;
|
|
11
|
-
this.controlDescription = controlDescription;
|
|
12
|
-
}
|
|
13
|
-
return WebControl;
|
|
14
|
-
}());
|
|
15
|
-
exports.WebControl = WebControl;
|
package/lib/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { BasePage } from './core/basePage.core';
|
|
2
|
-
export { Assertion } from './core/assertion.core';
|
|
3
|
-
export { Actions } from './core/actions.core';
|
|
4
|
-
export { WebControl } from './core/webControl.core';
|
|
5
|
-
export { Configuration } from './core/configuration.core';
|
|
6
|
-
export { globalSetup } from './core/global.setup';
|
|
7
|
-
export { globalTearDown } from './core/global.tearDown';
|
|
8
|
-
export { logAction, logVerification, errorLog, consoleLog, logTestResult } from './core/logs.core';
|