@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,188 +1,195 @@
|
|
|
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 log from "../auxta/services/log.service";
|
|
11
|
-
import { captureScreenshot } from "../auxta/utilities/screenshot.helper";
|
|
12
|
-
import { onTestEnd } from "../auxta/hooks/report.hook";
|
|
13
|
-
import auxta from "../AuxTA";
|
|
14
|
-
import { StatusOfStep } from "../auxta/enums/status-of.step";
|
|
15
|
-
import { config } from "../auxta/configs/config";
|
|
16
|
-
import { retrySuite } from "../auxta/utilities/start-suite.helper";
|
|
17
|
-
import { postNotificationsOnFail } from "../auxta/services/report.service";
|
|
18
|
-
export class Puppeteer {
|
|
19
|
-
startBrowser() {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
let args = [
|
|
22
|
-
'--start-maximized'
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
log.push('When', `
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
log.push('When', `
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
log
|
|
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
|
-
|
|
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 log from "../auxta/services/log.service";
|
|
11
|
+
import { captureScreenshot } from "../auxta/utilities/screenshot.helper";
|
|
12
|
+
import { onTestEnd } from "../auxta/hooks/report.hook";
|
|
13
|
+
import auxta from "../AuxTA";
|
|
14
|
+
import { StatusOfStep } from "../auxta/enums/status-of.step";
|
|
15
|
+
import { config } from "../auxta/configs/config";
|
|
16
|
+
import { retrySuite } from "../auxta/utilities/start-suite.helper";
|
|
17
|
+
import { postNotificationsOnFail } from "../auxta/services/report.service";
|
|
18
|
+
export class Puppeteer {
|
|
19
|
+
startBrowser() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
let args = [
|
|
22
|
+
'--start-maximized'
|
|
23
|
+
];
|
|
24
|
+
let env = {};
|
|
25
|
+
if (process.env.ENVIRONMENT != 'LOCAL') {
|
|
26
|
+
args.push(`--window-size=${config.screenWidth},${config.screenHeight}`);
|
|
27
|
+
args.push("--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu");
|
|
28
|
+
env = {
|
|
29
|
+
DISPLAY: ":10.0"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
this.browser = yield puppeteer.launch({
|
|
33
|
+
executablePath: puppeteer.executablePath(),
|
|
34
|
+
args,
|
|
35
|
+
env,
|
|
36
|
+
ignoreDefaultArgs: ["--enable-automation"],
|
|
37
|
+
defaultViewport: process.env.ENVIRONMENT === 'LOCAL' ? null : {
|
|
38
|
+
width: config.screenWidth,
|
|
39
|
+
height: config.screenHeight
|
|
40
|
+
},
|
|
41
|
+
headless: process.env.ENVIRONMENT === 'LOCAL' ? process.env.headless === 'true' : true
|
|
42
|
+
});
|
|
43
|
+
this.defaultPage = (yield this.browser.pages())[0];
|
|
44
|
+
yield auxta.extend_page_functions(this.defaultPage);
|
|
45
|
+
yield this.defaultPage.goto(config.baseURL, { waitUntil: 'networkidle0' });
|
|
46
|
+
yield this.defaultPage.waitForNetworkIdle();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
close() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (this.browser) {
|
|
52
|
+
let pages = yield this.browser.pages();
|
|
53
|
+
yield Promise.all(pages.map((page) => page.close()));
|
|
54
|
+
yield this.browser.close();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
run(event, callback, featureName = 'Test feature', scenarioName = 'Test scenario', uploadModel) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
let close;
|
|
61
|
+
try {
|
|
62
|
+
if (uploadModel === undefined) {
|
|
63
|
+
uploadModel = auxta.getUploadModel();
|
|
64
|
+
uploadModel.featureName = featureName;
|
|
65
|
+
uploadModel.scenarioName = scenarioName;
|
|
66
|
+
}
|
|
67
|
+
if (event.close === undefined)
|
|
68
|
+
close = Puppeteer.setupHeader(event, uploadModel);
|
|
69
|
+
let screenshotBuffer;
|
|
70
|
+
let errMessage;
|
|
71
|
+
let statusCode = 200;
|
|
72
|
+
let consoleStack = [];
|
|
73
|
+
try {
|
|
74
|
+
yield log.push('When', `Starting puppeteer process`, StatusOfStep.PASSED);
|
|
75
|
+
yield this.startBrowser();
|
|
76
|
+
this.defaultPage.on('console', (message) => consoleStack.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
77
|
+
.on('pageerror', ({ message }) => consoleStack.push(message))
|
|
78
|
+
.on('response', (response) => consoleStack.push(`${response.status()} ${response.url()}`))
|
|
79
|
+
.on('requestfailed', (request) => { var _a; return consoleStack.push(`${request.failure() !== null ? (_a = request.failure()) === null || _a === void 0 ? void 0 : _a.errorText : ""} ${request.url()}`); });
|
|
80
|
+
yield callback(event);
|
|
81
|
+
log.push('When', `Finished puppeteer process`, StatusOfStep.PASSED);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
console.log("Error message: \n", err);
|
|
85
|
+
let browser_start_retry = err.toString().includes("Failed to launch the browser process!");
|
|
86
|
+
if (browser_start_retry) {
|
|
87
|
+
const result = yield retrySuite(uploadModel.nextSuites, uploadModel.reportId, uploadModel.currentSuite, uploadModel.retries);
|
|
88
|
+
if (!result) {
|
|
89
|
+
return yield onTestEnd(uploadModel, featureName, scenarioName, statusCode, screenshotBuffer, !errMessage ? undefined : {
|
|
90
|
+
currentPageUrl: 'undefined',
|
|
91
|
+
console: consoleStack,
|
|
92
|
+
error: 'Browser did not open'
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return { statusCode: 204 };
|
|
96
|
+
}
|
|
97
|
+
errMessage = err;
|
|
98
|
+
statusCode = 500;
|
|
99
|
+
screenshotBuffer = yield captureScreenshot();
|
|
100
|
+
log.push('When', `Finished puppeteer process`, StatusOfStep.FAILED);
|
|
101
|
+
yield postNotificationsOnFail(uploadModel);
|
|
102
|
+
}
|
|
103
|
+
let url = this.defaultPage.url();
|
|
104
|
+
if (close)
|
|
105
|
+
yield this.close();
|
|
106
|
+
return yield onTestEnd(uploadModel, featureName, scenarioName, statusCode, screenshotBuffer, !errMessage ? undefined : {
|
|
107
|
+
currentPageUrl: url,
|
|
108
|
+
console: consoleStack,
|
|
109
|
+
error: errMessage
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
console.log("Lib error:", e);
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
log.clear();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
runRPA(event, callback, uploadModel, close) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
let errMessage;
|
|
123
|
+
try {
|
|
124
|
+
if (uploadModel === undefined)
|
|
125
|
+
uploadModel = auxta.getUploadModel();
|
|
126
|
+
if (close === undefined) {
|
|
127
|
+
try {
|
|
128
|
+
if (event.close) {
|
|
129
|
+
close = event.close === "true";
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
close = true;
|
|
133
|
+
}
|
|
134
|
+
if (event.retries) {
|
|
135
|
+
uploadModel.retries = Number(event.retries);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
close = true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
let consoleStack = [];
|
|
143
|
+
try {
|
|
144
|
+
yield log.push('When', `Starting puppeteer process`, StatusOfStep.PASSED);
|
|
145
|
+
yield this.startBrowser();
|
|
146
|
+
this.defaultPage.on('console', (message) => consoleStack.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
147
|
+
.on('pageerror', ({ message }) => consoleStack.push(message))
|
|
148
|
+
.on('response', (response) => consoleStack.push(`${response.status()} ${response.url()}`))
|
|
149
|
+
.on('requestfailed', (request) => { var _a; return consoleStack.push(`${request.failure() !== null ? (_a = request.failure()) === null || _a === void 0 ? void 0 : _a.errorText : ""} ${request.url()}`); });
|
|
150
|
+
yield callback(event);
|
|
151
|
+
log.push('When', `Finished puppeteer process`, StatusOfStep.PASSED);
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
console.log("Error message: \n", err);
|
|
155
|
+
let browser_start_retry = err.toString().includes("Failed to launch the browser process!");
|
|
156
|
+
if (browser_start_retry) {
|
|
157
|
+
yield retrySuite([], '', uploadModel.currentSuite, uploadModel.retries);
|
|
158
|
+
return { statusCode: 204 };
|
|
159
|
+
}
|
|
160
|
+
errMessage = err;
|
|
161
|
+
log.push('When', `Finished puppeteer process`, StatusOfStep.FAILED);
|
|
162
|
+
return errMessage;
|
|
163
|
+
}
|
|
164
|
+
if (close)
|
|
165
|
+
yield this.close();
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
console.log("Lib error:", e);
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
log.clear();
|
|
172
|
+
}
|
|
173
|
+
return { statusCode: 200 };
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
static setupHeader(event, uploadModel) {
|
|
177
|
+
let close = true;
|
|
178
|
+
if (process.env.ENVIRONMENT !== 'LOCAL' && event) {
|
|
179
|
+
uploadModel.reportId = event.reportId;
|
|
180
|
+
uploadModel.nextSuites = event.nextSuites;
|
|
181
|
+
uploadModel.currentSuite = event.currentSuite;
|
|
182
|
+
uploadModel.retries = Number(event.retries);
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
if (event.close) {
|
|
186
|
+
close = event.close === "true";
|
|
187
|
+
}
|
|
188
|
+
return close;
|
|
189
|
+
}
|
|
190
|
+
catch (e) {
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
export default new Puppeteer();
|