@auxcode/auxta 1.3.25 → 1.3.26-beta.3
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/README.md +4 -0
- package/build/cjs/AuxTA.d.ts +62 -61
- package/build/cjs/AuxTA.d.ts.map +1 -0
- package/build/cjs/AuxTA.js +152 -152
- package/build/cjs/auxta/configs/config.d.ts +55 -54
- package/build/cjs/auxta/configs/config.d.ts.map +1 -0
- package/build/cjs/auxta/configs/config.js +65 -65
- package/build/cjs/auxta/enums/status-of.step.d.ts +8 -7
- package/build/cjs/auxta/enums/status-of.step.d.ts.map +1 -0
- package/build/cjs/auxta/enums/status-of.step.js +11 -11
- package/build/cjs/auxta/helpers/response.helper.d.ts +11 -10
- package/build/cjs/auxta/helpers/response.helper.d.ts.map +1 -0
- package/build/cjs/auxta/helpers/response.helper.js +15 -15
- package/build/cjs/auxta/helpers/start.helper.d.ts +2 -1
- package/build/cjs/auxta/helpers/start.helper.d.ts.map +1 -0
- package/build/cjs/auxta/helpers/start.helper.js +26 -26
- package/build/cjs/auxta/hooks/report.hook.d.ts +15 -14
- package/build/cjs/auxta/hooks/report.hook.d.ts.map +1 -0
- package/build/cjs/auxta/hooks/report.hook.js +66 -66
- package/build/cjs/auxta/models/upload.model.d.ts +33 -32
- package/build/cjs/auxta/models/upload.model.d.ts.map +1 -0
- package/build/cjs/auxta/models/upload.model.js +75 -75
- package/build/cjs/auxta/services/log.service.d.ts +27 -26
- package/build/cjs/auxta/services/log.service.d.ts.map +1 -0
- package/build/cjs/auxta/services/log.service.js +47 -47
- package/build/cjs/auxta/services/report.service.d.ts +37 -36
- package/build/cjs/auxta/services/report.service.d.ts.map +1 -0
- package/build/cjs/auxta/services/report.service.js +164 -164
- package/build/cjs/auxta/services/runtime.service.d.ts +17 -16
- package/build/cjs/auxta/services/runtime.service.d.ts.map +1 -0
- package/build/cjs/auxta/services/runtime.service.js +41 -41
- package/build/cjs/auxta/utilities/runtime.helper.d.ts +16 -15
- package/build/cjs/auxta/utilities/runtime.helper.d.ts.map +1 -0
- package/build/cjs/auxta/utilities/runtime.helper.js +19 -19
- package/build/cjs/auxta/utilities/screenshot.helper.d.ts +3 -2
- package/build/cjs/auxta/utilities/screenshot.helper.d.ts.map +1 -0
- package/build/cjs/auxta/utilities/screenshot.helper.js +36 -36
- package/build/cjs/auxta/utilities/start-suite.helper.d.ts +18 -17
- package/build/cjs/auxta/utilities/start-suite.helper.d.ts.map +1 -0
- package/build/cjs/auxta/utilities/start-suite.helper.js +31 -31
- package/build/cjs/macros/helpers/Aux2faAuth.d.ts +8 -7
- package/build/cjs/macros/helpers/Aux2faAuth.d.ts.map +1 -0
- package/build/cjs/macros/helpers/Aux2faAuth.js +29 -29
- package/build/cjs/macros/helpers/AuxGoogleAuth.d.ts +18 -17
- package/build/cjs/macros/helpers/AuxGoogleAuth.d.ts.map +1 -0
- package/build/cjs/macros/helpers/AuxGoogleAuth.js +104 -104
- package/build/cjs/macros/helpers/code.helper.d.ts +22 -21
- package/build/cjs/macros/helpers/code.helper.d.ts.map +1 -0
- package/build/cjs/macros/helpers/code.helper.js +201 -201
- package/build/cjs/macros/helpers/emailHelper.d.ts +20 -19
- package/build/cjs/macros/helpers/emailHelper.d.ts.map +1 -0
- package/build/cjs/macros/helpers/emailHelper.js +167 -167
- package/build/cjs/macros/helpers/extend-default-page.d.ts +7 -6
- package/build/cjs/macros/helpers/extend-default-page.d.ts.map +1 -0
- package/build/cjs/macros/helpers/extend-default-page.js +89 -89
- package/build/cjs/puppeteer/puppeteer.d.ts +26 -25
- package/build/cjs/puppeteer/puppeteer.d.ts.map +1 -0
- package/build/cjs/puppeteer/puppeteer.js +203 -196
- package/build/esm/AuxTA.d.ts +62 -61
- package/build/esm/AuxTA.d.ts.map +1 -0
- package/build/esm/AuxTA.js +123 -123
- package/build/esm/auxta/configs/config.d.ts +55 -54
- package/build/esm/auxta/configs/config.d.ts.map +1 -0
- package/build/esm/auxta/configs/config.js +60 -60
- package/build/esm/auxta/enums/status-of.step.d.ts +8 -7
- package/build/esm/auxta/enums/status-of.step.d.ts.map +1 -0
- package/build/esm/auxta/enums/status-of.step.js +8 -8
- package/build/esm/auxta/helpers/response.helper.d.ts +11 -10
- package/build/esm/auxta/helpers/response.helper.d.ts.map +1 -0
- package/build/esm/auxta/helpers/response.helper.js +11 -11
- package/build/esm/auxta/helpers/start.helper.d.ts +2 -1
- package/build/esm/auxta/helpers/start.helper.d.ts.map +1 -0
- package/build/esm/auxta/helpers/start.helper.js +24 -24
- package/build/esm/auxta/hooks/report.hook.d.ts +15 -14
- package/build/esm/auxta/hooks/report.hook.d.ts.map +1 -0
- package/build/esm/auxta/hooks/report.hook.js +58 -58
- package/build/esm/auxta/models/upload.model.d.ts +33 -32
- package/build/esm/auxta/models/upload.model.d.ts.map +1 -0
- package/build/esm/auxta/models/upload.model.js +71 -71
- package/build/esm/auxta/services/log.service.d.ts +27 -26
- package/build/esm/auxta/services/log.service.d.ts.map +1 -0
- package/build/esm/auxta/services/log.service.js +43 -43
- package/build/esm/auxta/services/report.service.d.ts +37 -36
- package/build/esm/auxta/services/report.service.d.ts.map +1 -0
- package/build/esm/auxta/services/report.service.js +150 -150
- package/build/esm/auxta/services/runtime.service.d.ts +17 -16
- package/build/esm/auxta/services/runtime.service.d.ts.map +1 -0
- package/build/esm/auxta/services/runtime.service.js +37 -37
- package/build/esm/auxta/utilities/runtime.helper.d.ts +16 -15
- package/build/esm/auxta/utilities/runtime.helper.d.ts.map +1 -0
- package/build/esm/auxta/utilities/runtime.helper.js +15 -15
- package/build/esm/auxta/utilities/screenshot.helper.d.ts +3 -2
- package/build/esm/auxta/utilities/screenshot.helper.d.ts.map +1 -0
- package/build/esm/auxta/utilities/screenshot.helper.js +29 -29
- package/build/esm/auxta/utilities/start-suite.helper.d.ts +18 -17
- package/build/esm/auxta/utilities/start-suite.helper.d.ts.map +1 -0
- package/build/esm/auxta/utilities/start-suite.helper.js +26 -26
- package/build/esm/macros/helpers/Aux2faAuth.d.ts +8 -7
- package/build/esm/macros/helpers/Aux2faAuth.d.ts.map +1 -0
- package/build/esm/macros/helpers/Aux2faAuth.js +25 -25
- package/build/esm/macros/helpers/AuxGoogleAuth.d.ts +18 -17
- package/build/esm/macros/helpers/AuxGoogleAuth.d.ts.map +1 -0
- package/build/esm/macros/helpers/AuxGoogleAuth.js +100 -100
- package/build/esm/macros/helpers/code.helper.d.ts +22 -21
- package/build/esm/macros/helpers/code.helper.d.ts.map +1 -0
- package/build/esm/macros/helpers/code.helper.js +194 -194
- package/build/esm/macros/helpers/emailHelper.d.ts +20 -19
- package/build/esm/macros/helpers/emailHelper.d.ts.map +1 -0
- package/build/esm/macros/helpers/emailHelper.js +160 -160
- package/build/esm/macros/helpers/extend-default-page.d.ts +7 -6
- package/build/esm/macros/helpers/extend-default-page.d.ts.map +1 -0
- package/build/esm/macros/helpers/extend-default-page.js +82 -82
- package/build/esm/puppeteer/puppeteer.d.ts +26 -25
- package/build/esm/puppeteer/puppeteer.d.ts.map +1 -0
- package/build/esm/puppeteer/puppeteer.js +195 -188
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,196 +1,203 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.Puppeteer = void 0;
|
|
16
|
-
const log_service_1 = __importDefault(require("../auxta/services/log.service"));
|
|
17
|
-
const screenshot_helper_1 = require("../auxta/utilities/screenshot.helper");
|
|
18
|
-
const report_hook_1 = require("../auxta/hooks/report.hook");
|
|
19
|
-
const AuxTA_1 = __importDefault(require("../AuxTA"));
|
|
20
|
-
const status_of_step_1 = require("../auxta/enums/status-of.step");
|
|
21
|
-
const config_1 = require("../auxta/configs/config");
|
|
22
|
-
const start_suite_helper_1 = require("../auxta/utilities/start-suite.helper");
|
|
23
|
-
const report_service_1 = require("../auxta/services/report.service");
|
|
24
|
-
const puppeteer = require("puppeteer");
|
|
25
|
-
class Puppeteer {
|
|
26
|
-
startBrowser() {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
let args = [
|
|
29
|
-
'--start-maximized'
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
log_service_1.default.push('When', `
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
log_service_1.default.push('When', `
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Puppeteer = void 0;
|
|
16
|
+
const log_service_1 = __importDefault(require("../auxta/services/log.service"));
|
|
17
|
+
const screenshot_helper_1 = require("../auxta/utilities/screenshot.helper");
|
|
18
|
+
const report_hook_1 = require("../auxta/hooks/report.hook");
|
|
19
|
+
const AuxTA_1 = __importDefault(require("../AuxTA"));
|
|
20
|
+
const status_of_step_1 = require("../auxta/enums/status-of.step");
|
|
21
|
+
const config_1 = require("../auxta/configs/config");
|
|
22
|
+
const start_suite_helper_1 = require("../auxta/utilities/start-suite.helper");
|
|
23
|
+
const report_service_1 = require("../auxta/services/report.service");
|
|
24
|
+
const puppeteer = require("puppeteer");
|
|
25
|
+
class Puppeteer {
|
|
26
|
+
startBrowser() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
let args = [
|
|
29
|
+
'--start-maximized'
|
|
30
|
+
];
|
|
31
|
+
let env = {};
|
|
32
|
+
if (process.env.ENVIRONMENT != 'LOCAL') {
|
|
33
|
+
args.push(`--window-size=${config_1.config.screenWidth},${config_1.config.screenHeight}`);
|
|
34
|
+
args.push("--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu");
|
|
35
|
+
env = {
|
|
36
|
+
DISPLAY: ":10.0"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
this.browser = yield puppeteer.launch({
|
|
40
|
+
executablePath: puppeteer.executablePath(),
|
|
41
|
+
args,
|
|
42
|
+
env,
|
|
43
|
+
ignoreDefaultArgs: ["--enable-automation"],
|
|
44
|
+
defaultViewport: process.env.ENVIRONMENT === 'LOCAL' ? null : {
|
|
45
|
+
width: config_1.config.screenWidth,
|
|
46
|
+
height: config_1.config.screenHeight
|
|
47
|
+
},
|
|
48
|
+
headless: process.env.ENVIRONMENT === 'LOCAL' ? process.env.headless === 'true' : true
|
|
49
|
+
});
|
|
50
|
+
this.defaultPage = (yield this.browser.pages())[0];
|
|
51
|
+
yield AuxTA_1.default.extend_page_functions(this.defaultPage);
|
|
52
|
+
yield this.defaultPage.goto(config_1.config.baseURL, { waitUntil: 'networkidle0' });
|
|
53
|
+
yield this.defaultPage.waitForNetworkIdle();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
close() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
if (this.browser) {
|
|
59
|
+
let pages = yield this.browser.pages();
|
|
60
|
+
yield Promise.all(pages.map((page) => page.close()));
|
|
61
|
+
yield this.browser.close();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
run(event, callback, featureName = 'Test feature', scenarioName = 'Test scenario', uploadModel) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
let close;
|
|
68
|
+
try {
|
|
69
|
+
if (uploadModel === undefined) {
|
|
70
|
+
uploadModel = AuxTA_1.default.getUploadModel();
|
|
71
|
+
uploadModel.featureName = featureName;
|
|
72
|
+
uploadModel.scenarioName = scenarioName;
|
|
73
|
+
}
|
|
74
|
+
if (event.close === undefined)
|
|
75
|
+
close = Puppeteer.setupHeader(event, uploadModel);
|
|
76
|
+
let screenshotBuffer;
|
|
77
|
+
let errMessage;
|
|
78
|
+
let statusCode = 200;
|
|
79
|
+
let consoleStack = [];
|
|
80
|
+
try {
|
|
81
|
+
yield log_service_1.default.push('When', `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
82
|
+
yield this.startBrowser();
|
|
83
|
+
this.defaultPage.on('console', (message) => consoleStack.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
84
|
+
.on('pageerror', ({ message }) => consoleStack.push(message))
|
|
85
|
+
.on('response', (response) => consoleStack.push(`${response.status()} ${response.url()}`))
|
|
86
|
+
.on('requestfailed', (request) => { var _a; return consoleStack.push(`${request.failure() !== null ? (_a = request.failure()) === null || _a === void 0 ? void 0 : _a.errorText : ""} ${request.url()}`); });
|
|
87
|
+
yield callback(event);
|
|
88
|
+
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
console.log("Error message: \n", err);
|
|
92
|
+
let browser_start_retry = err.toString().includes("Failed to launch the browser process!");
|
|
93
|
+
if (browser_start_retry) {
|
|
94
|
+
const result = yield (0, start_suite_helper_1.retrySuite)(uploadModel.nextSuites, uploadModel.reportId, uploadModel.currentSuite, uploadModel.retries);
|
|
95
|
+
if (!result) {
|
|
96
|
+
return yield (0, report_hook_1.onTestEnd)(uploadModel, featureName, scenarioName, statusCode, screenshotBuffer, !errMessage ? undefined : {
|
|
97
|
+
currentPageUrl: 'undefined',
|
|
98
|
+
console: consoleStack,
|
|
99
|
+
error: 'Browser did not open'
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return { statusCode: 204 };
|
|
103
|
+
}
|
|
104
|
+
errMessage = err;
|
|
105
|
+
statusCode = 500;
|
|
106
|
+
screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshot)();
|
|
107
|
+
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
108
|
+
yield (0, report_service_1.postNotificationsOnFail)(uploadModel);
|
|
109
|
+
}
|
|
110
|
+
let url = this.defaultPage.url();
|
|
111
|
+
if (close)
|
|
112
|
+
yield this.close();
|
|
113
|
+
return yield (0, report_hook_1.onTestEnd)(uploadModel, featureName, scenarioName, statusCode, screenshotBuffer, !errMessage ? undefined : {
|
|
114
|
+
currentPageUrl: url,
|
|
115
|
+
console: consoleStack,
|
|
116
|
+
error: errMessage
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
console.log("Lib error:", e);
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
log_service_1.default.clear();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
runRPA(event, callback, uploadModel, close) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
let errMessage;
|
|
130
|
+
try {
|
|
131
|
+
if (uploadModel === undefined)
|
|
132
|
+
uploadModel = AuxTA_1.default.getUploadModel();
|
|
133
|
+
if (close === undefined) {
|
|
134
|
+
try {
|
|
135
|
+
if (event.close) {
|
|
136
|
+
close = event.close === "true";
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
close = true;
|
|
140
|
+
}
|
|
141
|
+
if (event.retries) {
|
|
142
|
+
uploadModel.retries = Number(event.retries);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
close = true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
let consoleStack = [];
|
|
150
|
+
try {
|
|
151
|
+
yield log_service_1.default.push('When', `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
152
|
+
yield this.startBrowser();
|
|
153
|
+
this.defaultPage.on('console', (message) => consoleStack.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
154
|
+
.on('pageerror', ({ message }) => consoleStack.push(message))
|
|
155
|
+
.on('response', (response) => consoleStack.push(`${response.status()} ${response.url()}`))
|
|
156
|
+
.on('requestfailed', (request) => { var _a; return consoleStack.push(`${request.failure() !== null ? (_a = request.failure()) === null || _a === void 0 ? void 0 : _a.errorText : ""} ${request.url()}`); });
|
|
157
|
+
yield callback(event);
|
|
158
|
+
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
console.log("Error message: \n", err);
|
|
162
|
+
let browser_start_retry = err.toString().includes("Failed to launch the browser process!");
|
|
163
|
+
if (browser_start_retry) {
|
|
164
|
+
yield (0, start_suite_helper_1.retrySuite)([], '', uploadModel.currentSuite, uploadModel.retries);
|
|
165
|
+
return { statusCode: 204 };
|
|
166
|
+
}
|
|
167
|
+
errMessage = err;
|
|
168
|
+
log_service_1.default.push('When', `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
169
|
+
return errMessage;
|
|
170
|
+
}
|
|
171
|
+
if (close)
|
|
172
|
+
yield this.close();
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
console.log("Lib error:", e);
|
|
176
|
+
}
|
|
177
|
+
finally {
|
|
178
|
+
log_service_1.default.clear();
|
|
179
|
+
}
|
|
180
|
+
return { statusCode: 200 };
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
static setupHeader(event, uploadModel) {
|
|
184
|
+
let close = true;
|
|
185
|
+
if (process.env.ENVIRONMENT !== 'LOCAL' && event) {
|
|
186
|
+
uploadModel.reportId = event.reportId;
|
|
187
|
+
uploadModel.nextSuites = event.nextSuites;
|
|
188
|
+
uploadModel.currentSuite = event.currentSuite;
|
|
189
|
+
uploadModel.retries = Number(event.retries);
|
|
190
|
+
}
|
|
191
|
+
try {
|
|
192
|
+
if (event.close) {
|
|
193
|
+
close = event.close === "true";
|
|
194
|
+
}
|
|
195
|
+
return close;
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
exports.Puppeteer = Puppeteer;
|
|
203
|
+
exports.default = new Puppeteer();
|
package/build/esm/AuxTA.d.ts
CHANGED
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
import { Puppeteer } from "./puppeteer/puppeteer";
|
|
2
|
-
import { FunctionHelper } from "./macros/helpers/code.helper";
|
|
3
|
-
import StatusOfStep from "./auxta/enums/status-of.step";
|
|
4
|
-
import { UploadModel } from "./auxta/models/upload.model";
|
|
5
|
-
import { AuxGoogleAuth } from "./macros/helpers/AuxGoogleAuth";
|
|
6
|
-
declare class AuxTA extends FunctionHelper {
|
|
7
|
-
puppeteer: Puppeteer;
|
|
8
|
-
aux2fa: import("./macros/helpers/Aux2faAuth").Aux2faAuth;
|
|
9
|
-
google: typeof AuxGoogleAuth;
|
|
10
|
-
config: {
|
|
11
|
-
auxtaURL: string;
|
|
12
|
-
baseURL: string;
|
|
13
|
-
siteURL: string;
|
|
14
|
-
organization: string;
|
|
15
|
-
netlifyPath: string;
|
|
16
|
-
digitalProduct: string;
|
|
17
|
-
token: string;
|
|
18
|
-
screenWidth: number;
|
|
19
|
-
screenHeight: number;
|
|
20
|
-
timeout: number;
|
|
21
|
-
suitesList: never[];
|
|
22
|
-
googleEmail: string;
|
|
23
|
-
auxtaCredentials: {
|
|
24
|
-
email: string;
|
|
25
|
-
password: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
email: import("./macros/helpers/emailHelper").EmailHelper;
|
|
29
|
-
private readonly uploadModel;
|
|
30
|
-
constructor();
|
|
31
|
-
run(event: any, overrideConfig?: any): Promise<{
|
|
32
|
-
nextSuites?: undefined;
|
|
33
|
-
reportId?: undefined;
|
|
34
|
-
currentSuite?: undefined;
|
|
35
|
-
retries?: undefined;
|
|
36
|
-
} | {
|
|
37
|
-
nextSuites: string[];
|
|
38
|
-
reportId: string | undefined;
|
|
39
|
-
currentSuite: string | undefined;
|
|
40
|
-
retries: string;
|
|
41
|
-
}>;
|
|
42
|
-
private changeModelData;
|
|
43
|
-
startBrowser(event: any, callback: any, feature: string, scenario: string, overrideConfig?: any, singleFeature?: boolean, fileName?: string): Promise<{
|
|
44
|
-
nextSuites?: undefined;
|
|
45
|
-
reportId?: undefined;
|
|
46
|
-
currentSuite?: undefined;
|
|
47
|
-
retries?: undefined;
|
|
48
|
-
} | {
|
|
49
|
-
nextSuites: string[];
|
|
50
|
-
reportId: string | undefined;
|
|
51
|
-
currentSuite: string | undefined;
|
|
52
|
-
retries: string;
|
|
53
|
-
} | {
|
|
54
|
-
statusCode: number;
|
|
55
|
-
} | undefined>;
|
|
56
|
-
startBrowserRPA(event: any, callback: any, baseURL: string, fileName?: string): Promise<any>;
|
|
57
|
-
getUploadModel(): UploadModel;
|
|
58
|
-
}
|
|
59
|
-
export declare const StepStatus: typeof StatusOfStep;
|
|
60
|
-
declare const auxta: AuxTA;
|
|
61
|
-
export default auxta;
|
|
1
|
+
import { Puppeteer } from "./puppeteer/puppeteer";
|
|
2
|
+
import { FunctionHelper } from "./macros/helpers/code.helper";
|
|
3
|
+
import StatusOfStep from "./auxta/enums/status-of.step";
|
|
4
|
+
import { UploadModel } from "./auxta/models/upload.model";
|
|
5
|
+
import { AuxGoogleAuth } from "./macros/helpers/AuxGoogleAuth";
|
|
6
|
+
declare class AuxTA extends FunctionHelper {
|
|
7
|
+
puppeteer: Puppeteer;
|
|
8
|
+
aux2fa: import("./macros/helpers/Aux2faAuth").Aux2faAuth;
|
|
9
|
+
google: typeof AuxGoogleAuth;
|
|
10
|
+
config: {
|
|
11
|
+
auxtaURL: string;
|
|
12
|
+
baseURL: string;
|
|
13
|
+
siteURL: string;
|
|
14
|
+
organization: string;
|
|
15
|
+
netlifyPath: string;
|
|
16
|
+
digitalProduct: string;
|
|
17
|
+
token: string;
|
|
18
|
+
screenWidth: number;
|
|
19
|
+
screenHeight: number;
|
|
20
|
+
timeout: number;
|
|
21
|
+
suitesList: never[];
|
|
22
|
+
googleEmail: string;
|
|
23
|
+
auxtaCredentials: {
|
|
24
|
+
email: string;
|
|
25
|
+
password: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
email: import("./macros/helpers/emailHelper").EmailHelper;
|
|
29
|
+
private readonly uploadModel;
|
|
30
|
+
constructor();
|
|
31
|
+
run(event: any, overrideConfig?: any): Promise<{
|
|
32
|
+
nextSuites?: undefined;
|
|
33
|
+
reportId?: undefined;
|
|
34
|
+
currentSuite?: undefined;
|
|
35
|
+
retries?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
nextSuites: string[];
|
|
38
|
+
reportId: string | undefined;
|
|
39
|
+
currentSuite: string | undefined;
|
|
40
|
+
retries: string;
|
|
41
|
+
}>;
|
|
42
|
+
private changeModelData;
|
|
43
|
+
startBrowser(event: any, callback: any, feature: string, scenario: string, overrideConfig?: any, singleFeature?: boolean, fileName?: string): Promise<{
|
|
44
|
+
nextSuites?: undefined;
|
|
45
|
+
reportId?: undefined;
|
|
46
|
+
currentSuite?: undefined;
|
|
47
|
+
retries?: undefined;
|
|
48
|
+
} | {
|
|
49
|
+
nextSuites: string[];
|
|
50
|
+
reportId: string | undefined;
|
|
51
|
+
currentSuite: string | undefined;
|
|
52
|
+
retries: string;
|
|
53
|
+
} | {
|
|
54
|
+
statusCode: number;
|
|
55
|
+
} | undefined>;
|
|
56
|
+
startBrowserRPA(event: any, callback: any, baseURL: string, fileName?: string): Promise<any>;
|
|
57
|
+
getUploadModel(): UploadModel;
|
|
58
|
+
}
|
|
59
|
+
export declare const StepStatus: typeof StatusOfStep;
|
|
60
|
+
declare const auxta: AuxTA;
|
|
61
|
+
export default auxta;
|
|
62
|
+
//# sourceMappingURL=AuxTA.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuxTA.d.ts","sourceRoot":"","sources":["../../src/AuxTA.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAG5D,OAAO,YAAY,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAMxD,OAAO,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAM7D,cAAM,KAAM,SAAQ,cAAc;IACvB,SAAS,EAAE,SAAS,CAAa;IACjC,MAAM,mDAAc;IACpB,MAAM,uBAAgB;IACtB,MAAM;;;;;;;;;;;;;;;;;MAAK;IACX,KAAK,qDAAc;IAE1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;;IAsC7B,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,GAAG;;;;;;;;;;;IAcjD,OAAO,CAAC,eAAe;IASV,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,GAAG,EAAE,aAAa,UAAQ,EAAE,QAAQ,SAAK;;;;;;;;;;;;;IAUrI,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAK;IAU/E,cAAc,IAAI,WAAW;CAGvC;AAED,eAAO,MAAM,UAAU,qBAAe,CAAC;AAEvC,QAAA,MAAM,KAAK,EAAE,KAAmB,CAAC;AAEjC,eAAe,KAAK,CAAC"}
|