@auxcode/auxta 0.5.7 → 0.5.8
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/AuxTA.d.ts +43 -0
- package/build/AuxTA.js +112 -0
- package/build/auxta/configs/config.d.ts +51 -0
- package/build/auxta/configs/config.js +61 -0
- package/build/auxta/enums/status-of.step.d.ts +7 -0
- package/build/auxta/enums/status-of.step.js +8 -0
- package/build/auxta/helpers/response.helper.d.ts +10 -0
- package/build/auxta/helpers/response.helper.js +11 -0
- package/build/auxta/helpers/start.helper.d.ts +1 -0
- package/build/auxta/helpers/start.helper.js +24 -0
- package/build/auxta/hooks/report.hook.d.ts +4 -0
- package/build/auxta/hooks/report.hook.js +58 -0
- package/build/auxta/models/upload.model.d.ts +20 -0
- package/build/auxta/models/upload.model.js +43 -0
- package/build/auxta/services/log.service.d.ts +26 -0
- package/build/auxta/services/log.service.js +43 -0
- package/build/auxta/services/report.service.d.ts +36 -0
- package/build/auxta/services/report.service.js +148 -0
- package/build/auxta/services/runtime.service.d.ts +16 -0
- package/build/auxta/services/runtime.service.js +37 -0
- package/build/auxta/utilities/runtime.helper.d.ts +15 -0
- package/build/auxta/utilities/runtime.helper.js +15 -0
- package/build/auxta/utilities/screenshot.helper.d.ts +2 -0
- package/build/auxta/utilities/screenshot.helper.js +29 -0
- package/build/auxta/utilities/start-suite.helper.d.ts +1 -0
- package/build/auxta/utilities/start-suite.helper.js +25 -0
- package/build/cjs/AuxTA.js +38 -23
- package/build/cjs/auxta/helpers/start.helper.js +12 -3
- package/build/cjs/auxta/hooks/report.hook.js +50 -37
- package/build/cjs/auxta/services/report.service.js +126 -105
- package/build/cjs/auxta/utilities/screenshot.helper.js +27 -16
- package/build/cjs/auxta/utilities/start-suite.helper.js +22 -11
- package/build/cjs/macros/helpers/code.helper.js +164 -129
- package/build/cjs/puppeteer/puppeteer.js +117 -100
- package/build/macros/helpers/code.helper.d.ts +22 -0
- package/build/macros/helpers/code.helper.js +193 -0
- package/build/puppeteer/puppeteer.d.ts +13 -0
- package/build/puppeteer/puppeteer.js +153 -0
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
digitalProductName: body.digitalProduct,
|
|
41
|
+
start: new Date(),
|
|
42
|
+
url: body.baseUrl
|
|
43
|
+
}, headers(token))).data.reportId;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function uploadScenario(stepLog, scenarioName, screenshot, errMessage) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
let scenarios = [];
|
|
49
|
+
let token = yield auth();
|
|
50
|
+
let lastStep = stepLog[stepLog.length - 1];
|
|
51
|
+
const stepLogFormat = JSON.parse(JSON.stringify(stepLog));
|
|
52
|
+
stepLogFormat.pop();
|
|
53
|
+
let output = (yield axios.post(config.auxtaURL + "create-scenario", {
|
|
54
|
+
json: {
|
|
55
|
+
name: scenarioName,
|
|
56
|
+
steps: [
|
|
57
|
+
...stepLogFormat,
|
|
58
|
+
(lastStep.result.status == 'failed')
|
|
59
|
+
? Object.assign(lastStep, {
|
|
60
|
+
result: Object.assign(Object.assign({}, lastStep.result), { error_message: JSON.stringify(errMessage) })
|
|
61
|
+
})
|
|
62
|
+
: lastStep,
|
|
63
|
+
{
|
|
64
|
+
keyword: "After",
|
|
65
|
+
result: {
|
|
66
|
+
status: "passed",
|
|
67
|
+
duration: 2678000000
|
|
68
|
+
},
|
|
69
|
+
embeddings: (screenshot) ? [{
|
|
70
|
+
data: screenshot.toString("base64"),
|
|
71
|
+
mime_type: "image/png"
|
|
72
|
+
}] : undefined,
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
}
|
|
76
|
+
}, headers(token))).data.scenarios;
|
|
77
|
+
scenarios.push({
|
|
78
|
+
scenarioRef: output.scenarioRef,
|
|
79
|
+
name: output.name,
|
|
80
|
+
status: output.status,
|
|
81
|
+
stepsCount: output.stepsCount
|
|
82
|
+
});
|
|
83
|
+
return scenarios;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export function uploadFeature(scenarioId, scenarioName, uri, hasFailed) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
let token = yield auth();
|
|
89
|
+
return (yield axios.post(config.auxtaURL + "create-feature", {
|
|
90
|
+
json: {
|
|
91
|
+
name: scenarioName,
|
|
92
|
+
uri: uri
|
|
93
|
+
},
|
|
94
|
+
scenarios: scenarioId,
|
|
95
|
+
hasFailed: hasFailed
|
|
96
|
+
}, headers(token))).data;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export function updateReport(reportId, feature, steps, isFinal) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
let token = yield auth();
|
|
102
|
+
yield axios.post(config.auxtaURL + "update-inprogress-report", {
|
|
103
|
+
reportId: reportId,
|
|
104
|
+
isFinal: isFinal,
|
|
105
|
+
data: Object.assign({ feature: {
|
|
106
|
+
featureRef: feature.featureId,
|
|
107
|
+
name: feature.featureName,
|
|
108
|
+
uri: feature.featureUri,
|
|
109
|
+
status: feature.status,
|
|
110
|
+
scenariosCount: feature.scenariosCount
|
|
111
|
+
} }, steps)
|
|
112
|
+
}, headers(token));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
export function getReport(reportId) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
let token = yield auth();
|
|
118
|
+
return (yield axios.post(config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
export function getLastDayResults() {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
let token = yield auth();
|
|
124
|
+
return (yield axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export function postNotifications(body) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
let token = yield auth();
|
|
130
|
+
yield axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
|
|
131
|
+
environmentName: body.environment,
|
|
132
|
+
digitalProductName: body.digitalProduct,
|
|
133
|
+
organizationName: body.organization,
|
|
134
|
+
reportId: body.reportId,
|
|
135
|
+
}, headers(token));
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
export function postNotificationsOnFail(body) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
let token = yield auth();
|
|
141
|
+
yield axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
|
|
142
|
+
environmentName: body.environment,
|
|
143
|
+
digitalProductName: body.digitalProduct,
|
|
144
|
+
organizationName: body.organization,
|
|
145
|
+
reportId: body.reportId,
|
|
146
|
+
}, headers(token));
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -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,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
|
+
}
|
|
@@ -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,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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
export function captureScreenshot() {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
try {
|
|
14
|
+
const pages = yield puppeteer.defaultPage.browser().pages();
|
|
15
|
+
if (!pages.length)
|
|
16
|
+
return undefined;
|
|
17
|
+
const lastPage = pages[pages.length - 1] || puppeteer.defaultPage;
|
|
18
|
+
const screenshotBuffer = yield lastPage.screenshot({
|
|
19
|
+
fullPage: true,
|
|
20
|
+
encoding: 'binary'
|
|
21
|
+
});
|
|
22
|
+
if (Buffer.isBuffer(screenshotBuffer))
|
|
23
|
+
return screenshotBuffer;
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function startSuite(suites: string[], reportId?: string): Promise<void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export function startSuite(suites, reportId) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
if (suites.length === 0)
|
|
15
|
+
return;
|
|
16
|
+
const next = suites.shift();
|
|
17
|
+
console.log('Starting next suite: ' + next);
|
|
18
|
+
try {
|
|
19
|
+
yield axios.post(`${config.netlifyPath}.netlify/functions/${next}?token=${config.token}`, { nextSuites: suites, reportId: reportId });
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
yield startSuite(suites, reportId);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
package/build/cjs/AuxTA.js
CHANGED
|
@@ -18,6 +18,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
21
30
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
32
|
};
|
|
@@ -75,14 +84,16 @@ class AuxTA extends code_helper_1.FunctionHelper {
|
|
|
75
84
|
this.uploadModel = new upload_model_1.UploadModel('', '', '', '');
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
|
-
|
|
79
|
-
this
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
run(event, overrideConfig) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
this.changeModelData(overrideConfig);
|
|
90
|
+
let reportId = event.queryStringParameters.reportId;
|
|
91
|
+
if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
|
|
92
|
+
return { statusCode: 401, message: 'Unauthorized' };
|
|
93
|
+
const suites = this.config.suitesList.slice(0);
|
|
94
|
+
yield (0, start_suite_helper_1.startSuite)(suites, reportId || (yield (0, report_service_1.createEmptyReport)(this.uploadModel)));
|
|
95
|
+
return { statusCode: 204 };
|
|
96
|
+
});
|
|
86
97
|
}
|
|
87
98
|
changeModelData(overrideConfig) {
|
|
88
99
|
if (overrideConfig) {
|
|
@@ -95,23 +106,27 @@ class AuxTA extends code_helper_1.FunctionHelper {
|
|
|
95
106
|
this.config = (0, config_1.setupOverrideConfig)(overrideConfig);
|
|
96
107
|
}
|
|
97
108
|
}
|
|
98
|
-
|
|
99
|
-
this
|
|
100
|
-
|
|
101
|
-
if (process.env.ENVIRONMENT
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
startBrowser(event, callback, feature, scenario, overrideConfig, singleFeature = false) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
this.changeModelData(overrideConfig);
|
|
112
|
+
if (singleFeature && process.env.ENVIRONMENT !== 'LOCAL') {
|
|
113
|
+
if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
|
|
114
|
+
return { statusCode: 401, message: 'Unauthorized' };
|
|
115
|
+
this.uploadModel.reportId = yield (0, report_service_1.createEmptyReport)(this.uploadModel);
|
|
116
|
+
this.uploadModel.nextSuites = [];
|
|
117
|
+
}
|
|
118
|
+
return this.puppeteer.run(event, callback, feature, scenario);
|
|
119
|
+
});
|
|
107
120
|
}
|
|
108
|
-
|
|
109
|
-
this
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
121
|
+
startBrowserRPA(event, callback, baseURL) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
this.changeModelData({
|
|
124
|
+
baseURL: baseURL,
|
|
125
|
+
environment: '',
|
|
126
|
+
digitalProduct: ''
|
|
127
|
+
});
|
|
128
|
+
return this.puppeteer.runRPA(event, callback);
|
|
113
129
|
});
|
|
114
|
-
return this.puppeteer.runRPA(event, callback);
|
|
115
130
|
}
|
|
116
131
|
getUploadModel() {
|
|
117
132
|
return this.uploadModel;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
const path_1 = require("path");
|
|
4
|
-
(
|
|
13
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
14
|
const r = /^--params\.suite=(.*)$/g;
|
|
6
15
|
let suite = process.argv.find(el => !!el.match(r));
|
|
7
16
|
if (!suite)
|
|
@@ -12,6 +21,6 @@ const path_1 = require("path");
|
|
|
12
21
|
suitesArr = [suites];
|
|
13
22
|
for (const suite of suitesArr) {
|
|
14
23
|
let f = require((0, path_1.join)(process.cwd(), 'build', 'functions', 'controllers', suite));
|
|
15
|
-
|
|
24
|
+
yield f.handler();
|
|
16
25
|
}
|
|
17
|
-
})();
|
|
26
|
+
}))();
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -9,45 +18,49 @@ const log_service_1 = __importDefault(require("../services/log.service"));
|
|
|
9
18
|
const report_service_1 = require("../services/report.service");
|
|
10
19
|
const start_suite_helper_1 = require("../utilities/start-suite.helper");
|
|
11
20
|
const status_of_step_1 = require("../enums/status-of.step");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer, errMessage) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
let isFinal = false;
|
|
24
|
+
if (process.env.ENVIRONMENT == "LIVE") {
|
|
25
|
+
console.log('asc ' + errMessage);
|
|
26
|
+
console.log('--- Uploading scenario and feature for AUXTA report ---');
|
|
27
|
+
const stepsArr = log_service_1.default.returnScenarioReport();
|
|
28
|
+
try {
|
|
29
|
+
const scenarioRes = yield (0, report_service_1.uploadScenario)(stepsArr, scenarioName, screenshotBuffer, errMessage);
|
|
30
|
+
const featureRes = yield (0, report_service_1.uploadFeature)(scenarioRes, featureName, (0, path_1.basename)(__filename), (statusCode != 200));
|
|
31
|
+
const feature = {
|
|
32
|
+
featureId: featureRes.featureRef,
|
|
33
|
+
featureName: featureRes.name,
|
|
34
|
+
featureUri: featureRes.uri,
|
|
35
|
+
status: featureRes.status,
|
|
36
|
+
scenariosCount: featureRes.scenariosCount
|
|
37
|
+
};
|
|
38
|
+
const stepCounts = {
|
|
39
|
+
failedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.FAILED),
|
|
40
|
+
passedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.PASSED),
|
|
41
|
+
skippedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SKIPPED),
|
|
42
|
+
suggestedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SUGGESTION)
|
|
43
|
+
};
|
|
44
|
+
isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
|
|
45
|
+
yield (0, report_service_1.updateReport)(body.reportId, feature, stepCounts, isFinal);
|
|
46
|
+
console.log('--- Finished uploading report data to AUXTA ---');
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.log('--- Failed to update report in AUXTA ---');
|
|
50
|
+
console.log(error);
|
|
51
|
+
}
|
|
41
52
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
if (isFinal)
|
|
54
|
+
yield afterComplete(body);
|
|
55
|
+
else if (body && body.nextSuites)
|
|
56
|
+
yield (0, start_suite_helper_1.startSuite)(body.nextSuites, body.reportId);
|
|
57
|
+
});
|
|
47
58
|
}
|
|
48
59
|
exports.onTestEnd = onTestEnd;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
function afterComplete(body) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
if (process.env.ENVIRONMENT == "LIVE")
|
|
63
|
+
yield (0, report_service_1.postNotifications)(body);
|
|
64
|
+
});
|
|
52
65
|
}
|
|
53
66
|
exports.afterComplete = afterComplete;
|