@auxcode/auxta 1.3.51-beta.17 → 1.3.51-beta.19
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 +7 -5
- package/build/esm/AuxTA.d.ts +0 -62
- package/build/esm/AuxTA.js +0 -125
- package/build/esm/auxta/configs/config.d.ts +0 -57
- package/build/esm/auxta/configs/config.js +0 -64
- package/build/esm/auxta/enums/status-of.step.d.ts +0 -7
- package/build/esm/auxta/enums/status-of.step.js +0 -8
- package/build/esm/auxta/helpers/response.helper.d.ts +0 -10
- package/build/esm/auxta/helpers/response.helper.js +0 -11
- package/build/esm/auxta/helpers/start.helper.d.ts +0 -1
- package/build/esm/auxta/helpers/start.helper.js +0 -24
- package/build/esm/auxta/hooks/report.hook.d.ts +0 -14
- package/build/esm/auxta/hooks/report.hook.js +0 -59
- package/build/esm/auxta/models/upload.model.d.ts +0 -35
- package/build/esm/auxta/models/upload.model.js +0 -78
- package/build/esm/auxta/services/log.service.d.ts +0 -31
- package/build/esm/auxta/services/log.service.js +0 -57
- package/build/esm/auxta/services/report.service.d.ts +0 -31
- package/build/esm/auxta/services/report.service.js +0 -168
- package/build/esm/auxta/services/runtime.service.d.ts +0 -16
- package/build/esm/auxta/services/runtime.service.js +0 -37
- package/build/esm/auxta/utilities/runtime.helper.d.ts +0 -15
- package/build/esm/auxta/utilities/runtime.helper.js +0 -15
- package/build/esm/auxta/utilities/screenshot.helper.d.ts +0 -4
- package/build/esm/auxta/utilities/screenshot.helper.js +0 -51
- package/build/esm/auxta/utilities/start-suite.helper.d.ts +0 -17
- package/build/esm/auxta/utilities/start-suite.helper.js +0 -26
- package/build/esm/macros/helpers/Aux2faAuth.d.ts +0 -7
- package/build/esm/macros/helpers/Aux2faAuth.js +0 -25
- package/build/esm/macros/helpers/AuxGoogleAuth.d.ts +0 -22
- package/build/esm/macros/helpers/AuxGoogleAuth.js +0 -184
- package/build/esm/macros/helpers/code.helper.d.ts +0 -23
- package/build/esm/macros/helpers/code.helper.js +0 -218
- package/build/esm/macros/helpers/emailHelper.d.ts +0 -19
- package/build/esm/macros/helpers/emailHelper.js +0 -170
- package/build/esm/macros/helpers/extend-default-page.d.ts +0 -6
- package/build/esm/macros/helpers/extend-default-page.js +0 -82
- package/build/esm/puppeteer/puppeteer.d.ts +0 -25
- package/build/esm/puppeteer/puppeteer.js +0 -205
- package/build/tsconfig-cjs.tsbuildinfo +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
- /package/build/{cjs/AuxTA.d.ts → AuxTA.d.ts} +0 -0
- /package/build/{cjs/AuxTA.js → AuxTA.js} +0 -0
- /package/build/{cjs/auxta → auxta}/configs/config.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/configs/config.js +0 -0
- /package/build/{cjs/auxta → auxta}/enums/status-of.step.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/enums/status-of.step.js +0 -0
- /package/build/{cjs/auxta → auxta}/helpers/response.helper.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/helpers/response.helper.js +0 -0
- /package/build/{cjs/auxta → auxta}/helpers/start.helper.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/helpers/start.helper.js +0 -0
- /package/build/{cjs/auxta → auxta}/hooks/report.hook.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/hooks/report.hook.js +0 -0
- /package/build/{cjs/auxta → auxta}/models/upload.model.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/models/upload.model.js +0 -0
- /package/build/{cjs/auxta → auxta}/services/log.service.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/services/log.service.js +0 -0
- /package/build/{cjs/auxta → auxta}/services/report.service.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/services/report.service.js +0 -0
- /package/build/{cjs/auxta → auxta}/services/runtime.service.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/services/runtime.service.js +0 -0
- /package/build/{cjs/auxta → auxta}/utilities/runtime.helper.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/utilities/runtime.helper.js +0 -0
- /package/build/{cjs/auxta → auxta}/utilities/screenshot.helper.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/utilities/screenshot.helper.js +0 -0
- /package/build/{cjs/auxta → auxta}/utilities/start-suite.helper.d.ts +0 -0
- /package/build/{cjs/auxta → auxta}/utilities/start-suite.helper.js +0 -0
- /package/build/{cjs/macros → macros}/helpers/Aux2faAuth.d.ts +0 -0
- /package/build/{cjs/macros → macros}/helpers/Aux2faAuth.js +0 -0
- /package/build/{cjs/macros → macros}/helpers/AuxGoogleAuth.d.ts +0 -0
- /package/build/{cjs/macros → macros}/helpers/AuxGoogleAuth.js +0 -0
- /package/build/{cjs/macros → macros}/helpers/code.helper.d.ts +0 -0
- /package/build/{cjs/macros → macros}/helpers/code.helper.js +0 -0
- /package/build/{cjs/macros → macros}/helpers/emailHelper.d.ts +0 -0
- /package/build/{cjs/macros → macros}/helpers/emailHelper.js +0 -0
- /package/build/{cjs/macros → macros}/helpers/extend-default-page.d.ts +0 -0
- /package/build/{cjs/macros → macros}/helpers/extend-default-page.js +0 -0
- /package/build/{cjs/puppeteer → puppeteer}/puppeteer.d.ts +0 -0
- /package/build/{cjs/puppeteer → puppeteer}/puppeteer.js +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { StatusOfStep } from "../enums/status-of.step";
|
|
2
|
-
export class LogSteps {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.stepLog = [];
|
|
5
|
-
this.lastStepTime = new Date().getTime();
|
|
6
|
-
this.statusCounter = {
|
|
7
|
-
[StatusOfStep.PASSED]: 0,
|
|
8
|
-
[StatusOfStep.FAILED]: 0,
|
|
9
|
-
[StatusOfStep.SKIPPED]: 0,
|
|
10
|
-
[StatusOfStep.SUGGESTION]: 0,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
addSuggestion(text) {
|
|
14
|
-
this.statusCounter[StatusOfStep.SUGGESTION]++;
|
|
15
|
-
this.stepLog.push({
|
|
16
|
-
keyword: 'Suggestion', name: text, imageCompareKey: '', result: { status: StatusOfStep.SUGGESTION, duration: 0 }
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
clear() {
|
|
20
|
-
this.stepLog = [];
|
|
21
|
-
this.statusCounter = {
|
|
22
|
-
[StatusOfStep.PASSED]: 0,
|
|
23
|
-
[StatusOfStep.FAILED]: 0,
|
|
24
|
-
[StatusOfStep.SKIPPED]: 0,
|
|
25
|
-
[StatusOfStep.SUGGESTION]: 0,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
push(keyword, name, status, screenshot = '', imageCompareKey = '') {
|
|
29
|
-
console.log(`System log -- status: ${status} -- : ${name} `);
|
|
30
|
-
this.statusCounter[status]++;
|
|
31
|
-
const currentStep = new Date().getTime();
|
|
32
|
-
if (screenshot != '') {
|
|
33
|
-
const embedding = {
|
|
34
|
-
data: screenshot,
|
|
35
|
-
mime_type: "image/png"
|
|
36
|
-
};
|
|
37
|
-
this.stepLog.push({
|
|
38
|
-
keyword,
|
|
39
|
-
name,
|
|
40
|
-
imageCompareKey,
|
|
41
|
-
result: { status, duration: currentStep - this.lastStepTime, embedding: embedding }
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
this.stepLog.push({ keyword, name, imageCompareKey, result: { status, duration: currentStep - this.lastStepTime } });
|
|
46
|
-
}
|
|
47
|
-
this.lastStepTime = currentStep;
|
|
48
|
-
}
|
|
49
|
-
returnScenarioReport() {
|
|
50
|
-
return this.stepLog;
|
|
51
|
-
}
|
|
52
|
-
getStatusCount(status) {
|
|
53
|
-
return this.statusCounter[status];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const log = new LogSteps();
|
|
57
|
-
export default log;
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
stepRef: 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 compareScreenshots(key: string, screenshot: string): Promise<any>;
|
|
30
|
-
export declare function postNotifications(body: UploadModel): Promise<void>;
|
|
31
|
-
export declare function postNotificationsOnFail(body: UploadModel): Promise<void>;
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import axios from "axios";
|
|
11
|
-
import { config } from "../configs/config";
|
|
12
|
-
function headers(token) {
|
|
13
|
-
return {
|
|
14
|
-
headers: {
|
|
15
|
-
'Content-Type': 'application/json',
|
|
16
|
-
'cookie': `authToken=${token}`
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function auth() {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
return axios.post(config.auxtaURL + 'login', config.auxtaCredentials, {
|
|
23
|
-
headers: {
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
.then(({ data }) => {
|
|
28
|
-
return data.token;
|
|
29
|
-
})
|
|
30
|
-
.catch(() => {
|
|
31
|
-
throw new Error("Invalid login credentials");
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export function createEmptyReport(body) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const token = yield auth();
|
|
38
|
-
return (yield axios.post(config.auxtaURL + "create-empty-report", {
|
|
39
|
-
environment: body.environment,
|
|
40
|
-
digitalProductToken: body.digitalProduct,
|
|
41
|
-
bucket: body.bucket,
|
|
42
|
-
start: new Date(),
|
|
43
|
-
url: body.baseUrl
|
|
44
|
-
}, headers(token))).data.reportId;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
export function uploadStep(stepLog, scenarioName, screenshot, errMessage) {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
let scenarios = [];
|
|
50
|
-
let token = yield auth();
|
|
51
|
-
let lastStep = stepLog[stepLog.length - 1];
|
|
52
|
-
const stepLogFormat = JSON.parse(JSON.stringify(stepLog));
|
|
53
|
-
stepLogFormat.pop();
|
|
54
|
-
let output = (yield axios.post(config.auxtaURL + "create-steps", {
|
|
55
|
-
json: {
|
|
56
|
-
name: scenarioName,
|
|
57
|
-
steps: [
|
|
58
|
-
...stepLogFormat,
|
|
59
|
-
(lastStep.result.status == 'failed')
|
|
60
|
-
? Object.assign(lastStep, {
|
|
61
|
-
result: Object.assign(Object.assign({}, lastStep.result), { error_message: JSON.stringify(errMessage) })
|
|
62
|
-
})
|
|
63
|
-
: lastStep,
|
|
64
|
-
{
|
|
65
|
-
keyword: "After",
|
|
66
|
-
result: {
|
|
67
|
-
status: "passed",
|
|
68
|
-
duration: 2678000000
|
|
69
|
-
},
|
|
70
|
-
embeddings: (screenshot) ? [{
|
|
71
|
-
data: screenshot.toString("base64"),
|
|
72
|
-
mime_type: "image/png"
|
|
73
|
-
}] : undefined,
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
}
|
|
77
|
-
}, headers(token))).data.scenarios;
|
|
78
|
-
scenarios.push({
|
|
79
|
-
stepRef: output.stepRef,
|
|
80
|
-
name: output.name,
|
|
81
|
-
status: output.status,
|
|
82
|
-
stepsCount: output.stepsCount
|
|
83
|
-
});
|
|
84
|
-
return scenarios;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
export function uploadScenario(stepRes, scenarioName, uri, hasFailed) {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
let token = yield auth();
|
|
90
|
-
return (yield axios.post(config.auxtaURL + "create-scenario", {
|
|
91
|
-
json: {
|
|
92
|
-
name: scenarioName,
|
|
93
|
-
uri: uri
|
|
94
|
-
},
|
|
95
|
-
scenarios: stepRes,
|
|
96
|
-
hasFailed: hasFailed
|
|
97
|
-
}, headers(token))).data;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
export function updateReport(reportId, scenario, steps, isFinal) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
let token = yield auth();
|
|
103
|
-
yield axios.post(config.auxtaURL + "update-inprogress-report", {
|
|
104
|
-
reportId: reportId,
|
|
105
|
-
isFinal: isFinal,
|
|
106
|
-
data: Object.assign({ scenario: {
|
|
107
|
-
scenarioRef: scenario.scenarioId,
|
|
108
|
-
name: scenario.scenarioName,
|
|
109
|
-
uri: scenario.scenarioUri,
|
|
110
|
-
status: scenario.status,
|
|
111
|
-
scenariosCount: scenario.scenariosCount,
|
|
112
|
-
lastFiveStepsHash: scenario.lastFiveStepsHash
|
|
113
|
-
} }, steps)
|
|
114
|
-
}, headers(token));
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
export function getReport(reportId) {
|
|
118
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
let token = yield auth();
|
|
120
|
-
return (yield axios.post(config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
export function getLastDayResults() {
|
|
124
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
let token = yield auth();
|
|
126
|
-
return (yield axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
export function compareScreenshots(key, screenshot) {
|
|
130
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
let token = yield auth();
|
|
132
|
-
const embedding = {
|
|
133
|
-
data: screenshot,
|
|
134
|
-
mime_type: "image/png"
|
|
135
|
-
};
|
|
136
|
-
return yield axios.post(`${config.auxtaURL}save-compared-screenshot`, {
|
|
137
|
-
organization: config.organization,
|
|
138
|
-
key: key,
|
|
139
|
-
embedding: embedding,
|
|
140
|
-
}, headers(token));
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
export function postNotifications(body) {
|
|
144
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
-
let token = yield auth();
|
|
146
|
-
yield axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
|
|
147
|
-
environmentName: body.environment,
|
|
148
|
-
digitalProductToken: body.digitalProduct,
|
|
149
|
-
organizationName: body.organization,
|
|
150
|
-
bucketName: body.bucket,
|
|
151
|
-
reportId: body.reportId,
|
|
152
|
-
}, headers(token));
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
export function postNotificationsOnFail(body) {
|
|
156
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
let token = yield auth();
|
|
158
|
-
yield axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
|
|
159
|
-
environmentName: body.environment,
|
|
160
|
-
digitalProductToken: body.digitalProduct,
|
|
161
|
-
organizationName: body.organization,
|
|
162
|
-
bucketName: body.bucket,
|
|
163
|
-
reportId: body.reportId,
|
|
164
|
-
featureName: body.featureName,
|
|
165
|
-
scenarioName: body.scenarioName
|
|
166
|
-
}, headers(token));
|
|
167
|
-
});
|
|
168
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export class Runtime {
|
|
2
|
-
constructor(s, e) {
|
|
3
|
-
this.start = s;
|
|
4
|
-
this.end = e;
|
|
5
|
-
}
|
|
6
|
-
calculateDuration() {
|
|
7
|
-
let currentTime = new Date;
|
|
8
|
-
let duration = currentTime.getTime() - this.start.getTime();
|
|
9
|
-
return duration;
|
|
10
|
-
}
|
|
11
|
-
splitAtDecimanlMinutes(time) {
|
|
12
|
-
let minutes = time.toFixed(2).toString().split('.');
|
|
13
|
-
return `${minutes[0]}m ${(Number(minutes[1]) / 100 * 60).toFixed(0)}s`;
|
|
14
|
-
}
|
|
15
|
-
splitAtDecimanlHours(time) {
|
|
16
|
-
let hours = time.toFixed(2).toString().split('.');
|
|
17
|
-
let minutes = (Number(hours[1]) / 100 * 60).toFixed(2).toString().split('.');
|
|
18
|
-
return `${hours[0]}h ${minutes[0]}m ${(Number(minutes[1]) / 100 * 60).toFixed(0)}s`;
|
|
19
|
-
}
|
|
20
|
-
formatRuntime(duration) {
|
|
21
|
-
if (duration / 1000 < 60)
|
|
22
|
-
return `${(duration / 1000).toFixed(0)}s`;
|
|
23
|
-
else {
|
|
24
|
-
if (duration / 60000 < 60)
|
|
25
|
-
return this.splitAtDecimanlMinutes(duration / 60000);
|
|
26
|
-
else
|
|
27
|
-
return this.splitAtDecimanlHours(duration / 3600000);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
returnRuntime() {
|
|
31
|
-
let duration = this.formatRuntime(this.calculateDuration());
|
|
32
|
-
let startTime = this.start;
|
|
33
|
-
let endTime = this.end;
|
|
34
|
-
this.runtime = { duration, startTime, endTime };
|
|
35
|
-
return this.runtime;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export class CalculateRuntime {
|
|
2
|
-
constructor(r) {
|
|
3
|
-
this.runtime = r;
|
|
4
|
-
this.startTimeSeconds = (this.runtime.startTime.getSeconds() < 10) ? `0${this.runtime.startTime.getSeconds()}` : `${this.runtime.startTime.getSeconds()}`;
|
|
5
|
-
this.startTimeMinutes = (this.runtime.startTime.getMinutes() < 10) ? `0${this.runtime.startTime.getMinutes()}` : `${this.runtime.startTime.getMinutes()}`;
|
|
6
|
-
this.startTimeHours = (this.runtime.startTime.getHours() < 10) ? `0${this.runtime.startTime.getHours()}` : `${this.runtime.startTime.getHours()}`;
|
|
7
|
-
this.startTimeDay = (this.runtime.startTime.getDate() < 10) ? `0${this.runtime.startTime.getDate()}` : `${this.runtime.startTime.getDate()}`;
|
|
8
|
-
this.startTimeMonth = (this.runtime.startTime.getMonth() + 1 < 10) ? `0${this.runtime.startTime.getMonth() + 1}` : `${this.runtime.startTime.getMonth() + 1}`;
|
|
9
|
-
this.endTimeSeconds = (this.runtime.endTime.getSeconds() < 10) ? `0${this.runtime.endTime.getSeconds()}` : `${this.runtime.endTime.getSeconds()}`;
|
|
10
|
-
this.endTimeMinutes = (this.runtime.endTime.getMinutes() < 10) ? `0${this.runtime.endTime.getMinutes()}` : `${this.runtime.endTime.getMinutes()}`;
|
|
11
|
-
this.endTimeHours = (this.runtime.endTime.getHours() < 10) ? `0${this.runtime.endTime.getHours()}` : `${this.runtime.endTime.getHours()}`;
|
|
12
|
-
this.endTimeDay = (this.runtime.endTime.getDate() < 10) ? `0${this.runtime.endTime.getDate()}` : `${this.runtime.endTime.getDate()}`;
|
|
13
|
-
this.endTimeMonth = (this.runtime.endTime.getMonth() + 1 < 10) ? `0${this.runtime.endTime.getMonth() + 1}` : `${this.runtime.endTime.getMonth() + 1}`;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import puppeteer from "../../puppeteer/puppeteer";
|
|
11
|
-
import log from "../services/log.service";
|
|
12
|
-
import StatusOfStep from "../enums/status-of.step";
|
|
13
|
-
export function captureScreenshot() {
|
|
14
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
try {
|
|
16
|
-
const pages = yield puppeteer.defaultPage.browser().pages();
|
|
17
|
-
if (!pages.length)
|
|
18
|
-
return undefined;
|
|
19
|
-
const lastPage = pages[pages.length - 1] || puppeteer.defaultPage;
|
|
20
|
-
const screenshotBuffer = yield lastPage.screenshot({
|
|
21
|
-
fullPage: true,
|
|
22
|
-
captureBeyondViewport: false,
|
|
23
|
-
encoding: 'binary'
|
|
24
|
-
});
|
|
25
|
-
if (Buffer.isBuffer(screenshotBuffer))
|
|
26
|
-
return screenshotBuffer;
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
log.push('When', e.toString(), StatusOfStep.FAILED);
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
return undefined;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export function captureScreenshotPage(page) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
try {
|
|
38
|
-
const screenshotBuffer = yield page.screenshot({
|
|
39
|
-
fullPage: true,
|
|
40
|
-
captureBeyondViewport: false,
|
|
41
|
-
encoding: 'binary'
|
|
42
|
-
});
|
|
43
|
-
if (Buffer.isBuffer(screenshotBuffer))
|
|
44
|
-
return screenshotBuffer;
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
log.push('When', e.toString(), StatusOfStep.FAILED);
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export function startSuite(suites, reportId) {
|
|
11
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
12
|
-
if (suites.length === 0)
|
|
13
|
-
return {};
|
|
14
|
-
const next = suites.shift();
|
|
15
|
-
return { nextSuites: suites, reportId: reportId, currentSuite: next, retries: "0" };
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export function retrySuite(suites, reportId, currentSuite, retries) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
console.log('I repeat again the current suite: ' + currentSuite);
|
|
21
|
-
if (retries >= 2) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
return { nextSuites: suites, reportId: reportId, currentSuite: currentSuite, retries: retries };
|
|
25
|
-
});
|
|
26
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const twofactor = require("node-2fa");
|
|
2
|
-
export class Aux2faAuth {
|
|
3
|
-
authenticator() {
|
|
4
|
-
const aux2fe_secret = this.getSecret();
|
|
5
|
-
return twofactor.generateToken(aux2fe_secret).token;
|
|
6
|
-
}
|
|
7
|
-
verifyToken(token) {
|
|
8
|
-
const aux2fe_secret = this.getSecret();
|
|
9
|
-
const result = twofactor.verifyToken(aux2fe_secret, token);
|
|
10
|
-
if (result != null) {
|
|
11
|
-
if (result.delta == 0) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
getSecret() {
|
|
18
|
-
const aux2fe_secret = process.env.aux2fe_secret;
|
|
19
|
-
if (!aux2fe_secret) {
|
|
20
|
-
throw new Error('No 2fe secret set');
|
|
21
|
-
}
|
|
22
|
-
return aux2fe_secret;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export default new Aux2faAuth();
|
|
@@ -1,22 +0,0 @@
|
|
|
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 setupBrowser(): Promise<void>;
|
|
9
|
-
static setEmailPassword(email: string, password: string): Promise<void>;
|
|
10
|
-
static setupHeadless(): Promise<void>;
|
|
11
|
-
private static authorize;
|
|
12
|
-
private static authorizeHeadless;
|
|
13
|
-
private static getNewToken;
|
|
14
|
-
private static getNewTokenHeadless;
|
|
15
|
-
private static LogIn;
|
|
16
|
-
}
|
|
17
|
-
declare const _default: AuxGoogleAuth;
|
|
18
|
-
export default _default;
|
|
19
|
-
export interface currentUser {
|
|
20
|
-
name: string;
|
|
21
|
-
email: string;
|
|
22
|
-
}
|