@auxcode/auxta 1.3.121 → 1.3.123
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 +0 -2
- package/build/AuxTA.js +2 -0
- package/build/auxta/models/upload.model.d.ts +4 -1
- package/build/auxta/models/upload.model.js +8 -1
- package/build/macros/helpers/code.helper.d.ts +1 -1
- package/build/macros/helpers/code.helper.js +1 -1
- package/build/puppeteer/puppeteer.d.ts +2 -2
- package/build/puppeteer/puppeteer.js +41 -24
- package/package.json +1 -1
package/build/AuxTA.d.ts
CHANGED
|
@@ -50,8 +50,6 @@ declare class AuxTA extends FunctionHelper {
|
|
|
50
50
|
reportId: string | undefined;
|
|
51
51
|
currentSuite: string | undefined;
|
|
52
52
|
retries: string;
|
|
53
|
-
} | {
|
|
54
|
-
statusCode: number;
|
|
55
53
|
} | undefined>;
|
|
56
54
|
startBrowserRPA(event: any, callback: any, baseURL: string, fileName?: string): Promise<any>;
|
|
57
55
|
getUploadModel(): UploadModel;
|
package/build/AuxTA.js
CHANGED
|
@@ -157,6 +157,8 @@ class AuxTA extends code_helper_1.FunctionHelper {
|
|
|
157
157
|
this.uploadModel.bucket = overrideConfig.bucket;
|
|
158
158
|
if (overrideConfig.isOfficial !== undefined)
|
|
159
159
|
this.uploadModel.isOfficial = overrideConfig.isOfficial;
|
|
160
|
+
if (overrideConfig.toRetry !== undefined)
|
|
161
|
+
this.uploadModel.toRetry = overrideConfig.toRetry;
|
|
160
162
|
this.config = (0, config_1.setupOverrideConfig)(overrideConfig);
|
|
161
163
|
}
|
|
162
164
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare class UploadModel {
|
|
2
2
|
private readonly _organization;
|
|
3
|
-
constructor(org: string, baseUrl: string, digitalProduct: string, environment: string, bucket: string, isOfficial: boolean);
|
|
3
|
+
constructor(org: string, baseUrl: string, digitalProduct: string, environment: string, bucket: string, isOfficial: boolean, toRetry?: boolean);
|
|
4
4
|
private _reportId;
|
|
5
5
|
get reportId(): string;
|
|
6
6
|
set reportId(value: string);
|
|
@@ -34,5 +34,8 @@ export declare class UploadModel {
|
|
|
34
34
|
private _isOfficial;
|
|
35
35
|
get isOfficial(): boolean;
|
|
36
36
|
set isOfficial(value: boolean);
|
|
37
|
+
private _toRetry;
|
|
38
|
+
get toRetry(): boolean;
|
|
39
|
+
set toRetry(value: boolean);
|
|
37
40
|
get organization(): string;
|
|
38
41
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UploadModel = void 0;
|
|
4
4
|
class UploadModel {
|
|
5
|
-
constructor(org, baseUrl, digitalProduct, environment, bucket, isOfficial) {
|
|
5
|
+
constructor(org, baseUrl, digitalProduct, environment, bucket, isOfficial, toRetry = false) {
|
|
6
6
|
this._reportId = '';
|
|
7
7
|
this._nextSuites = [];
|
|
8
8
|
this._currentSuite = '';
|
|
@@ -15,6 +15,7 @@ class UploadModel {
|
|
|
15
15
|
this._featureName = '';
|
|
16
16
|
this._scenarioName = '';
|
|
17
17
|
this._isOfficial = isOfficial;
|
|
18
|
+
this._toRetry = toRetry;
|
|
18
19
|
}
|
|
19
20
|
get reportId() {
|
|
20
21
|
return this._reportId;
|
|
@@ -82,6 +83,12 @@ class UploadModel {
|
|
|
82
83
|
set isOfficial(value) {
|
|
83
84
|
this._isOfficial = value;
|
|
84
85
|
}
|
|
86
|
+
get toRetry() {
|
|
87
|
+
return this._toRetry;
|
|
88
|
+
}
|
|
89
|
+
set toRetry(value) {
|
|
90
|
+
this._toRetry = value;
|
|
91
|
+
}
|
|
85
92
|
get organization() {
|
|
86
93
|
return this._organization;
|
|
87
94
|
}
|
|
@@ -3,7 +3,7 @@ import { ExtendDefaultPage } from "./extend-default-page";
|
|
|
3
3
|
import { CDPSession } from "puppeteer";
|
|
4
4
|
export declare class FunctionHelper extends ExtendDefaultPage {
|
|
5
5
|
cdp: CDPSession | undefined;
|
|
6
|
-
log(keyword: string, name: string, status: StatusOfStep, screenshot?: Uint8Array
|
|
6
|
+
log(keyword: string, name: string, status: StatusOfStep, screenshot?: Uint8Array | Buffer): void;
|
|
7
7
|
setTag(tag: string): void;
|
|
8
8
|
clearTag(): void;
|
|
9
9
|
callREST(method: string, url: string, headers?: object, body?: object): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
@@ -273,7 +273,7 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
|
273
273
|
yield this.timeout(1000);
|
|
274
274
|
yield loginPage.keyboard.press('Enter');
|
|
275
275
|
if (staySignIn) {
|
|
276
|
-
yield this.waitForResponse('
|
|
276
|
+
yield this.waitForResponse('4_eae2dd7eb3a55636dc2d74f4fa4c386e', true, loginPage);
|
|
277
277
|
yield this.timeout(1000);
|
|
278
278
|
yield loginPage.keyboard.press('Enter');
|
|
279
279
|
}
|
|
@@ -6,6 +6,8 @@ export declare class Puppeteer {
|
|
|
6
6
|
private static setupHeader;
|
|
7
7
|
startBrowser(): Promise<void>;
|
|
8
8
|
close(): Promise<void>;
|
|
9
|
+
private initiateBrowser;
|
|
10
|
+
private logFail;
|
|
9
11
|
run(event: any, callback: any, featureName?: string, scenarioName?: string, uploadModel?: UploadModel): Promise<{
|
|
10
12
|
nextSuites?: undefined;
|
|
11
13
|
reportId?: undefined;
|
|
@@ -16,8 +18,6 @@ export declare class Puppeteer {
|
|
|
16
18
|
reportId: string | undefined;
|
|
17
19
|
currentSuite: string | undefined;
|
|
18
20
|
retries: string;
|
|
19
|
-
} | {
|
|
20
|
-
statusCode: number;
|
|
21
21
|
} | undefined>;
|
|
22
22
|
runRPA(event: any, callback: any, uploadModel?: UploadModel, close?: boolean): Promise<any>;
|
|
23
23
|
}
|
|
@@ -79,6 +79,22 @@ class Puppeteer {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
initiateBrowser(consoleMessage, httpsMessage) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
yield this.startBrowser();
|
|
85
|
+
this.defaultPage.on('console', (message) => consoleMessage.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
86
|
+
.on('pageerror', ({ message }) => consoleMessage.push(message))
|
|
87
|
+
.on('response', (response) => httpsMessage.push(`${response.status()} ${response.url()}`))
|
|
88
|
+
.on('requestfailed', (request) => { var _a; return httpsMessage.push(`${request.failure() !== null ? (_a = request.failure()) === null || _a === void 0 ? void 0 : _a.errorText : ""} ${request.url()}`); });
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
logFail(consoleMessage) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const pages = yield this.defaultPage.browser().pages();
|
|
94
|
+
consoleMessage.push('pages');
|
|
95
|
+
consoleMessage.push(pages.length);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
82
98
|
run(event_1, callback_1) {
|
|
83
99
|
return __awaiter(this, arguments, void 0, function* (event, callback, featureName = 'Test feature', scenarioName = 'Test scenario', uploadModel) {
|
|
84
100
|
let close;
|
|
@@ -95,39 +111,40 @@ class Puppeteer {
|
|
|
95
111
|
let statusCode = 200;
|
|
96
112
|
let consoleMessage = [];
|
|
97
113
|
let httpsMessage = [];
|
|
114
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Starting puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
98
115
|
try {
|
|
99
|
-
|
|
100
|
-
yield this.startBrowser();
|
|
101
|
-
this.defaultPage.on('console', (message) => consoleMessage.push(`${message.type().substr(0, 3).toUpperCase()} ${message.text()}`))
|
|
102
|
-
.on('pageerror', ({ message }) => consoleMessage.push(message))
|
|
103
|
-
.on('response', (response) => httpsMessage.push(`${response.status()} ${response.url()}`))
|
|
104
|
-
.on('requestfailed', (request) => { var _a; return httpsMessage.push(`${request.failure() !== null ? (_a = request.failure()) === null || _a === void 0 ? void 0 : _a.errorText : ""} ${request.url()}`); });
|
|
116
|
+
yield this.initiateBrowser(consoleMessage, httpsMessage);
|
|
105
117
|
yield callback(event);
|
|
106
118
|
log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
107
119
|
}
|
|
108
120
|
catch (err) {
|
|
109
121
|
console.log("Error message: \n", err);
|
|
110
122
|
if (process.env.ENVIRONMENT !== 'LOCAL') {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
if (uploadModel.toRetry) {
|
|
124
|
+
log_service_1.default.clear();
|
|
125
|
+
log_service_1.default.clearTag();
|
|
126
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Retrying puppeteer process`, status_of_step_1.StatusOfStep.PASSED);
|
|
127
|
+
try {
|
|
128
|
+
yield this.close();
|
|
129
|
+
yield this.initiateBrowser(consoleMessage, httpsMessage);
|
|
130
|
+
yield callback(event);
|
|
131
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process from the 2nd try`, status_of_step_1.StatusOfStep.PASSED);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
this.logFail(consoleMessage);
|
|
135
|
+
errMessage = err;
|
|
136
|
+
statusCode = 500;
|
|
137
|
+
screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshot)();
|
|
138
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Failed puppeteer process from the 2nd try`, status_of_step_1.StatusOfStep.FAILED);
|
|
124
139
|
}
|
|
125
|
-
return { statusCode: 204 };
|
|
126
140
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
else {
|
|
142
|
+
this.logFail(consoleMessage);
|
|
143
|
+
errMessage = err;
|
|
144
|
+
statusCode = 500;
|
|
145
|
+
screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshot)();
|
|
146
|
+
log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
|
|
147
|
+
}
|
|
131
148
|
}
|
|
132
149
|
}
|
|
133
150
|
let url = this.defaultPage.url();
|