@auxcode/auxta 1.3.45-beta.0 → 1.3.45-beta.2
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/build/cjs/AuxTA.d.ts +62 -0
- package/build/cjs/AuxTA.js +154 -0
- package/build/cjs/auxta/configs/config.d.ts +57 -0
- package/build/cjs/auxta/configs/config.js +69 -0
- package/build/cjs/auxta/enums/status-of.step.d.ts +7 -0
- package/build/cjs/auxta/enums/status-of.step.js +11 -0
- package/build/cjs/auxta/helpers/response.helper.d.ts +10 -0
- package/build/cjs/auxta/helpers/response.helper.js +15 -0
- package/build/cjs/auxta/helpers/start.helper.d.ts +1 -0
- package/build/cjs/auxta/helpers/start.helper.js +26 -0
- package/build/cjs/auxta/hooks/report.hook.d.ts +14 -0
- package/build/cjs/auxta/hooks/report.hook.js +67 -0
- package/build/cjs/auxta/models/upload.model.d.ts +35 -0
- package/build/cjs/auxta/models/upload.model.js +82 -0
- package/build/cjs/auxta/services/log.service.d.ts +30 -0
- package/build/cjs/auxta/services/log.service.js +60 -0
- package/build/cjs/auxta/services/report.service.d.ts +30 -0
- package/build/cjs/auxta/services/report.service.js +168 -0
- package/build/cjs/auxta/services/runtime.service.d.ts +16 -0
- package/build/cjs/auxta/services/runtime.service.js +41 -0
- package/build/cjs/auxta/utilities/runtime.helper.d.ts +15 -0
- package/build/cjs/auxta/utilities/runtime.helper.js +19 -0
- package/build/cjs/auxta/utilities/screenshot.helper.d.ts +4 -0
- package/build/cjs/auxta/utilities/screenshot.helper.js +57 -0
- package/build/cjs/auxta/utilities/start-suite.helper.d.ts +17 -0
- package/build/cjs/auxta/utilities/start-suite.helper.js +31 -0
- package/build/cjs/macros/helpers/Aux2faAuth.d.ts +7 -0
- package/build/cjs/macros/helpers/Aux2faAuth.js +29 -0
- package/build/cjs/macros/helpers/AuxGoogleAuth.d.ts +17 -0
- package/build/cjs/macros/helpers/AuxGoogleAuth.js +104 -0
- package/build/cjs/macros/helpers/code.helper.d.ts +22 -0
- package/build/cjs/macros/helpers/code.helper.js +210 -0
- package/build/cjs/macros/helpers/emailHelper.d.ts +19 -0
- package/build/cjs/macros/helpers/emailHelper.js +177 -0
- package/build/cjs/macros/helpers/extend-default-page.d.ts +6 -0
- package/build/cjs/macros/helpers/extend-default-page.js +89 -0
- package/build/cjs/puppeteer/puppeteer.d.ts +25 -0
- package/build/cjs/puppeteer/puppeteer.js +210 -0
- package/build/esm/AuxTA.d.ts +62 -0
- package/build/esm/AuxTA.js +125 -0
- package/build/esm/auxta/configs/config.d.ts +57 -0
- package/build/esm/auxta/configs/config.js +64 -0
- package/build/esm/auxta/enums/status-of.step.d.ts +7 -0
- package/build/esm/auxta/enums/status-of.step.js +8 -0
- package/build/esm/auxta/helpers/response.helper.d.ts +10 -0
- package/build/esm/auxta/helpers/response.helper.js +11 -0
- package/build/esm/auxta/helpers/start.helper.d.ts +1 -0
- package/build/esm/auxta/helpers/start.helper.js +24 -0
- package/build/esm/auxta/hooks/report.hook.d.ts +14 -0
- package/build/esm/auxta/hooks/report.hook.js +59 -0
- package/build/esm/auxta/models/upload.model.d.ts +35 -0
- package/build/esm/auxta/models/upload.model.js +78 -0
- package/build/esm/auxta/services/log.service.d.ts +30 -0
- package/build/esm/auxta/services/log.service.js +56 -0
- package/build/esm/auxta/services/report.service.d.ts +30 -0
- package/build/esm/auxta/services/report.service.js +154 -0
- package/build/esm/auxta/services/runtime.service.d.ts +16 -0
- package/build/esm/auxta/services/runtime.service.js +37 -0
- package/build/esm/auxta/utilities/runtime.helper.d.ts +15 -0
- package/build/esm/auxta/utilities/runtime.helper.js +15 -0
- package/build/esm/auxta/utilities/screenshot.helper.d.ts +4 -0
- package/build/esm/auxta/utilities/screenshot.helper.js +49 -0
- package/build/esm/auxta/utilities/start-suite.helper.d.ts +17 -0
- package/build/esm/auxta/utilities/start-suite.helper.js +26 -0
- package/build/esm/macros/helpers/Aux2faAuth.d.ts +7 -0
- package/build/esm/macros/helpers/Aux2faAuth.js +25 -0
- package/build/esm/macros/helpers/AuxGoogleAuth.d.ts +17 -0
- package/build/esm/macros/helpers/AuxGoogleAuth.js +100 -0
- package/build/esm/macros/helpers/code.helper.d.ts +22 -0
- package/build/esm/macros/helpers/code.helper.js +203 -0
- package/build/esm/macros/helpers/emailHelper.d.ts +19 -0
- package/build/esm/macros/helpers/emailHelper.js +170 -0
- package/build/esm/macros/helpers/extend-default-page.d.ts +6 -0
- package/build/esm/macros/helpers/extend-default-page.js +82 -0
- package/build/esm/puppeteer/puppeteer.d.ts +25 -0
- package/build/esm/puppeteer/puppeteer.js +202 -0
- package/build/tsconfig-cjs.tsbuildinfo +1 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogSteps = void 0;
|
|
4
|
+
const status_of_step_1 = require("../enums/status-of.step");
|
|
5
|
+
class LogSteps {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.stepLog = [];
|
|
8
|
+
this.lastStepTime = new Date().getTime();
|
|
9
|
+
this.statusCounter = {
|
|
10
|
+
[status_of_step_1.StatusOfStep.PASSED]: 0,
|
|
11
|
+
[status_of_step_1.StatusOfStep.FAILED]: 0,
|
|
12
|
+
[status_of_step_1.StatusOfStep.SKIPPED]: 0,
|
|
13
|
+
[status_of_step_1.StatusOfStep.SUGGESTION]: 0,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
addSuggestion(text) {
|
|
17
|
+
this.statusCounter[status_of_step_1.StatusOfStep.SUGGESTION]++;
|
|
18
|
+
this.stepLog.push({
|
|
19
|
+
keyword: 'Suggestion', name: text, result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
clear() {
|
|
23
|
+
this.stepLog = [];
|
|
24
|
+
this.statusCounter = {
|
|
25
|
+
[status_of_step_1.StatusOfStep.PASSED]: 0,
|
|
26
|
+
[status_of_step_1.StatusOfStep.FAILED]: 0,
|
|
27
|
+
[status_of_step_1.StatusOfStep.SKIPPED]: 0,
|
|
28
|
+
[status_of_step_1.StatusOfStep.SUGGESTION]: 0,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
push(keyword, name, status, screenshot = '') {
|
|
32
|
+
console.log(`System log -- status: ${status} -- : ${name} `);
|
|
33
|
+
this.statusCounter[status]++;
|
|
34
|
+
const currentStep = new Date().getTime();
|
|
35
|
+
if (screenshot != '') {
|
|
36
|
+
const embedding = {
|
|
37
|
+
data: screenshot,
|
|
38
|
+
mime_type: "image/png"
|
|
39
|
+
};
|
|
40
|
+
this.stepLog.push({
|
|
41
|
+
keyword,
|
|
42
|
+
name,
|
|
43
|
+
result: { status, duration: currentStep - this.lastStepTime, embedding: embedding }
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.stepLog.push({ keyword, name, result: { status, duration: currentStep - this.lastStepTime } });
|
|
48
|
+
}
|
|
49
|
+
this.lastStepTime = currentStep;
|
|
50
|
+
}
|
|
51
|
+
returnScenarioReport() {
|
|
52
|
+
return this.stepLog;
|
|
53
|
+
}
|
|
54
|
+
getStatusCount(status) {
|
|
55
|
+
return this.statusCounter[status];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.LogSteps = LogSteps;
|
|
59
|
+
const log = new LogSteps();
|
|
60
|
+
exports.default = log;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Step } from "./log.service";
|
|
3
|
+
import { UploadModel } from "../models/upload.model";
|
|
4
|
+
export interface Scenarios {
|
|
5
|
+
scenarioId: string;
|
|
6
|
+
scenarioName: string;
|
|
7
|
+
scenarioUri: string;
|
|
8
|
+
status: string;
|
|
9
|
+
scenariosCount: number;
|
|
10
|
+
lastFiveStepsHash: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Steps {
|
|
13
|
+
failedSteps: number;
|
|
14
|
+
passedSteps: number;
|
|
15
|
+
skippedSteps: number;
|
|
16
|
+
suggestedSteps: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function createEmptyReport(body: any): Promise<string>;
|
|
19
|
+
export declare function uploadStep(stepLog: Step[], scenarioName: string, screenshot?: Buffer, errMessage?: object): Promise<{
|
|
20
|
+
scenarioRef: any;
|
|
21
|
+
name: any;
|
|
22
|
+
status: any;
|
|
23
|
+
stepsCount: any;
|
|
24
|
+
}[]>;
|
|
25
|
+
export declare function uploadScenario(stepRes: any[], scenarioName: string, uri: string, hasFailed: boolean): Promise<any>;
|
|
26
|
+
export declare function updateReport(reportId: string, scenario: Scenarios, steps: Steps, isFinal: boolean): Promise<void>;
|
|
27
|
+
export declare function getReport(reportId: string): Promise<any>;
|
|
28
|
+
export declare function getLastDayResults(): Promise<any>;
|
|
29
|
+
export declare function postNotifications(body: UploadModel): Promise<void>;
|
|
30
|
+
export declare function postNotificationsOnFail(body: UploadModel): Promise<void>;
|
|
@@ -0,0 +1,168 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.postNotificationsOnFail = exports.postNotifications = exports.getLastDayResults = exports.getReport = exports.updateReport = exports.uploadScenario = exports.uploadStep = exports.createEmptyReport = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const config_1 = require("../configs/config");
|
|
18
|
+
function headers(token) {
|
|
19
|
+
return {
|
|
20
|
+
headers: {
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
'cookie': `authToken=${token}`
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function auth() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return axios_1.default.post(config_1.config.auxtaURL + 'login', config_1.config.auxtaCredentials, {
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
.then(({ data }) => {
|
|
34
|
+
return data.token;
|
|
35
|
+
})
|
|
36
|
+
.catch(() => {
|
|
37
|
+
throw new Error("Invalid login credentials");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function createEmptyReport(body) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const token = yield auth();
|
|
44
|
+
return (yield axios_1.default.post(config_1.config.auxtaURL + "create-empty-report", {
|
|
45
|
+
environment: body.environment,
|
|
46
|
+
digitalProductToken: body.digitalProduct,
|
|
47
|
+
bucket: body.bucket,
|
|
48
|
+
start: new Date(),
|
|
49
|
+
url: body.baseUrl
|
|
50
|
+
}, headers(token))).data.reportId;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.createEmptyReport = createEmptyReport;
|
|
54
|
+
function uploadStep(stepLog, scenarioName, screenshot, errMessage) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
let scenarios = [];
|
|
57
|
+
let token = yield auth();
|
|
58
|
+
let lastStep = stepLog[stepLog.length - 1];
|
|
59
|
+
const stepLogFormat = JSON.parse(JSON.stringify(stepLog));
|
|
60
|
+
stepLogFormat.pop();
|
|
61
|
+
let output = (yield axios_1.default.post(config_1.config.auxtaURL + "create-steps", {
|
|
62
|
+
json: {
|
|
63
|
+
name: scenarioName,
|
|
64
|
+
steps: [
|
|
65
|
+
...stepLogFormat,
|
|
66
|
+
(lastStep.result.status == 'failed')
|
|
67
|
+
? Object.assign(lastStep, {
|
|
68
|
+
result: Object.assign(Object.assign({}, lastStep.result), { error_message: JSON.stringify(errMessage) })
|
|
69
|
+
})
|
|
70
|
+
: lastStep,
|
|
71
|
+
{
|
|
72
|
+
keyword: "After",
|
|
73
|
+
result: {
|
|
74
|
+
status: "passed",
|
|
75
|
+
duration: 2678000000
|
|
76
|
+
},
|
|
77
|
+
embeddings: (screenshot) ? [{
|
|
78
|
+
data: screenshot.toString("base64"),
|
|
79
|
+
mime_type: "image/png"
|
|
80
|
+
}] : undefined,
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
}
|
|
84
|
+
}, headers(token))).data.scenarios;
|
|
85
|
+
scenarios.push({
|
|
86
|
+
scenarioRef: output.scenarioRef,
|
|
87
|
+
name: output.name,
|
|
88
|
+
status: output.status,
|
|
89
|
+
stepsCount: output.stepsCount
|
|
90
|
+
});
|
|
91
|
+
return scenarios;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
exports.uploadStep = uploadStep;
|
|
95
|
+
function uploadScenario(stepRes, scenarioName, uri, hasFailed) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
let token = yield auth();
|
|
98
|
+
return (yield axios_1.default.post(config_1.config.auxtaURL + "create-feature", {
|
|
99
|
+
json: {
|
|
100
|
+
name: scenarioName,
|
|
101
|
+
uri: uri
|
|
102
|
+
},
|
|
103
|
+
scenarios: stepRes,
|
|
104
|
+
hasFailed: hasFailed
|
|
105
|
+
}, headers(token))).data;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
exports.uploadScenario = uploadScenario;
|
|
109
|
+
function updateReport(reportId, scenario, steps, isFinal) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
let token = yield auth();
|
|
112
|
+
yield axios_1.default.post(config_1.config.auxtaURL + "update-inprogress-report", {
|
|
113
|
+
reportId: reportId,
|
|
114
|
+
isFinal: isFinal,
|
|
115
|
+
data: Object.assign({ scenario: {
|
|
116
|
+
scenarioRef: scenario.scenarioId,
|
|
117
|
+
name: scenario.scenarioName,
|
|
118
|
+
uri: scenario.scenarioUri,
|
|
119
|
+
status: scenario.status,
|
|
120
|
+
scenariosCount: scenario.scenariosCount,
|
|
121
|
+
lastFiveStepsHash: scenario.lastFiveStepsHash
|
|
122
|
+
} }, steps)
|
|
123
|
+
}, headers(token));
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
exports.updateReport = updateReport;
|
|
127
|
+
function getReport(reportId) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
let token = yield auth();
|
|
130
|
+
return (yield axios_1.default.post(config_1.config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
exports.getReport = getReport;
|
|
134
|
+
function getLastDayResults() {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
let token = yield auth();
|
|
137
|
+
return (yield axios_1.default.get(config_1.config.auxtaURL + `get-last-day-results?url=${config_1.config.baseURL}`, headers(token))).data.results;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
exports.getLastDayResults = getLastDayResults;
|
|
141
|
+
function postNotifications(body) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
let token = yield auth();
|
|
144
|
+
yield axios_1.default.post(`${config_1.config.auxtaURL}post-notification-after-run-background`, {
|
|
145
|
+
environmentName: body.environment,
|
|
146
|
+
digitalProductToken: body.digitalProduct,
|
|
147
|
+
organizationName: body.organization,
|
|
148
|
+
bucketName: body.bucket,
|
|
149
|
+
reportId: body.reportId,
|
|
150
|
+
}, headers(token));
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
exports.postNotifications = postNotifications;
|
|
154
|
+
function postNotificationsOnFail(body) {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
let token = yield auth();
|
|
157
|
+
yield axios_1.default.post(`${config_1.config.auxtaURL}post-notifications-after-case-fail-background`, {
|
|
158
|
+
environmentName: body.environment,
|
|
159
|
+
digitalProductToken: body.digitalProduct,
|
|
160
|
+
organizationName: body.organization,
|
|
161
|
+
bucketName: body.bucket,
|
|
162
|
+
reportId: body.reportId,
|
|
163
|
+
featureName: body.featureName,
|
|
164
|
+
scenarioName: body.scenarioName
|
|
165
|
+
}, headers(token));
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
exports.postNotificationsOnFail = postNotificationsOnFail;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface RunTime {
|
|
2
|
+
duration: String;
|
|
3
|
+
startTime: Date;
|
|
4
|
+
endTime: Date;
|
|
5
|
+
}
|
|
6
|
+
export declare class Runtime {
|
|
7
|
+
private start;
|
|
8
|
+
private end;
|
|
9
|
+
private runtime;
|
|
10
|
+
constructor(s: Date, e: Date);
|
|
11
|
+
private calculateDuration;
|
|
12
|
+
private splitAtDecimanlMinutes;
|
|
13
|
+
private splitAtDecimanlHours;
|
|
14
|
+
private formatRuntime;
|
|
15
|
+
returnRuntime(): RunTime;
|
|
16
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Runtime = void 0;
|
|
4
|
+
class Runtime {
|
|
5
|
+
constructor(s, e) {
|
|
6
|
+
this.start = s;
|
|
7
|
+
this.end = e;
|
|
8
|
+
}
|
|
9
|
+
calculateDuration() {
|
|
10
|
+
let currentTime = new Date;
|
|
11
|
+
let duration = currentTime.getTime() - this.start.getTime();
|
|
12
|
+
return duration;
|
|
13
|
+
}
|
|
14
|
+
splitAtDecimanlMinutes(time) {
|
|
15
|
+
let minutes = time.toFixed(2).toString().split('.');
|
|
16
|
+
return `${minutes[0]}m ${(Number(minutes[1]) / 100 * 60).toFixed(0)}s`;
|
|
17
|
+
}
|
|
18
|
+
splitAtDecimanlHours(time) {
|
|
19
|
+
let hours = time.toFixed(2).toString().split('.');
|
|
20
|
+
let minutes = (Number(hours[1]) / 100 * 60).toFixed(2).toString().split('.');
|
|
21
|
+
return `${hours[0]}h ${minutes[0]}m ${(Number(minutes[1]) / 100 * 60).toFixed(0)}s`;
|
|
22
|
+
}
|
|
23
|
+
formatRuntime(duration) {
|
|
24
|
+
if (duration / 1000 < 60)
|
|
25
|
+
return `${(duration / 1000).toFixed(0)}s`;
|
|
26
|
+
else {
|
|
27
|
+
if (duration / 60000 < 60)
|
|
28
|
+
return this.splitAtDecimanlMinutes(duration / 60000);
|
|
29
|
+
else
|
|
30
|
+
return this.splitAtDecimanlHours(duration / 3600000);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
returnRuntime() {
|
|
34
|
+
let duration = this.formatRuntime(this.calculateDuration());
|
|
35
|
+
let startTime = this.start;
|
|
36
|
+
let endTime = this.end;
|
|
37
|
+
this.runtime = { duration, startTime, endTime };
|
|
38
|
+
return this.runtime;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.Runtime = Runtime;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RunTime } from "../services/runtime.service";
|
|
2
|
+
export declare class CalculateRuntime {
|
|
3
|
+
private runtime;
|
|
4
|
+
startTimeSeconds: string;
|
|
5
|
+
startTimeMinutes: string;
|
|
6
|
+
startTimeHours: string;
|
|
7
|
+
startTimeDay: string;
|
|
8
|
+
startTimeMonth: string;
|
|
9
|
+
endTimeSeconds: string;
|
|
10
|
+
endTimeMinutes: string;
|
|
11
|
+
endTimeHours: string;
|
|
12
|
+
endTimeDay: string;
|
|
13
|
+
endTimeMonth: string;
|
|
14
|
+
constructor(r: RunTime);
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CalculateRuntime = void 0;
|
|
4
|
+
class CalculateRuntime {
|
|
5
|
+
constructor(r) {
|
|
6
|
+
this.runtime = r;
|
|
7
|
+
this.startTimeSeconds = (this.runtime.startTime.getSeconds() < 10) ? `0${this.runtime.startTime.getSeconds()}` : `${this.runtime.startTime.getSeconds()}`;
|
|
8
|
+
this.startTimeMinutes = (this.runtime.startTime.getMinutes() < 10) ? `0${this.runtime.startTime.getMinutes()}` : `${this.runtime.startTime.getMinutes()}`;
|
|
9
|
+
this.startTimeHours = (this.runtime.startTime.getHours() < 10) ? `0${this.runtime.startTime.getHours()}` : `${this.runtime.startTime.getHours()}`;
|
|
10
|
+
this.startTimeDay = (this.runtime.startTime.getDate() < 10) ? `0${this.runtime.startTime.getDate()}` : `${this.runtime.startTime.getDate()}`;
|
|
11
|
+
this.startTimeMonth = (this.runtime.startTime.getMonth() + 1 < 10) ? `0${this.runtime.startTime.getMonth() + 1}` : `${this.runtime.startTime.getMonth() + 1}`;
|
|
12
|
+
this.endTimeSeconds = (this.runtime.endTime.getSeconds() < 10) ? `0${this.runtime.endTime.getSeconds()}` : `${this.runtime.endTime.getSeconds()}`;
|
|
13
|
+
this.endTimeMinutes = (this.runtime.endTime.getMinutes() < 10) ? `0${this.runtime.endTime.getMinutes()}` : `${this.runtime.endTime.getMinutes()}`;
|
|
14
|
+
this.endTimeHours = (this.runtime.endTime.getHours() < 10) ? `0${this.runtime.endTime.getHours()}` : `${this.runtime.endTime.getHours()}`;
|
|
15
|
+
this.endTimeDay = (this.runtime.endTime.getDate() < 10) ? `0${this.runtime.endTime.getDate()}` : `${this.runtime.endTime.getDate()}`;
|
|
16
|
+
this.endTimeMonth = (this.runtime.endTime.getMonth() + 1 < 10) ? `0${this.runtime.endTime.getMonth() + 1}` : `${this.runtime.endTime.getMonth() + 1}`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.CalculateRuntime = CalculateRuntime;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.captureScreenshotPage = exports.captureScreenshot = void 0;
|
|
16
|
+
const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
|
|
17
|
+
const log_service_1 = __importDefault(require("../services/log.service"));
|
|
18
|
+
const status_of_step_1 = __importDefault(require("../enums/status-of.step"));
|
|
19
|
+
function captureScreenshot() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const pages = yield puppeteer_1.default.defaultPage.browser().pages();
|
|
23
|
+
if (!pages.length)
|
|
24
|
+
return undefined;
|
|
25
|
+
const lastPage = pages[pages.length - 1] || puppeteer_1.default.defaultPage;
|
|
26
|
+
const screenshotBuffer = yield lastPage.screenshot({
|
|
27
|
+
fullPage: true,
|
|
28
|
+
encoding: 'binary'
|
|
29
|
+
});
|
|
30
|
+
if (Buffer.isBuffer(screenshotBuffer))
|
|
31
|
+
return screenshotBuffer;
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.captureScreenshot = captureScreenshot;
|
|
41
|
+
function captureScreenshotPage(page) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const screenshotBuffer = yield page.screenshot({
|
|
45
|
+
fullPage: true,
|
|
46
|
+
encoding: 'binary'
|
|
47
|
+
});
|
|
48
|
+
if (Buffer.isBuffer(screenshotBuffer))
|
|
49
|
+
return screenshotBuffer;
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
log_service_1.default.push('When', e.toString(), status_of_step_1.default.FAILED);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
exports.captureScreenshotPage = captureScreenshotPage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function startSuite(suites: string[], reportId?: string): Promise<{
|
|
2
|
+
nextSuites?: undefined;
|
|
3
|
+
reportId?: undefined;
|
|
4
|
+
currentSuite?: undefined;
|
|
5
|
+
retries?: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
nextSuites: string[];
|
|
8
|
+
reportId: string | undefined;
|
|
9
|
+
currentSuite: string | undefined;
|
|
10
|
+
retries: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function retrySuite(suites: string[], reportId: string, currentSuite: string, retries: number): Promise<false | {
|
|
13
|
+
nextSuites: string[];
|
|
14
|
+
reportId: string;
|
|
15
|
+
currentSuite: string;
|
|
16
|
+
retries: number;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.retrySuite = exports.startSuite = void 0;
|
|
13
|
+
function startSuite(suites, reportId) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
if (suites.length === 0)
|
|
16
|
+
return {};
|
|
17
|
+
const next = suites.shift();
|
|
18
|
+
return { nextSuites: suites, reportId: reportId, currentSuite: next, retries: "0" };
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.startSuite = startSuite;
|
|
22
|
+
function retrySuite(suites, reportId, currentSuite, retries) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
console.log('I repeat again the current suite: ' + currentSuite);
|
|
25
|
+
if (retries >= 2) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return { nextSuites: suites, reportId: reportId, currentSuite: currentSuite, retries: retries };
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.retrySuite = retrySuite;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Aux2faAuth = void 0;
|
|
4
|
+
const twofactor = require("node-2fa");
|
|
5
|
+
class Aux2faAuth {
|
|
6
|
+
authenticator() {
|
|
7
|
+
const aux2fe_secret = this.getSecret();
|
|
8
|
+
return twofactor.generateToken(aux2fe_secret).token;
|
|
9
|
+
}
|
|
10
|
+
verifyToken(token) {
|
|
11
|
+
const aux2fe_secret = this.getSecret();
|
|
12
|
+
const result = twofactor.verifyToken(aux2fe_secret, token);
|
|
13
|
+
if (result != null) {
|
|
14
|
+
if (result.delta == 0) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
getSecret() {
|
|
21
|
+
const aux2fe_secret = process.env.aux2fe_secret;
|
|
22
|
+
if (!aux2fe_secret) {
|
|
23
|
+
throw new Error('No 2fe secret set');
|
|
24
|
+
}
|
|
25
|
+
return aux2fe_secret;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Aux2faAuth = Aux2faAuth;
|
|
29
|
+
exports.default = new Aux2faAuth();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import googleType = require("googleapis");
|
|
2
|
+
export declare class AuxGoogleAuth {
|
|
3
|
+
private static _oAuth2Client;
|
|
4
|
+
private static credentialsJson;
|
|
5
|
+
static get oAuth2Client(): googleType.Auth.OAuth2Client;
|
|
6
|
+
static get googleClient(): googleType.GoogleApis;
|
|
7
|
+
static get gmailClient(): googleType.gmail_v1.Gmail;
|
|
8
|
+
static setup(): Promise<void>;
|
|
9
|
+
private static authorize;
|
|
10
|
+
private static getNewToken;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: AuxGoogleAuth;
|
|
13
|
+
export default _default;
|
|
14
|
+
export interface currentUser {
|
|
15
|
+
name: string;
|
|
16
|
+
email: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AuxGoogleAuth = void 0;
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const readline = require('readline');
|
|
15
|
+
const { google } = require("googleapis");
|
|
16
|
+
const SCOPES = [
|
|
17
|
+
'https://www.googleapis.com/auth/gmail.addons.current.action.compose',
|
|
18
|
+
'https://www.googleapis.com/auth/gmail.addons.current.message.action',
|
|
19
|
+
'https://www.googleapis.com/auth/gmail.labels',
|
|
20
|
+
'https://www.googleapis.com/auth/gmail.addons.current.message.metadata',
|
|
21
|
+
'https://www.googleapis.com/auth/gmail.addons.current.message.readonly',
|
|
22
|
+
'https://www.googleapis.com/auth/gmail.send',
|
|
23
|
+
'https://mail.google.com/',
|
|
24
|
+
'https://www.googleapis.com/auth/gmail.modify',
|
|
25
|
+
'https://www.googleapis.com/auth/gmail.compose',
|
|
26
|
+
'https://www.googleapis.com/auth/gmail.readonly',
|
|
27
|
+
'https://www.googleapis.com/auth/gmail.insert',
|
|
28
|
+
];
|
|
29
|
+
const TOKEN_PATH = 'token.json';
|
|
30
|
+
class AuxGoogleAuth {
|
|
31
|
+
static get oAuth2Client() {
|
|
32
|
+
return this._oAuth2Client;
|
|
33
|
+
}
|
|
34
|
+
static get googleClient() {
|
|
35
|
+
return google;
|
|
36
|
+
}
|
|
37
|
+
static get gmailClient() {
|
|
38
|
+
return google.gmail({ version: 'v1', auth: this._oAuth2Client });
|
|
39
|
+
}
|
|
40
|
+
static setup() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
yield this.authorize(this.credentialsJson);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
static authorize(credentials) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const { client_secret, client_id, redirect_uris } = credentials.installed;
|
|
48
|
+
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
|
|
49
|
+
try {
|
|
50
|
+
let token = fs.readFileSync(TOKEN_PATH);
|
|
51
|
+
if (token.length > 0 && token !== undefined) {
|
|
52
|
+
oAuth2Client.setCredentials(JSON.parse(token));
|
|
53
|
+
this._oAuth2Client = oAuth2Client;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
yield this.getNewToken(oAuth2Client);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
yield this.getNewToken(oAuth2Client);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
static getNewToken(oAuth2Client) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const authUrl = oAuth2Client.generateAuthUrl({
|
|
66
|
+
access_type: 'offline',
|
|
67
|
+
prompt: 'consent',
|
|
68
|
+
scope: SCOPES,
|
|
69
|
+
});
|
|
70
|
+
console.log('Authorize this app by visiting this url:', authUrl);
|
|
71
|
+
const rl = readline.createInterface({
|
|
72
|
+
input: process.stdin,
|
|
73
|
+
output: process.stdout,
|
|
74
|
+
});
|
|
75
|
+
rl.question('Enter the code from that page here: ', (code) => {
|
|
76
|
+
rl.close();
|
|
77
|
+
oAuth2Client.getToken(code, (err, token) => {
|
|
78
|
+
if (err)
|
|
79
|
+
return console.error('Error retrieving access token', err);
|
|
80
|
+
oAuth2Client.setCredentials(token);
|
|
81
|
+
fs.writeFile(TOKEN_PATH, JSON.stringify(token), (err) => {
|
|
82
|
+
if (err)
|
|
83
|
+
return console.error(err);
|
|
84
|
+
console.log('Token stored to', TOKEN_PATH);
|
|
85
|
+
});
|
|
86
|
+
this._oAuth2Client = oAuth2Client;
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.AuxGoogleAuth = AuxGoogleAuth;
|
|
93
|
+
AuxGoogleAuth.credentialsJson = {
|
|
94
|
+
"installed": {
|
|
95
|
+
"client_id": "120362272213-usevfijf76jj5nsr502i2lai6nu71oq8.apps.googleusercontent.com",
|
|
96
|
+
"project_id": "auxta-library",
|
|
97
|
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
98
|
+
"token_uri": "https://oauth2.googleapis.com/token",
|
|
99
|
+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
100
|
+
"client_secret": "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",
|
|
101
|
+
"redirect_uris": ["https://auxcode.com"]
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
exports.default = new AuxGoogleAuth();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StatusOfStep } from "../../auxta/enums/status-of.step";
|
|
2
|
+
import { ExtendDefaultPage } from "./extend-default-page";
|
|
3
|
+
export declare class FunctionHelper extends ExtendDefaultPage {
|
|
4
|
+
log(keyword: string, name: string, status: StatusOfStep, screenshot?: string): void;
|
|
5
|
+
screenshot(page?: import("puppeteer").Page): Promise<string | undefined>;
|
|
6
|
+
suggest(name: string): void;
|
|
7
|
+
private getEscapedText;
|
|
8
|
+
clickByText(selector: string, text: string, dotOrText?: string, options?: {}, page?: import("puppeteer").Page, time?: number, log_message?: boolean): Promise<void>;
|
|
9
|
+
clickByTextWithClass(class_selector: string, class_name: string, selector: string, text: string, dotOrText?: string, page?: import("puppeteer").Page): Promise<void>;
|
|
10
|
+
waitForSelectorWithText(selector: string, text: string, dotOrText?: string, page?: import("puppeteer").Page): Promise<boolean>;
|
|
11
|
+
timeout(timeout?: number, page?: import("puppeteer").Page): Promise<void>;
|
|
12
|
+
waitForSelector(option: string, selector: string, time?: number, page?: import("puppeteer").Page, log_message?: boolean): Promise<void>;
|
|
13
|
+
urlContains(selector: string, page?: import("puppeteer").Page): Promise<void>;
|
|
14
|
+
pressEnter(page?: import("puppeteer").Page): Promise<void>;
|
|
15
|
+
emulate(phone_name: string, page?: import("puppeteer").Page): Promise<void>;
|
|
16
|
+
restartBrowser(): Promise<void>;
|
|
17
|
+
clickAndWaitForPageToBeCreated(selector: string, page?: import("puppeteer").Page): Promise<void>;
|
|
18
|
+
closeLastPage(page?: import("puppeteer").Page): Promise<void>;
|
|
19
|
+
microsoftLogin(button: string, email: string, password: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
declare const _default: FunctionHelper;
|
|
22
|
+
export default _default;
|