@auxcode/auxta 1.3.38 → 1.3.40-beta.0
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 -62
- package/build/cjs/AuxTA.js +154 -154
- package/build/cjs/auxta/configs/config.d.ts +57 -57
- package/build/cjs/auxta/configs/config.js +69 -69
- package/build/cjs/auxta/enums/status-of.step.d.ts +7 -7
- package/build/cjs/auxta/enums/status-of.step.js +11 -11
- package/build/cjs/auxta/helpers/response.helper.d.ts +10 -10
- package/build/cjs/auxta/helpers/response.helper.js +15 -15
- package/build/cjs/auxta/helpers/start.helper.d.ts +1 -1
- package/build/cjs/auxta/helpers/start.helper.js +26 -26
- package/build/cjs/auxta/hooks/report.hook.d.ts +14 -14
- package/build/cjs/auxta/hooks/report.hook.js +66 -66
- package/build/cjs/auxta/models/upload.model.d.ts +35 -35
- package/build/cjs/auxta/models/upload.model.js +82 -82
- package/build/cjs/auxta/services/log.service.d.ts +26 -26
- package/build/cjs/auxta/services/log.service.js +47 -47
- package/build/cjs/auxta/services/report.service.d.ts +36 -36
- package/build/cjs/auxta/services/report.service.js +167 -167
- package/build/cjs/auxta/services/runtime.service.d.ts +16 -16
- package/build/cjs/auxta/services/runtime.service.js +41 -41
- package/build/cjs/auxta/utilities/runtime.helper.d.ts +15 -15
- package/build/cjs/auxta/utilities/runtime.helper.js +19 -19
- package/build/cjs/auxta/utilities/screenshot.helper.d.ts +2 -2
- package/build/cjs/auxta/utilities/screenshot.helper.js +40 -40
- package/build/cjs/auxta/utilities/start-suite.helper.d.ts +17 -17
- package/build/cjs/auxta/utilities/start-suite.helper.js +31 -31
- package/build/cjs/macros/helpers/Aux2faAuth.d.ts +7 -7
- package/build/cjs/macros/helpers/Aux2faAuth.js +29 -29
- package/build/cjs/macros/helpers/AuxGoogleAuth.d.ts +17 -17
- package/build/cjs/macros/helpers/AuxGoogleAuth.js +104 -104
- package/build/cjs/macros/helpers/code.helper.d.ts +21 -21
- package/build/cjs/macros/helpers/code.helper.js +201 -201
- package/build/cjs/macros/helpers/emailHelper.d.ts +19 -19
- package/build/cjs/macros/helpers/emailHelper.js +177 -177
- package/build/cjs/macros/helpers/extend-default-page.d.ts +6 -6
- package/build/cjs/macros/helpers/extend-default-page.js +89 -89
- package/build/cjs/puppeteer/puppeteer.d.ts +25 -25
- package/build/cjs/puppeteer/puppeteer.js +209 -208
- package/build/esm/AuxTA.d.ts +62 -62
- package/build/esm/AuxTA.js +125 -125
- package/build/esm/auxta/configs/config.d.ts +57 -57
- package/build/esm/auxta/configs/config.js +64 -64
- package/build/esm/auxta/enums/status-of.step.d.ts +7 -7
- package/build/esm/auxta/enums/status-of.step.js +8 -8
- package/build/esm/auxta/helpers/response.helper.d.ts +10 -10
- package/build/esm/auxta/helpers/response.helper.js +11 -11
- package/build/esm/auxta/helpers/start.helper.d.ts +1 -1
- package/build/esm/auxta/helpers/start.helper.js +24 -24
- package/build/esm/auxta/hooks/report.hook.d.ts +14 -14
- package/build/esm/auxta/hooks/report.hook.js +58 -58
- package/build/esm/auxta/models/upload.model.d.ts +35 -35
- package/build/esm/auxta/models/upload.model.js +78 -78
- package/build/esm/auxta/services/log.service.d.ts +26 -26
- package/build/esm/auxta/services/log.service.js +43 -43
- package/build/esm/auxta/services/report.service.d.ts +36 -36
- package/build/esm/auxta/services/report.service.js +153 -153
- package/build/esm/auxta/services/runtime.service.d.ts +16 -16
- package/build/esm/auxta/services/runtime.service.js +37 -37
- package/build/esm/auxta/utilities/runtime.helper.d.ts +15 -15
- package/build/esm/auxta/utilities/runtime.helper.js +15 -15
- package/build/esm/auxta/utilities/screenshot.helper.d.ts +2 -2
- package/build/esm/auxta/utilities/screenshot.helper.js +33 -33
- package/build/esm/auxta/utilities/start-suite.helper.d.ts +17 -17
- package/build/esm/auxta/utilities/start-suite.helper.js +26 -26
- package/build/esm/macros/helpers/Aux2faAuth.d.ts +7 -7
- package/build/esm/macros/helpers/Aux2faAuth.js +25 -25
- package/build/esm/macros/helpers/AuxGoogleAuth.d.ts +17 -17
- package/build/esm/macros/helpers/AuxGoogleAuth.js +100 -100
- package/build/esm/macros/helpers/code.helper.d.ts +21 -21
- package/build/esm/macros/helpers/code.helper.js +194 -194
- package/build/esm/macros/helpers/emailHelper.d.ts +19 -19
- package/build/esm/macros/helpers/emailHelper.js +170 -170
- package/build/esm/macros/helpers/extend-default-page.d.ts +6 -6
- package/build/esm/macros/helpers/extend-default-page.js +82 -82
- package/build/esm/puppeteer/puppeteer.d.ts +25 -25
- package/build/esm/puppeteer/puppeteer.js +201 -200
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,153 +1,153 @@
|
|
|
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 uploadScenario(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-scenario", {
|
|
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
|
-
scenarioRef: output.scenarioRef,
|
|
80
|
-
name: output.name,
|
|
81
|
-
status: output.status,
|
|
82
|
-
stepsCount: output.stepsCount
|
|
83
|
-
});
|
|
84
|
-
return scenarios;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
export function uploadFeature(scenarioId, 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-feature", {
|
|
91
|
-
json: {
|
|
92
|
-
name: scenarioName,
|
|
93
|
-
uri: uri
|
|
94
|
-
},
|
|
95
|
-
scenarios: scenarioId,
|
|
96
|
-
hasFailed: hasFailed
|
|
97
|
-
}, headers(token))).data;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
export function updateReport(reportId, feature, 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({ feature: {
|
|
107
|
-
featureRef: feature.featureId,
|
|
108
|
-
name: feature.featureName,
|
|
109
|
-
uri: feature.featureUri,
|
|
110
|
-
status: feature.status,
|
|
111
|
-
scenariosCount: feature.scenariosCount
|
|
112
|
-
} }, steps)
|
|
113
|
-
}, headers(token));
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
export function getReport(reportId) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
let token = yield auth();
|
|
119
|
-
return (yield axios.post(config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
export function getLastDayResults() {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
let token = yield auth();
|
|
125
|
-
return (yield axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
export function postNotifications(body) {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
let token = yield auth();
|
|
131
|
-
yield axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
|
|
132
|
-
environmentName: body.environment,
|
|
133
|
-
digitalProductToken: body.digitalProduct,
|
|
134
|
-
organizationName: body.organization,
|
|
135
|
-
bucketName: body.bucket,
|
|
136
|
-
reportId: body.reportId,
|
|
137
|
-
}, headers(token));
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
export function postNotificationsOnFail(body) {
|
|
141
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
-
let token = yield auth();
|
|
143
|
-
yield axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
|
|
144
|
-
environmentName: body.environment,
|
|
145
|
-
digitalProductToken: body.digitalProduct,
|
|
146
|
-
organizationName: body.organization,
|
|
147
|
-
bucketName: body.bucket,
|
|
148
|
-
reportId: body.reportId,
|
|
149
|
-
featureName: body.featureName,
|
|
150
|
-
scenarioName: body.scenarioName
|
|
151
|
-
}, headers(token));
|
|
152
|
-
});
|
|
153
|
-
}
|
|
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 uploadScenario(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-scenario", {
|
|
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
|
+
scenarioRef: output.scenarioRef,
|
|
80
|
+
name: output.name,
|
|
81
|
+
status: output.status,
|
|
82
|
+
stepsCount: output.stepsCount
|
|
83
|
+
});
|
|
84
|
+
return scenarios;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function uploadFeature(scenarioId, 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-feature", {
|
|
91
|
+
json: {
|
|
92
|
+
name: scenarioName,
|
|
93
|
+
uri: uri
|
|
94
|
+
},
|
|
95
|
+
scenarios: scenarioId,
|
|
96
|
+
hasFailed: hasFailed
|
|
97
|
+
}, headers(token))).data;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export function updateReport(reportId, feature, 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({ feature: {
|
|
107
|
+
featureRef: feature.featureId,
|
|
108
|
+
name: feature.featureName,
|
|
109
|
+
uri: feature.featureUri,
|
|
110
|
+
status: feature.status,
|
|
111
|
+
scenariosCount: feature.scenariosCount
|
|
112
|
+
} }, steps)
|
|
113
|
+
}, headers(token));
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function getReport(reportId) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
let token = yield auth();
|
|
119
|
+
return (yield axios.post(config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
export function getLastDayResults() {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
let token = yield auth();
|
|
125
|
+
return (yield axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export function postNotifications(body) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
let token = yield auth();
|
|
131
|
+
yield axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
|
|
132
|
+
environmentName: body.environment,
|
|
133
|
+
digitalProductToken: body.digitalProduct,
|
|
134
|
+
organizationName: body.organization,
|
|
135
|
+
bucketName: body.bucket,
|
|
136
|
+
reportId: body.reportId,
|
|
137
|
+
}, headers(token));
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
export function postNotificationsOnFail(body) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
let token = yield auth();
|
|
143
|
+
yield axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
|
|
144
|
+
environmentName: body.environment,
|
|
145
|
+
digitalProductToken: body.digitalProduct,
|
|
146
|
+
organizationName: body.organization,
|
|
147
|
+
bucketName: body.bucket,
|
|
148
|
+
reportId: body.reportId,
|
|
149
|
+
featureName: body.featureName,
|
|
150
|
+
scenarioName: body.scenarioName
|
|
151
|
+
}, headers(token));
|
|
152
|
+
});
|
|
153
|
+
}
|
|
@@ -1,16 +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
|
-
}
|
|
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 +1,37 @@
|
|
|
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
|
+
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 +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
|
-
}
|
|
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 +1,15 @@
|
|
|
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
|
+
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,2 +1,2 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare function captureScreenshot(): Promise<Buffer | undefined>;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare function captureScreenshot(): Promise<Buffer | undefined>;
|
|
@@ -1,33 +1,33 @@
|
|
|
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
|
-
encoding: 'binary'
|
|
23
|
-
});
|
|
24
|
-
if (Buffer.isBuffer(screenshotBuffer))
|
|
25
|
-
return screenshotBuffer;
|
|
26
|
-
}
|
|
27
|
-
catch (e) {
|
|
28
|
-
log.push('When', e.toString(), StatusOfStep.FAILED);
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
return undefined;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
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
|
+
encoding: 'binary'
|
|
23
|
+
});
|
|
24
|
+
if (Buffer.isBuffer(screenshotBuffer))
|
|
25
|
+
return screenshotBuffer;
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
log.push('When', e.toString(), StatusOfStep.FAILED);
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -1,17 +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
|
-
}>;
|
|
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 +1,26 @@
|
|
|
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
|
+
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
|
+
}
|