@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
|
@@ -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
|
};
|
|
@@ -14,128 +23,140 @@ function headers(token) {
|
|
|
14
23
|
}
|
|
15
24
|
};
|
|
16
25
|
}
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
+
});
|
|
28
39
|
});
|
|
29
40
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
+
digitalProductName: body.digitalProduct,
|
|
47
|
+
start: new Date(),
|
|
48
|
+
url: body.baseUrl
|
|
49
|
+
}, headers(token))).data.reportId;
|
|
50
|
+
});
|
|
38
51
|
}
|
|
39
52
|
exports.createEmptyReport = createEmptyReport;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
function uploadScenario(stepLog, scenarioName, screenshot, errMessage) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
let scenarios = [];
|
|
56
|
+
let token = yield auth();
|
|
57
|
+
let lastStep = stepLog[stepLog.length - 1];
|
|
58
|
+
const stepLogFormat = JSON.parse(JSON.stringify(stepLog));
|
|
59
|
+
stepLogFormat.pop();
|
|
60
|
+
let output = (yield axios_1.default.post(config_1.config.auxtaURL + "create-scenario", {
|
|
61
|
+
json: {
|
|
62
|
+
name: scenarioName,
|
|
63
|
+
steps: [
|
|
64
|
+
...stepLogFormat,
|
|
65
|
+
(lastStep.result.status == 'failed')
|
|
66
|
+
? Object.assign(lastStep, {
|
|
67
|
+
result: Object.assign(Object.assign({}, lastStep.result), { error_message: JSON.stringify(errMessage) })
|
|
68
|
+
})
|
|
69
|
+
: lastStep,
|
|
70
|
+
{
|
|
71
|
+
keyword: "After",
|
|
53
72
|
result: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, headers(token))).data.scenarios;
|
|
73
|
-
scenarios.push({
|
|
74
|
-
scenarioRef: output.scenarioRef,
|
|
75
|
-
name: output.name,
|
|
76
|
-
status: output.status,
|
|
77
|
-
stepsCount: output.stepsCount
|
|
73
|
+
status: "passed",
|
|
74
|
+
duration: 2678000000
|
|
75
|
+
},
|
|
76
|
+
embeddings: (screenshot) ? [{
|
|
77
|
+
data: screenshot.toString("base64"),
|
|
78
|
+
mime_type: "image/png"
|
|
79
|
+
}] : undefined,
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
}, headers(token))).data.scenarios;
|
|
84
|
+
scenarios.push({
|
|
85
|
+
scenarioRef: output.scenarioRef,
|
|
86
|
+
name: output.name,
|
|
87
|
+
status: output.status,
|
|
88
|
+
stepsCount: output.stepsCount
|
|
89
|
+
});
|
|
90
|
+
return scenarios;
|
|
78
91
|
});
|
|
79
|
-
return scenarios;
|
|
80
92
|
}
|
|
81
93
|
exports.uploadScenario = uploadScenario;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
function uploadFeature(scenarioId, scenarioName, uri, hasFailed) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
let token = yield auth();
|
|
97
|
+
return (yield axios_1.default.post(config_1.config.auxtaURL + "create-feature", {
|
|
98
|
+
json: {
|
|
99
|
+
name: scenarioName,
|
|
100
|
+
uri: uri
|
|
101
|
+
},
|
|
102
|
+
scenarios: scenarioId,
|
|
103
|
+
hasFailed: hasFailed
|
|
104
|
+
}, headers(token))).data;
|
|
105
|
+
});
|
|
92
106
|
}
|
|
93
107
|
exports.uploadFeature = uploadFeature;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
feature: {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}, headers(token));
|
|
108
|
+
function updateReport(reportId, feature, steps, isFinal) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
let token = yield auth();
|
|
111
|
+
yield axios_1.default.post(config_1.config.auxtaURL + "update-inprogress-report", {
|
|
112
|
+
reportId: reportId,
|
|
113
|
+
isFinal: isFinal,
|
|
114
|
+
data: Object.assign({ feature: {
|
|
115
|
+
featureRef: feature.featureId,
|
|
116
|
+
name: feature.featureName,
|
|
117
|
+
uri: feature.featureUri,
|
|
118
|
+
status: feature.status,
|
|
119
|
+
scenariosCount: feature.scenariosCount
|
|
120
|
+
} }, steps)
|
|
121
|
+
}, headers(token));
|
|
122
|
+
});
|
|
110
123
|
}
|
|
111
124
|
exports.updateReport = updateReport;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
125
|
+
function getReport(reportId) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
let token = yield auth();
|
|
128
|
+
return (yield axios_1.default.post(config_1.config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
|
|
129
|
+
});
|
|
115
130
|
}
|
|
116
131
|
exports.getReport = getReport;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
132
|
+
function getLastDayResults() {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
let token = yield auth();
|
|
135
|
+
return (yield axios_1.default.get(config_1.config.auxtaURL + `get-last-day-results?url=${config_1.config.baseURL}`, headers(token))).data.results;
|
|
136
|
+
});
|
|
120
137
|
}
|
|
121
138
|
exports.getLastDayResults = getLastDayResults;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
function postNotifications(body) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
let token = yield auth();
|
|
142
|
+
yield axios_1.default.post(`${config_1.config.auxtaURL}post-notification-after-run-background`, {
|
|
143
|
+
environmentName: body.environment,
|
|
144
|
+
digitalProductName: body.digitalProduct,
|
|
145
|
+
organizationName: body.organization,
|
|
146
|
+
reportId: body.reportId,
|
|
147
|
+
}, headers(token));
|
|
148
|
+
});
|
|
130
149
|
}
|
|
131
150
|
exports.postNotifications = postNotifications;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
151
|
+
function postNotificationsOnFail(body) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
let token = yield auth();
|
|
154
|
+
yield axios_1.default.post(`${config_1.config.auxtaURL}post-notifications-after-case-fail-background`, {
|
|
155
|
+
environmentName: body.environment,
|
|
156
|
+
digitalProductName: body.digitalProduct,
|
|
157
|
+
organizationName: body.organization,
|
|
158
|
+
reportId: body.reportId,
|
|
159
|
+
}, headers(token));
|
|
160
|
+
});
|
|
140
161
|
}
|
|
141
162
|
exports.postNotificationsOnFail = postNotificationsOnFail;
|
|
@@ -1,25 +1,36 @@
|
|
|
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
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
15
|
exports.captureScreenshot = void 0;
|
|
7
16
|
const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
function captureScreenshot() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
try {
|
|
20
|
+
const pages = yield puppeteer_1.default.defaultPage.browser().pages();
|
|
21
|
+
if (!pages.length)
|
|
22
|
+
return undefined;
|
|
23
|
+
const lastPage = pages[pages.length - 1] || puppeteer_1.default.defaultPage;
|
|
24
|
+
const screenshotBuffer = yield lastPage.screenshot({
|
|
25
|
+
fullPage: true,
|
|
26
|
+
encoding: 'binary'
|
|
27
|
+
});
|
|
28
|
+
if (Buffer.isBuffer(screenshotBuffer))
|
|
29
|
+
return screenshotBuffer;
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
});
|
|
24
35
|
}
|
|
25
36
|
exports.captureScreenshot = captureScreenshot;
|
|
@@ -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
|
};
|
|
@@ -6,16 +15,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
15
|
exports.startSuite = void 0;
|
|
7
16
|
const axios_1 = __importDefault(require("axios"));
|
|
8
17
|
const config_1 = require("../configs/config");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
function startSuite(suites, reportId) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
if (suites.length === 0)
|
|
21
|
+
return;
|
|
22
|
+
const next = suites.shift();
|
|
23
|
+
console.log('Starting next suite: ' + next);
|
|
24
|
+
try {
|
|
25
|
+
yield axios_1.default.post(`${config_1.config.netlifyPath}.netlify/functions/${next}?token=${config_1.config.token}`, { nextSuites: suites, reportId: reportId });
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
yield startSuite(suites, reportId);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
20
31
|
}
|
|
21
32
|
exports.startSuite = startSuite;
|