@auxcode/auxta 1.3.132 → 1.3.133

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.
Files changed (37) hide show
  1. package/build/AuxTA.d.ts +60 -0
  2. package/build/AuxTA.js +168 -0
  3. package/build/auxta/configs/config.d.ts +63 -0
  4. package/build/auxta/configs/config.js +78 -0
  5. package/build/auxta/enums/status-of.step.d.ts +9 -0
  6. package/build/auxta/enums/status-of.step.js +13 -0
  7. package/build/auxta/helpers/response.helper.d.ts +9 -0
  8. package/build/auxta/helpers/response.helper.js +14 -0
  9. package/build/auxta/helpers/start.helper.d.ts +1 -0
  10. package/build/auxta/helpers/start.helper.js +26 -0
  11. package/build/auxta/hooks/report.hook.d.ts +13 -0
  12. package/build/auxta/hooks/report.hook.js +68 -0
  13. package/build/auxta/models/upload.model.d.ts +41 -0
  14. package/build/auxta/models/upload.model.js +96 -0
  15. package/build/auxta/services/log.service.d.ts +39 -0
  16. package/build/auxta/services/log.service.js +109 -0
  17. package/build/auxta/services/report.service.d.ts +41 -0
  18. package/build/auxta/services/report.service.js +269 -0
  19. package/build/auxta/services/runtime.service.d.ts +16 -0
  20. package/build/auxta/services/runtime.service.js +40 -0
  21. package/build/auxta/utilities/runtime.helper.d.ts +15 -0
  22. package/build/auxta/utilities/runtime.helper.js +19 -0
  23. package/build/auxta/utilities/screenshot.helper.d.ts +3 -0
  24. package/build/auxta/utilities/screenshot.helper.js +100 -0
  25. package/build/auxta/utilities/start-suite.helper.d.ts +17 -0
  26. package/build/auxta/utilities/start-suite.helper.js +30 -0
  27. package/build/macros/helpers/Aux2faAuth.d.ts +7 -0
  28. package/build/macros/helpers/Aux2faAuth.js +29 -0
  29. package/build/macros/helpers/code.helper.d.ts +34 -0
  30. package/build/macros/helpers/code.helper.js +352 -0
  31. package/build/macros/helpers/emailHelper.d.ts +7 -0
  32. package/build/macros/helpers/emailHelper.js +54 -0
  33. package/build/macros/helpers/extend-default-page.d.ts +6 -0
  34. package/build/macros/helpers/extend-default-page.js +92 -0
  35. package/build/puppeteer/puppeteer.d.ts +35 -0
  36. package/build/puppeteer/puppeteer.js +339 -0
  37. package/package.json +1 -1
@@ -0,0 +1,60 @@
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
+ declare class AuxTA extends FunctionHelper {
6
+ puppeteer: Puppeteer;
7
+ aux2fa: import("./macros/helpers/Aux2faAuth").Aux2faAuth;
8
+ config: {
9
+ auxtaURL: string;
10
+ baseURL: string;
11
+ siteURL: string;
12
+ organization: string;
13
+ netlifyPath: string;
14
+ digitalProduct: string;
15
+ bucket: string;
16
+ token: string;
17
+ screenWidth: number;
18
+ screenHeight: number;
19
+ timeout: number;
20
+ suitesList: never[];
21
+ googleEmail: string;
22
+ auxtaCredentials: {
23
+ email: string;
24
+ password: string;
25
+ };
26
+ timezone: string;
27
+ emailProvider: string;
28
+ };
29
+ email: import("./macros/helpers/emailHelper").EmailHelper;
30
+ private readonly uploadModel;
31
+ constructor();
32
+ run(event: any, overrideConfig?: any): Promise<{
33
+ nextSuites?: undefined;
34
+ reportId?: undefined;
35
+ currentSuite?: undefined;
36
+ retries?: undefined;
37
+ } | {
38
+ nextSuites: string[];
39
+ reportId: string | undefined;
40
+ currentSuite: string | undefined;
41
+ retries: string;
42
+ }>;
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
+ } | undefined>;
54
+ startBrowserRPA(event: any, callback: any, baseURL: string, fileName?: string): Promise<any>;
55
+ getUploadModel(): UploadModel;
56
+ private changeModelData;
57
+ }
58
+ export declare const StepStatus: typeof StatusOfStep;
59
+ declare const auxta: AuxTA;
60
+ export default auxta;
package/build/AuxTA.js ADDED
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.StepStatus = void 0;
49
+ const puppeteer_1 = __importDefault(require("./puppeteer/puppeteer"));
50
+ const code_helper_1 = require("./macros/helpers/code.helper");
51
+ const path_1 = __importDefault(require("path"));
52
+ const fs_1 = __importDefault(require("fs"));
53
+ const status_of_step_1 = __importDefault(require("./auxta/enums/status-of.step"));
54
+ const upload_model_1 = require("./auxta/models/upload.model");
55
+ const dotenv = __importStar(require("dotenv"));
56
+ const config_1 = require("./auxta/configs/config");
57
+ const start_suite_helper_1 = require("./auxta/utilities/start-suite.helper");
58
+ const report_service_1 = require("./auxta/services/report.service");
59
+ const Aux2faAuth_1 = __importDefault(require("./macros/helpers/Aux2faAuth"));
60
+ const emailHelper_1 = __importDefault(require("./macros/helpers/emailHelper"));
61
+ dotenv.config();
62
+ class AuxTA extends code_helper_1.FunctionHelper {
63
+ constructor() {
64
+ super();
65
+ this.puppeteer = puppeteer_1.default;
66
+ this.aux2fa = Aux2faAuth_1.default;
67
+ this.config = config_1.config;
68
+ this.email = emailHelper_1.default;
69
+ let file;
70
+ if (!process.env.RPA) {
71
+ try {
72
+ let currentDir = "";
73
+ while (true) {
74
+ file = path_1.default.join(__dirname, currentDir, "auxta.json");
75
+ if (!fs_1.default.existsSync(file)) {
76
+ currentDir += "../";
77
+ if (currentDir.length >= 30) {
78
+ console.log("auxta.json file not found!");
79
+ process.exit(1);
80
+ return;
81
+ }
82
+ continue;
83
+ }
84
+ break;
85
+ }
86
+ const jsonConfig = JSON.parse(fs_1.default.readFileSync(file).toString());
87
+ try {
88
+ this.config = (0, config_1.setupConfig)(jsonConfig);
89
+ }
90
+ catch (e) {
91
+ console.log("Missing field in auxta.json:", e);
92
+ }
93
+ this.uploadModel = new upload_model_1.UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment, jsonConfig.bucket, true);
94
+ }
95
+ catch (e) {
96
+ console.log("Missing or corrupted config: auxta.json. Searching in location:", file);
97
+ console.log(e);
98
+ process.exit(1);
99
+ }
100
+ }
101
+ else {
102
+ this.uploadModel = new upload_model_1.UploadModel('', '', '', '', '', true);
103
+ }
104
+ }
105
+ run(event, overrideConfig) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ this.changeModelData(overrideConfig);
108
+ let reportId;
109
+ try {
110
+ if (event.reportId) {
111
+ reportId = event.reportId;
112
+ }
113
+ }
114
+ catch (e) {
115
+ reportId = undefined;
116
+ }
117
+ const suites = this.config.suitesList.slice(0);
118
+ return (0, start_suite_helper_1.startSuite)(suites, reportId || (yield (0, report_service_1.createEmptyReport)(this.uploadModel)));
119
+ });
120
+ }
121
+ startBrowser(event_1, callback_1, feature_1, scenario_1, overrideConfig_1) {
122
+ return __awaiter(this, arguments, void 0, function* (event, callback, feature, scenario, overrideConfig, singleFeature = false, fileName = '') {
123
+ this.changeModelData(overrideConfig);
124
+ if (singleFeature && process.env.ENVIRONMENT !== 'LOCAL') {
125
+ this.uploadModel.reportId = yield (0, report_service_1.createEmptyReport)(this.uploadModel);
126
+ this.uploadModel.currentSuite = fileName;
127
+ this.uploadModel.nextSuites = [];
128
+ yield (0, report_service_1.setTimeZone)();
129
+ yield (0, report_service_1.setEmailProvider)();
130
+ }
131
+ return this.puppeteer.run(event, callback, feature, scenario);
132
+ });
133
+ }
134
+ startBrowserRPA(event_1, callback_1, baseURL_1) {
135
+ return __awaiter(this, arguments, void 0, function* (event, callback, baseURL, fileName = '') {
136
+ this.changeModelData({
137
+ baseURL: baseURL,
138
+ environment: '',
139
+ digitalProduct: ''
140
+ });
141
+ this.uploadModel.currentSuite = fileName;
142
+ return this.puppeteer.runRPA(event, callback);
143
+ });
144
+ }
145
+ getUploadModel() {
146
+ return this.uploadModel;
147
+ }
148
+ changeModelData(overrideConfig) {
149
+ if (overrideConfig) {
150
+ if (overrideConfig.digitalProduct)
151
+ this.uploadModel.digitalProduct = overrideConfig.digitalProduct;
152
+ if (overrideConfig.environment)
153
+ this.uploadModel.environment = overrideConfig.environment;
154
+ if (overrideConfig.baseURL)
155
+ this.uploadModel.baseUrl = overrideConfig.baseURL;
156
+ if (overrideConfig.bucket)
157
+ this.uploadModel.bucket = overrideConfig.bucket;
158
+ if (overrideConfig.isOfficial !== undefined)
159
+ this.uploadModel.isOfficial = overrideConfig.isOfficial;
160
+ if (overrideConfig.toRetry !== undefined)
161
+ this.uploadModel.toRetry = overrideConfig.toRetry;
162
+ this.config = (0, config_1.setupOverrideConfig)(overrideConfig);
163
+ }
164
+ }
165
+ }
166
+ exports.StepStatus = status_of_step_1.default;
167
+ const auxta = new AuxTA();
168
+ exports.default = auxta;
@@ -0,0 +1,63 @@
1
+ export declare function setupConfig(jsonConfig: any): {
2
+ auxtaURL: string;
3
+ baseURL: string;
4
+ siteURL: string;
5
+ organization: string;
6
+ netlifyPath: string;
7
+ digitalProduct: string;
8
+ bucket: string;
9
+ token: string;
10
+ screenWidth: number;
11
+ screenHeight: number;
12
+ timeout: number;
13
+ suitesList: never[];
14
+ googleEmail: string;
15
+ auxtaCredentials: {
16
+ email: string;
17
+ password: string;
18
+ };
19
+ timezone: string;
20
+ emailProvider: string;
21
+ };
22
+ export declare function setupOverrideConfig(overrideConfig: any): {
23
+ auxtaURL: string;
24
+ baseURL: string;
25
+ siteURL: string;
26
+ organization: string;
27
+ netlifyPath: string;
28
+ digitalProduct: string;
29
+ bucket: string;
30
+ token: string;
31
+ screenWidth: number;
32
+ screenHeight: number;
33
+ timeout: number;
34
+ suitesList: never[];
35
+ googleEmail: string;
36
+ auxtaCredentials: {
37
+ email: string;
38
+ password: string;
39
+ };
40
+ timezone: string;
41
+ emailProvider: string;
42
+ };
43
+ export declare let config: {
44
+ auxtaURL: string;
45
+ baseURL: string;
46
+ siteURL: string;
47
+ organization: string;
48
+ netlifyPath: string;
49
+ digitalProduct: string;
50
+ bucket: string;
51
+ token: string;
52
+ screenWidth: number;
53
+ screenHeight: number;
54
+ timeout: number;
55
+ suitesList: never[];
56
+ googleEmail: string;
57
+ auxtaCredentials: {
58
+ email: string;
59
+ password: string;
60
+ };
61
+ timezone: string;
62
+ emailProvider: string;
63
+ };
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = void 0;
4
+ exports.setupConfig = setupConfig;
5
+ exports.setupOverrideConfig = setupOverrideConfig;
6
+ function setupConfig(jsonConfig) {
7
+ if (!jsonConfig.baseURL)
8
+ throw new Error("baseURL");
9
+ exports.config.baseURL = jsonConfig.baseURL;
10
+ if (!jsonConfig.auxtaURL)
11
+ throw new Error("auxtaURL missing");
12
+ exports.config.auxtaURL = jsonConfig.auxtaURL;
13
+ if (jsonConfig.emailProvider)
14
+ exports.config.emailProvider = jsonConfig.emailProvider;
15
+ if (jsonConfig.timezone)
16
+ exports.config.timezone = jsonConfig.timezone;
17
+ if (!jsonConfig.digitalProduct)
18
+ throw new Error("digitalProduct");
19
+ exports.config.digitalProduct = jsonConfig.digitalProduct;
20
+ if (!jsonConfig.testsURL)
21
+ throw new Error("testsURL");
22
+ exports.config.bucket = jsonConfig.bucket;
23
+ if (!jsonConfig.testsURL)
24
+ throw new Error("testsURL");
25
+ exports.config.netlifyPath = (process.env.ENVIRONMENT == 'LOCAL') ? 'http://localhost:9999/' : jsonConfig.testsURL;
26
+ if (!jsonConfig.organization)
27
+ throw new Error("organization");
28
+ exports.config.organization = jsonConfig.organization;
29
+ if (!jsonConfig.email)
30
+ throw new Error("email");
31
+ exports.config.auxtaCredentials.email = jsonConfig.email;
32
+ if (!process.env.auxta_password)
33
+ throw new Error("password");
34
+ exports.config.auxtaCredentials.password = process.env.auxta_password;
35
+ if (!jsonConfig.suitesList)
36
+ throw new Error("suitesList");
37
+ exports.config.suitesList = jsonConfig.suitesList;
38
+ exports.config.googleEmail = jsonConfig.googleEmail;
39
+ if (jsonConfig.timeout)
40
+ exports.config.timeout = jsonConfig.timeout;
41
+ if (jsonConfig.screenWidth)
42
+ exports.config.screenWidth = jsonConfig.screenWidth;
43
+ if (jsonConfig.screenHeight)
44
+ exports.config.screenHeight = jsonConfig.screenHeight;
45
+ return exports.config;
46
+ }
47
+ function setupOverrideConfig(overrideConfig) {
48
+ if (overrideConfig.baseURL)
49
+ exports.config.baseURL = overrideConfig.baseURL;
50
+ if (overrideConfig.digitalProduct)
51
+ exports.config.digitalProduct = overrideConfig.digitalProduct;
52
+ if (overrideConfig.screenWidth)
53
+ exports.config.screenWidth = overrideConfig.screenWidth;
54
+ if (overrideConfig.screenHeight)
55
+ exports.config.screenHeight = overrideConfig.screenHeight;
56
+ return exports.config;
57
+ }
58
+ exports.config = {
59
+ auxtaURL: "",
60
+ baseURL: "",
61
+ siteURL: "",
62
+ organization: "",
63
+ netlifyPath: "",
64
+ digitalProduct: "",
65
+ bucket: "",
66
+ token: "",
67
+ screenWidth: 1920,
68
+ screenHeight: 1080,
69
+ timeout: 60000,
70
+ suitesList: [],
71
+ googleEmail: "",
72
+ auxtaCredentials: {
73
+ email: "",
74
+ password: "",
75
+ },
76
+ timezone: "Europe/Brussels",
77
+ emailProvider: "Mailgun"
78
+ };
@@ -0,0 +1,9 @@
1
+ export declare enum StatusOfStep {
2
+ PASSED = "passed",
3
+ FAILED = "failed",
4
+ SKIPPED = "skipped",
5
+ SUGGESTION = "suggestion",
6
+ PERFORMANCE_FAIL = "performanceFailure",
7
+ LOG = "log"
8
+ }
9
+ export default StatusOfStep;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatusOfStep = void 0;
4
+ var StatusOfStep;
5
+ (function (StatusOfStep) {
6
+ StatusOfStep["PASSED"] = "passed";
7
+ StatusOfStep["FAILED"] = "failed";
8
+ StatusOfStep["SKIPPED"] = "skipped";
9
+ StatusOfStep["SUGGESTION"] = "suggestion";
10
+ StatusOfStep["PERFORMANCE_FAIL"] = "performanceFailure";
11
+ StatusOfStep["LOG"] = "log";
12
+ })(StatusOfStep || (exports.StatusOfStep = StatusOfStep = {}));
13
+ exports.default = StatusOfStep;
@@ -0,0 +1,9 @@
1
+ export declare function returnImage(code: number, screenshot: Buffer): {
2
+ isBase64Encoded: boolean;
3
+ statusCode: number;
4
+ headers: {
5
+ "Content-Type": string;
6
+ "Content-Length": string;
7
+ };
8
+ body: Buffer<ArrayBufferLike>;
9
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.returnImage = returnImage;
4
+ function returnImage(code, screenshot) {
5
+ return {
6
+ isBase64Encoded: true,
7
+ statusCode: code,
8
+ headers: {
9
+ "Content-Type": "image/png",
10
+ "Content-Length": screenshot.length.toString()
11
+ },
12
+ body: screenshot
13
+ };
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const path_1 = require("path");
13
+ (() => __awaiter(void 0, void 0, void 0, function* () {
14
+ const r = /^--params\.suite=(.*)$/g;
15
+ let suite = process.argv.find(el => !!el.match(r));
16
+ if (!suite)
17
+ throw `Locale is undefined`;
18
+ let suites = suite.replace('--params.suite=', '');
19
+ let suitesArr = suites.split(',');
20
+ if (!suitesArr)
21
+ suitesArr = [suites];
22
+ for (const suite of suitesArr) {
23
+ let f = require((0, path_1.join)(process.cwd(), 'build', 'functions', 'controllers', suite));
24
+ yield f.handler();
25
+ }
26
+ }))();
@@ -0,0 +1,13 @@
1
+ import { UploadModel } from "../models/upload.model";
2
+ export declare function onTestEnd(body: any, featureName: string, scenarioName: string, statusCode: number, screenshotBuffer?: Buffer, errMessage?: object): Promise<{
3
+ nextSuites?: undefined;
4
+ reportId?: undefined;
5
+ currentSuite?: undefined;
6
+ retries?: undefined;
7
+ } | {
8
+ nextSuites: string[];
9
+ reportId: string | undefined;
10
+ currentSuite: string | undefined;
11
+ retries: string;
12
+ } | undefined>;
13
+ export declare function afterComplete(body: UploadModel): Promise<void>;
@@ -0,0 +1,68 @@
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.onTestEnd = onTestEnd;
16
+ exports.afterComplete = afterComplete;
17
+ const path_1 = require("path");
18
+ const log_service_1 = __importDefault(require("../services/log.service"));
19
+ const report_service_1 = require("../services/report.service");
20
+ const start_suite_helper_1 = require("../utilities/start-suite.helper");
21
+ const status_of_step_1 = require("../enums/status-of.step");
22
+ function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer, errMessage) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ let isFinal = false;
25
+ if (process.env.ENVIRONMENT == "LIVE") {
26
+ console.log('--- Uploading scenario and feature for AUXTA report ---');
27
+ const stepsArr = log_service_1.default.returnScenarioReport();
28
+ try {
29
+ const stepRes = yield (0, report_service_1.uploadStep)(stepsArr, scenarioName, screenshotBuffer, errMessage);
30
+ const scenarioRes = yield (0, report_service_1.uploadScenario)(stepRes, featureName, (0, path_1.basename)(__filename), (statusCode != 200));
31
+ const scenario = {
32
+ scenarioId: scenarioRes.scenarioRef,
33
+ scenarioName: scenarioRes.name,
34
+ scenarioUri: scenarioRes.uri,
35
+ status: scenarioRes.status,
36
+ scenariosCount: scenarioRes.scenariosCount,
37
+ lastTag: scenarioRes.lastTag
38
+ };
39
+ const stepCounts = {
40
+ failedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.FAILED),
41
+ passedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.PASSED),
42
+ skippedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SKIPPED),
43
+ suggestedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SUGGESTION),
44
+ performanceFailure: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.PERFORMANCE_FAIL),
45
+ log: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.LOG)
46
+ };
47
+ isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
48
+ yield (0, report_service_1.updateReport)(body.reportId, scenario, stepCounts, isFinal);
49
+ console.log('--- Finished uploading report data to AUXTA ---');
50
+ }
51
+ catch (error) {
52
+ console.log('--- Failed to update report in AUXTA ---');
53
+ console.log(error);
54
+ }
55
+ }
56
+ if (isFinal)
57
+ yield afterComplete(body);
58
+ else if (body && body.nextSuites) {
59
+ return yield (0, start_suite_helper_1.startSuite)(body.nextSuites, body.reportId);
60
+ }
61
+ });
62
+ }
63
+ function afterComplete(body) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ if (process.env.ENVIRONMENT == "LIVE")
66
+ yield (0, report_service_1.postNotifications)(body);
67
+ });
68
+ }
@@ -0,0 +1,41 @@
1
+ export declare class UploadModel {
2
+ private readonly _organization;
3
+ constructor(org: string, baseUrl: string, digitalProduct: string, environment: string, bucket: string, isOfficial: boolean, toRetry?: boolean);
4
+ private _reportId;
5
+ get reportId(): string;
6
+ set reportId(value: string);
7
+ private _nextSuites;
8
+ get nextSuites(): [];
9
+ set nextSuites(value: []);
10
+ private _digitalProduct;
11
+ get digitalProduct(): string;
12
+ set digitalProduct(value: string);
13
+ private _baseUrl;
14
+ get baseUrl(): string;
15
+ set baseUrl(value: string);
16
+ private _bucket;
17
+ get bucket(): string;
18
+ set bucket(value: string);
19
+ private _environment;
20
+ get environment(): string;
21
+ set environment(value: string);
22
+ private _currentSuite;
23
+ get currentSuite(): string;
24
+ set currentSuite(value: string);
25
+ private _retries;
26
+ get retries(): number;
27
+ set retries(value: number);
28
+ private _featureName;
29
+ get featureName(): string;
30
+ set featureName(value: string);
31
+ private _scenarioName;
32
+ get scenarioName(): string;
33
+ set scenarioName(value: string);
34
+ private _isOfficial;
35
+ get isOfficial(): boolean;
36
+ set isOfficial(value: boolean);
37
+ private _toRetry;
38
+ get toRetry(): boolean;
39
+ set toRetry(value: boolean);
40
+ get organization(): string;
41
+ }
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UploadModel = void 0;
4
+ class UploadModel {
5
+ constructor(org, baseUrl, digitalProduct, environment, bucket, isOfficial, toRetry = false) {
6
+ this._reportId = '';
7
+ this._nextSuites = [];
8
+ this._currentSuite = '';
9
+ this._retries = 0;
10
+ this._organization = org;
11
+ this._bucket = bucket;
12
+ this._digitalProduct = digitalProduct;
13
+ this._environment = environment;
14
+ this._baseUrl = baseUrl;
15
+ this._featureName = '';
16
+ this._scenarioName = '';
17
+ this._isOfficial = isOfficial;
18
+ this._toRetry = toRetry;
19
+ }
20
+ get reportId() {
21
+ return this._reportId;
22
+ }
23
+ set reportId(value) {
24
+ this._reportId = value;
25
+ }
26
+ get nextSuites() {
27
+ return this._nextSuites;
28
+ }
29
+ set nextSuites(value) {
30
+ this._nextSuites = value;
31
+ }
32
+ get digitalProduct() {
33
+ return this._digitalProduct;
34
+ }
35
+ set digitalProduct(value) {
36
+ this._digitalProduct = value;
37
+ }
38
+ get baseUrl() {
39
+ return this._baseUrl;
40
+ }
41
+ set baseUrl(value) {
42
+ this._baseUrl = value;
43
+ }
44
+ get bucket() {
45
+ return this._bucket;
46
+ }
47
+ set bucket(value) {
48
+ this._bucket = value;
49
+ }
50
+ get environment() {
51
+ return this._environment;
52
+ }
53
+ set environment(value) {
54
+ this._environment = value;
55
+ }
56
+ get currentSuite() {
57
+ return this._currentSuite;
58
+ }
59
+ set currentSuite(value) {
60
+ this._currentSuite = value;
61
+ }
62
+ get retries() {
63
+ return this._retries;
64
+ }
65
+ set retries(value) {
66
+ this._retries = value;
67
+ }
68
+ get featureName() {
69
+ return this._featureName;
70
+ }
71
+ set featureName(value) {
72
+ this._featureName = value;
73
+ }
74
+ get scenarioName() {
75
+ return this._scenarioName;
76
+ }
77
+ set scenarioName(value) {
78
+ this._scenarioName = value;
79
+ }
80
+ get isOfficial() {
81
+ return this._isOfficial;
82
+ }
83
+ set isOfficial(value) {
84
+ this._isOfficial = value;
85
+ }
86
+ get toRetry() {
87
+ return this._toRetry;
88
+ }
89
+ set toRetry(value) {
90
+ this._toRetry = value;
91
+ }
92
+ get organization() {
93
+ return this._organization;
94
+ }
95
+ }
96
+ exports.UploadModel = UploadModel;