@auxcode/auxta 0.2.5 → 0.2.6
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/package.json
CHANGED
|
@@ -42,7 +42,7 @@ export async function onTestEnd(body: any, featureName: string, scenarioName: st
|
|
|
42
42
|
console.log(error)
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
if (isFinal) await afterComplete(body
|
|
45
|
+
if (isFinal) await afterComplete(body);
|
|
46
46
|
else if (body && body.nextSuites && body.nextSuites[0])
|
|
47
47
|
try {
|
|
48
48
|
await startSuite(body.nextSuites, body.reportId);
|
|
@@ -50,7 +50,7 @@ export async function onTestEnd(body: any, featureName: string, scenarioName: st
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export async function afterComplete(
|
|
53
|
+
export async function afterComplete(body: UploadModel) {
|
|
54
54
|
if (process.env.ENVIRONMENT == "LIVE")
|
|
55
|
-
await postNotifications(
|
|
55
|
+
await postNotifications(body);
|
|
56
56
|
}
|
|
@@ -167,12 +167,23 @@ export async function getLastDayResults(): Promise<any> {
|
|
|
167
167
|
)).data.results;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
export async function postNotifications(
|
|
170
|
+
export async function postNotifications( body: UploadModel) {
|
|
171
171
|
let token = await auth();
|
|
172
172
|
await axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
|
|
173
173
|
environmentName: body.environment,
|
|
174
174
|
digitalProductName: body.digitalProduct,
|
|
175
175
|
organizationName: body.organization,
|
|
176
|
-
reportId: reportId,
|
|
176
|
+
reportId: body.reportId,
|
|
177
|
+
}, headers(token));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
export async function postNotificationsOnFail( body: UploadModel) {
|
|
182
|
+
let token = await auth();
|
|
183
|
+
await axios.post(`${config.auxtaURL}post-notification-after-case-fail-background`, {
|
|
184
|
+
environmentName: body.environment,
|
|
185
|
+
digitalProductName: body.digitalProduct,
|
|
186
|
+
organizationName: body.organization,
|
|
187
|
+
reportId: body.reportId,
|
|
177
188
|
}, headers(token));
|
|
178
189
|
}
|
|
@@ -7,6 +7,7 @@ import { StatusOfStep } from "../auxta/enums/status-of.step";
|
|
|
7
7
|
import { UploadModel } from "../auxta/models/upload.model";
|
|
8
8
|
import puppeteer_core from 'puppeteer-core';
|
|
9
9
|
import { config } from "./../auxta/configs/config";
|
|
10
|
+
import { postNotificationsOnFail } from "../auxta/services/report.service";
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
export class Puppeteer {
|
|
@@ -24,9 +25,9 @@ export class Puppeteer {
|
|
|
24
25
|
if (process.env.ENVIRONMENT != 'LOCAL')
|
|
25
26
|
args.push(`--window-size=${config.screenWidth},${config.screenHeight}`)
|
|
26
27
|
this.browser = await chromium.puppeteer.launch({
|
|
27
|
-
executablePath: process.env.
|
|
28
|
+
executablePath: process.env.ENVIRONMENT === 'LOCAL' ? undefined : await chromium.executablePath,
|
|
28
29
|
args,
|
|
29
|
-
defaultViewport: process.env.ENVIRONMENT
|
|
30
|
+
defaultViewport: process.env.ENVIRONMENT === 'LOCAL' ? null : {
|
|
30
31
|
width: config.screenWidth,
|
|
31
32
|
height: config.screenHeight
|
|
32
33
|
},
|
|
@@ -66,13 +67,14 @@ export class Puppeteer {
|
|
|
66
67
|
consoleStack.push(`${request.failure().errorText} ${request.url()}`))
|
|
67
68
|
await callback(event)
|
|
68
69
|
screenshotBuffer = await captureScreenshot();
|
|
69
|
-
|
|
70
|
+
log.push('When', `Finished puppeteer process`, StatusOfStep.PASSED);
|
|
70
71
|
} catch (err) {
|
|
71
72
|
console.log(`Error ${err}`);
|
|
72
73
|
errMessage = err;
|
|
73
74
|
statusCode = 500;
|
|
74
75
|
screenshotBuffer = await captureScreenshot();
|
|
75
|
-
|
|
76
|
+
log.push('When', `Finished puppeteer process`, StatusOfStep.FAILED);
|
|
77
|
+
await postNotificationsOnFail(uploadModel)
|
|
76
78
|
}
|
|
77
79
|
let url = this.defaultPage.url();
|
|
78
80
|
if (close) await this.close();
|