@auxcode/auxta 0.5.3 → 0.5.4

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 (71) hide show
  1. package/build/cjs/AuxTA.d.ts +43 -0
  2. package/build/cjs/AuxTA.js +122 -0
  3. package/build/cjs/auxta/configs/config.d.ts +51 -0
  4. package/build/cjs/auxta/configs/config.js +66 -0
  5. package/build/cjs/auxta/enums/status-of.step.d.ts +7 -0
  6. package/build/cjs/auxta/enums/status-of.step.js +11 -0
  7. package/build/cjs/auxta/helpers/response.helper.d.ts +10 -0
  8. package/build/cjs/auxta/helpers/response.helper.js +15 -0
  9. package/build/cjs/auxta/helpers/start.helper.d.ts +1 -0
  10. package/build/cjs/auxta/helpers/start.helper.js +17 -0
  11. package/build/cjs/auxta/hooks/report.hook.d.ts +4 -0
  12. package/build/cjs/auxta/hooks/report.hook.js +53 -0
  13. package/build/cjs/auxta/models/upload.model.d.ts +20 -0
  14. package/build/cjs/auxta/models/upload.model.js +47 -0
  15. package/build/cjs/auxta/services/log.service.d.ts +26 -0
  16. package/build/cjs/auxta/services/log.service.js +47 -0
  17. package/build/cjs/auxta/services/report.service.d.ts +36 -0
  18. package/build/cjs/auxta/services/report.service.js +141 -0
  19. package/build/cjs/auxta/services/runtime.service.d.ts +16 -0
  20. package/build/cjs/auxta/services/runtime.service.js +41 -0
  21. package/build/cjs/auxta/utilities/runtime.helper.d.ts +15 -0
  22. package/build/cjs/auxta/utilities/runtime.helper.js +19 -0
  23. package/build/cjs/auxta/utilities/screenshot.helper.d.ts +2 -0
  24. package/build/cjs/auxta/utilities/screenshot.helper.js +25 -0
  25. package/build/cjs/auxta/utilities/start-suite.helper.d.ts +1 -0
  26. package/build/cjs/auxta/utilities/start-suite.helper.js +21 -0
  27. package/build/cjs/macros/helpers/code.helper.d.ts +22 -0
  28. package/build/cjs/macros/helpers/code.helper.js +165 -0
  29. package/build/cjs/puppeteer/puppeteer.d.ts +13 -0
  30. package/build/cjs/puppeteer/puppeteer.js +143 -0
  31. package/build/esm/AuxTA.d.ts +43 -0
  32. package/{src/AuxTA.ts → build/esm/AuxTA.js} +39 -46
  33. package/build/esm/auxta/configs/config.d.ts +51 -0
  34. package/build/esm/auxta/configs/config.js +61 -0
  35. package/build/esm/auxta/enums/status-of.step.d.ts +7 -0
  36. package/build/esm/auxta/enums/status-of.step.js +8 -0
  37. package/build/esm/auxta/helpers/response.helper.d.ts +10 -0
  38. package/{src/auxta/helpers/response.helper.ts → build/esm/auxta/helpers/response.helper.js} +1 -1
  39. package/build/esm/auxta/helpers/start.helper.d.ts +1 -0
  40. package/{src/auxta/helpers/start.helper.ts → build/esm/auxta/helpers/start.helper.js} +6 -5
  41. package/build/esm/auxta/hooks/report.hook.d.ts +4 -0
  42. package/{src/auxta/hooks/report.hook.ts → build/esm/auxta/hooks/report.hook.js} +17 -24
  43. package/build/esm/auxta/models/upload.model.d.ts +20 -0
  44. package/build/esm/auxta/models/upload.model.js +43 -0
  45. package/build/esm/auxta/services/log.service.d.ts +26 -0
  46. package/build/esm/auxta/services/log.service.js +43 -0
  47. package/build/esm/auxta/services/report.service.d.ts +36 -0
  48. package/build/esm/auxta/services/report.service.js +127 -0
  49. package/build/esm/auxta/services/runtime.service.d.ts +16 -0
  50. package/{src/auxta/services/runtime.service.ts → build/esm/auxta/services/runtime.service.js} +14 -28
  51. package/build/esm/auxta/utilities/runtime.helper.d.ts +15 -0
  52. package/{src/auxta/utilities/runtime.helper.ts → build/esm/auxta/utilities/runtime.helper.js} +3 -17
  53. package/build/esm/auxta/utilities/screenshot.helper.d.ts +2 -0
  54. package/{src/auxta/utilities/screenshot.helper.ts → build/esm/auxta/utilities/screenshot.helper.js} +10 -11
  55. package/build/esm/auxta/utilities/start-suite.helper.d.ts +1 -0
  56. package/build/esm/auxta/utilities/start-suite.helper.js +14 -0
  57. package/build/esm/macros/helpers/code.helper.d.ts +22 -0
  58. package/{src/macros/helpers/code.helper.ts → build/esm/macros/helpers/code.helper.js} +50 -98
  59. package/build/esm/puppeteer/puppeteer.d.ts +13 -0
  60. package/build/esm/puppeteer/puppeteer.js +136 -0
  61. package/build/tsconfig-cjs.tsbuildinfo +1 -0
  62. package/build/tsconfig.tsbuildinfo +1 -0
  63. package/package.json +9 -4
  64. package/src/auxta/configs/config.ts +0 -48
  65. package/src/auxta/enums/status-of.step.ts +0 -7
  66. package/src/auxta/models/upload.model.ts +0 -62
  67. package/src/auxta/services/log.service.ts +0 -58
  68. package/src/auxta/services/report.service.ts +0 -189
  69. package/src/auxta/utilities/start-suite.helper.ts +0 -16
  70. package/src/puppeteer/puppeteer.ts +0 -145
  71. package/tsconfig.json +0 -65
@@ -0,0 +1,43 @@
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
+ config: {
8
+ auxtaURL: string;
9
+ baseURL: string;
10
+ siteURL: string;
11
+ organization: string;
12
+ netlifyPath: string;
13
+ digitalProduct: string;
14
+ token: string;
15
+ screenWidth: number;
16
+ screenHeight: number;
17
+ timeout: number;
18
+ suitesList: never[];
19
+ auxtaCredentials: {
20
+ email: string;
21
+ password: string;
22
+ };
23
+ };
24
+ private readonly uploadModel;
25
+ constructor();
26
+ run(event: any, overrideConfig?: any): Promise<{
27
+ statusCode: number;
28
+ message: string;
29
+ } | {
30
+ statusCode: number;
31
+ message?: undefined;
32
+ }>;
33
+ private changeModelData;
34
+ startBrowser(event: any, callback: any, feature: string, scenario: string, overrideConfig?: any, singleFeature?: boolean): Promise<void | {
35
+ statusCode: number;
36
+ message: string;
37
+ }>;
38
+ startBrowserRPA(event: any, callback: any, baseURL: string): Promise<any>;
39
+ getUploadModel(): UploadModel;
40
+ }
41
+ export declare const StepStatus: typeof StatusOfStep;
42
+ declare const auxta: AuxTA;
43
+ export default auxta;
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.StepStatus = void 0;
26
+ const puppeteer_1 = __importDefault(require("./puppeteer/puppeteer"));
27
+ const code_helper_1 = require("./macros/helpers/code.helper");
28
+ const path_1 = __importDefault(require("path"));
29
+ const fs_1 = __importDefault(require("fs"));
30
+ const status_of_step_1 = __importDefault(require("./auxta/enums/status-of.step"));
31
+ const upload_model_1 = require("./auxta/models/upload.model");
32
+ const dotenv = __importStar(require("dotenv"));
33
+ const config_1 = require("./auxta/configs/config");
34
+ const start_suite_helper_1 = require("./auxta/utilities/start-suite.helper");
35
+ const report_service_1 = require("./auxta/services/report.service");
36
+ dotenv.config();
37
+ class AuxTA extends code_helper_1.FunctionHelper {
38
+ constructor() {
39
+ super();
40
+ this.puppeteer = puppeteer_1.default;
41
+ this.config = config_1.config;
42
+ let file;
43
+ if (!process.env.RPA) {
44
+ try {
45
+ let currentDir = "";
46
+ while (true) {
47
+ file = path_1.default.join(__dirname, currentDir, "auxta.json");
48
+ if (!fs_1.default.existsSync(file)) {
49
+ currentDir += "../";
50
+ if (currentDir.length >= 30) {
51
+ console.log("auxta.json file not found!");
52
+ process.exit(1);
53
+ return;
54
+ }
55
+ continue;
56
+ }
57
+ break;
58
+ }
59
+ const jsonConfig = JSON.parse(fs_1.default.readFileSync(file).toString());
60
+ try {
61
+ this.config = (0, config_1.setupConfig)(jsonConfig);
62
+ }
63
+ catch (e) {
64
+ console.log("Missing field in auxta.json:", e);
65
+ }
66
+ this.uploadModel = new upload_model_1.UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment);
67
+ }
68
+ catch (e) {
69
+ console.log("Missing or corrupted config: auxta.json. Searching in location:", file);
70
+ console.log(e);
71
+ process.exit(1);
72
+ }
73
+ }
74
+ else {
75
+ this.uploadModel = new upload_model_1.UploadModel('', '', '', '');
76
+ }
77
+ }
78
+ async run(event, overrideConfig) {
79
+ this.changeModelData(overrideConfig);
80
+ let reportId = event.queryStringParameters.reportId;
81
+ if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
82
+ return { statusCode: 401, message: 'Unauthorized' };
83
+ const suites = this.config.suitesList.slice(0);
84
+ await (0, start_suite_helper_1.startSuite)(suites, reportId || await (0, report_service_1.createEmptyReport)(this.uploadModel));
85
+ return { statusCode: 204 };
86
+ }
87
+ changeModelData(overrideConfig) {
88
+ if (overrideConfig) {
89
+ if (overrideConfig.digitalProduct)
90
+ this.uploadModel.digitalProduct = overrideConfig.digitalProduct;
91
+ if (overrideConfig.environment)
92
+ this.uploadModel.environment = overrideConfig.environment;
93
+ if (overrideConfig.baseURL)
94
+ this.uploadModel.baseUrl = overrideConfig.baseURL;
95
+ this.config = (0, config_1.setupOverrideConfig)(overrideConfig);
96
+ }
97
+ }
98
+ async startBrowser(event, callback, feature, scenario, overrideConfig, singleFeature = false) {
99
+ this.changeModelData(overrideConfig);
100
+ if (singleFeature && process.env.ENVIRONMENT !== 'LOCAL') {
101
+ if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
102
+ return { statusCode: 401, message: 'Unauthorized' };
103
+ this.uploadModel.reportId = await (0, report_service_1.createEmptyReport)(this.uploadModel);
104
+ this.uploadModel.nextSuites = [];
105
+ }
106
+ return this.puppeteer.run(event, callback, feature, scenario);
107
+ }
108
+ async startBrowserRPA(event, callback, baseURL) {
109
+ this.changeModelData({
110
+ baseURL: baseURL,
111
+ environment: '',
112
+ digitalProduct: ''
113
+ });
114
+ return this.puppeteer.runRPA(event, callback);
115
+ }
116
+ getUploadModel() {
117
+ return this.uploadModel;
118
+ }
119
+ }
120
+ exports.StepStatus = status_of_step_1.default;
121
+ const auxta = new AuxTA();
122
+ exports.default = auxta;
@@ -0,0 +1,51 @@
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
+ token: string;
9
+ screenWidth: number;
10
+ screenHeight: number;
11
+ timeout: number;
12
+ suitesList: never[];
13
+ auxtaCredentials: {
14
+ email: string;
15
+ password: string;
16
+ };
17
+ };
18
+ export declare function setupOverrideConfig(overrideConfig: any): {
19
+ auxtaURL: string;
20
+ baseURL: string;
21
+ siteURL: string;
22
+ organization: string;
23
+ netlifyPath: string;
24
+ digitalProduct: string;
25
+ token: string;
26
+ screenWidth: number;
27
+ screenHeight: number;
28
+ timeout: number;
29
+ suitesList: never[];
30
+ auxtaCredentials: {
31
+ email: string;
32
+ password: string;
33
+ };
34
+ };
35
+ export declare let config: {
36
+ auxtaURL: string;
37
+ baseURL: string;
38
+ siteURL: string;
39
+ organization: string;
40
+ netlifyPath: string;
41
+ digitalProduct: string;
42
+ token: string;
43
+ screenWidth: number;
44
+ screenHeight: number;
45
+ timeout: number;
46
+ suitesList: never[];
47
+ auxtaCredentials: {
48
+ email: string;
49
+ password: string;
50
+ };
51
+ };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = exports.setupOverrideConfig = exports.setupConfig = void 0;
4
+ function setupConfig(jsonConfig) {
5
+ if (!jsonConfig.baseURL)
6
+ throw new Error("baseURL");
7
+ exports.config.baseURL = jsonConfig.baseURL;
8
+ if (!jsonConfig.digitalProduct)
9
+ throw new Error("digitalProduct");
10
+ exports.config.digitalProduct = jsonConfig.digitalProduct;
11
+ if (!jsonConfig.testsURL)
12
+ throw new Error("testsURL");
13
+ exports.config.netlifyPath = (process.env.ENVIRONMENT == 'LOCAL') ? 'http://localhost:9999/' : jsonConfig.testsURL;
14
+ if (!jsonConfig.organization)
15
+ throw new Error("organization");
16
+ exports.config.organization = jsonConfig.organization;
17
+ if (!jsonConfig.token)
18
+ throw new Error("token");
19
+ exports.config.token = jsonConfig.token;
20
+ if (!jsonConfig.email)
21
+ throw new Error("email");
22
+ exports.config.auxtaCredentials.email = jsonConfig.email;
23
+ if (!jsonConfig.password)
24
+ throw new Error("password");
25
+ exports.config.auxtaCredentials.password = jsonConfig.password;
26
+ if (!jsonConfig.suitesList)
27
+ throw new Error("suitesList");
28
+ exports.config.suitesList = jsonConfig.suitesList;
29
+ if (jsonConfig.timeout)
30
+ exports.config.timeout = jsonConfig.timeout;
31
+ if (jsonConfig.screenWidth)
32
+ exports.config.screenWidth = jsonConfig.screenWidth;
33
+ if (jsonConfig.screenHeight)
34
+ exports.config.screenHeight = jsonConfig.screenHeight;
35
+ return exports.config;
36
+ }
37
+ exports.setupConfig = setupConfig;
38
+ function setupOverrideConfig(overrideConfig) {
39
+ if (overrideConfig.baseURL)
40
+ exports.config.baseURL = overrideConfig.baseURL;
41
+ if (overrideConfig.digitalProduct)
42
+ exports.config.digitalProduct = overrideConfig.digitalProduct;
43
+ if (overrideConfig.screenWidth)
44
+ exports.config.screenWidth = overrideConfig.screenWidth;
45
+ if (overrideConfig.screenHeight)
46
+ exports.config.screenHeight = overrideConfig.screenHeight;
47
+ return exports.config;
48
+ }
49
+ exports.setupOverrideConfig = setupOverrideConfig;
50
+ exports.config = {
51
+ auxtaURL: "https://auxta.live/.netlify/functions/",
52
+ baseURL: "",
53
+ siteURL: "",
54
+ organization: "",
55
+ netlifyPath: "",
56
+ digitalProduct: "",
57
+ token: "",
58
+ screenWidth: 1920,
59
+ screenHeight: 1080,
60
+ timeout: 10000,
61
+ suitesList: [],
62
+ auxtaCredentials: {
63
+ email: "",
64
+ password: "",
65
+ },
66
+ };
@@ -0,0 +1,7 @@
1
+ export declare enum StatusOfStep {
2
+ PASSED = "passed",
3
+ FAILED = "failed",
4
+ SKIPPED = "skipped",
5
+ SUGGESTION = "suggestion"
6
+ }
7
+ export default StatusOfStep;
@@ -0,0 +1,11 @@
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 = exports.StatusOfStep || (exports.StatusOfStep = {}));
11
+ exports.default = StatusOfStep;
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ export declare function returnImage(code: number, screenshot: Buffer): {
3
+ isBase64Encoded: boolean;
4
+ statusCode: number;
5
+ headers: {
6
+ "Content-Type": string;
7
+ "Content-Length": string;
8
+ };
9
+ body: string;
10
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.returnImage = void 0;
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.toString("base64")
13
+ };
14
+ }
15
+ exports.returnImage = returnImage;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ (async () => {
5
+ const r = /^--params\.suite=(.*)$/g;
6
+ let suite = process.argv.find(el => !!el.match(r));
7
+ if (!suite)
8
+ throw `Locale is undefined`;
9
+ let suites = suite.replace('--params.suite=', '');
10
+ let suitesArr = suites.split(',');
11
+ if (!suitesArr)
12
+ suitesArr = [suites];
13
+ for (const suite of suitesArr) {
14
+ let f = require((0, path_1.join)(process.cwd(), 'build', 'functions', 'controllers', suite));
15
+ await f.handler();
16
+ }
17
+ })();
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ import { UploadModel } from "../models/upload.model";
3
+ export declare function onTestEnd(body: any, featureName: string, scenarioName: string, statusCode: number, screenshotBuffer?: Buffer, errMessage?: object): Promise<void>;
4
+ export declare function afterComplete(body: UploadModel): Promise<void>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.afterComplete = exports.onTestEnd = void 0;
7
+ const path_1 = require("path");
8
+ const log_service_1 = __importDefault(require("../services/log.service"));
9
+ const report_service_1 = require("../services/report.service");
10
+ const start_suite_helper_1 = require("../utilities/start-suite.helper");
11
+ const status_of_step_1 = require("../enums/status-of.step");
12
+ async function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer, errMessage) {
13
+ let isFinal = false;
14
+ if (process.env.ENVIRONMENT == "LIVE") {
15
+ console.log('asc ' + errMessage);
16
+ console.log('--- Uploading scenario and feature for AUXTA report ---');
17
+ const stepsArr = log_service_1.default.returnScenarioReport();
18
+ try {
19
+ const scenarioRes = await (0, report_service_1.uploadScenario)(stepsArr, scenarioName, screenshotBuffer, errMessage);
20
+ const featureRes = await (0, report_service_1.uploadFeature)(scenarioRes, featureName, (0, path_1.basename)(__filename), (statusCode != 200));
21
+ const feature = {
22
+ featureId: featureRes.featureRef,
23
+ featureName: featureRes.name,
24
+ featureUri: featureRes.uri,
25
+ status: featureRes.status,
26
+ scenariosCount: featureRes.scenariosCount
27
+ };
28
+ const stepCounts = {
29
+ failedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.FAILED),
30
+ passedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.PASSED),
31
+ skippedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SKIPPED),
32
+ suggestedSteps: log_service_1.default.getStatusCount(status_of_step_1.StatusOfStep.SUGGESTION)
33
+ };
34
+ isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
35
+ await (0, report_service_1.updateReport)(body.reportId, feature, stepCounts, isFinal);
36
+ console.log('--- Finished uploading report data to AUXTA ---');
37
+ }
38
+ catch (error) {
39
+ console.log('--- Failed to update report in AUXTA ---');
40
+ console.log(error);
41
+ }
42
+ }
43
+ if (isFinal)
44
+ await afterComplete(body);
45
+ else if (body && body.nextSuites)
46
+ await (0, start_suite_helper_1.startSuite)(body.nextSuites, body.reportId);
47
+ }
48
+ exports.onTestEnd = onTestEnd;
49
+ async function afterComplete(body) {
50
+ if (process.env.ENVIRONMENT == "LIVE")
51
+ await (0, report_service_1.postNotifications)(body);
52
+ }
53
+ exports.afterComplete = afterComplete;
@@ -0,0 +1,20 @@
1
+ export declare class UploadModel {
2
+ private _reportId;
3
+ private _nextSuites;
4
+ private _digitalProduct;
5
+ private _baseUrl;
6
+ private readonly _organization;
7
+ private _environment;
8
+ constructor(org: string, baseUrl: string, digitalProduct: string, environment: string);
9
+ get reportId(): string;
10
+ set reportId(value: string);
11
+ get nextSuites(): [];
12
+ set nextSuites(value: []);
13
+ get digitalProduct(): string;
14
+ set digitalProduct(value: string);
15
+ get organization(): string;
16
+ get baseUrl(): string;
17
+ set baseUrl(value: string);
18
+ get environment(): string;
19
+ set environment(value: string);
20
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UploadModel = void 0;
4
+ class UploadModel {
5
+ constructor(org, baseUrl, digitalProduct, environment) {
6
+ this._reportId = '';
7
+ this._nextSuites = [];
8
+ this._organization = org;
9
+ this._digitalProduct = digitalProduct;
10
+ this._environment = environment;
11
+ this._baseUrl = baseUrl;
12
+ }
13
+ get reportId() {
14
+ return this._reportId;
15
+ }
16
+ set reportId(value) {
17
+ this._reportId = value;
18
+ }
19
+ get nextSuites() {
20
+ return this._nextSuites;
21
+ }
22
+ set nextSuites(value) {
23
+ this._nextSuites = value;
24
+ }
25
+ get digitalProduct() {
26
+ return this._digitalProduct;
27
+ }
28
+ set digitalProduct(value) {
29
+ this._digitalProduct = value;
30
+ }
31
+ get organization() {
32
+ return this._organization;
33
+ }
34
+ get baseUrl() {
35
+ return this._baseUrl;
36
+ }
37
+ set baseUrl(value) {
38
+ this._baseUrl = value;
39
+ }
40
+ get environment() {
41
+ return this._environment;
42
+ }
43
+ set environment(value) {
44
+ this._environment = value;
45
+ }
46
+ }
47
+ exports.UploadModel = UploadModel;
@@ -0,0 +1,26 @@
1
+ import { StatusOfStep } from "../enums/status-of.step";
2
+ export interface Step {
3
+ keyword: string;
4
+ name: string;
5
+ result: {
6
+ status: StatusOfStep;
7
+ duration: number;
8
+ };
9
+ }
10
+ export declare class LogSteps {
11
+ private stepLog;
12
+ private lastStepTime;
13
+ statusCounter: {
14
+ passed: number;
15
+ failed: number;
16
+ skipped: number;
17
+ suggestion: number;
18
+ };
19
+ addSuggestion(text: string): void;
20
+ clear(): void;
21
+ push(keyword: string, name: string, status: StatusOfStep): void;
22
+ returnScenarioReport(): Step[];
23
+ getStatusCount(status: StatusOfStep): number;
24
+ }
25
+ declare const log: LogSteps;
26
+ export default log;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogSteps = void 0;
4
+ const status_of_step_1 = require("../enums/status-of.step");
5
+ class LogSteps {
6
+ constructor() {
7
+ this.stepLog = [];
8
+ this.lastStepTime = new Date().getTime();
9
+ this.statusCounter = {
10
+ [status_of_step_1.StatusOfStep.PASSED]: 0,
11
+ [status_of_step_1.StatusOfStep.FAILED]: 0,
12
+ [status_of_step_1.StatusOfStep.SKIPPED]: 0,
13
+ [status_of_step_1.StatusOfStep.SUGGESTION]: 0,
14
+ };
15
+ }
16
+ addSuggestion(text) {
17
+ this.statusCounter[status_of_step_1.StatusOfStep.SUGGESTION]++;
18
+ this.stepLog.push({
19
+ keyword: 'Suggestion', name: text, result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
20
+ });
21
+ }
22
+ clear() {
23
+ this.stepLog = [];
24
+ this.statusCounter = {
25
+ [status_of_step_1.StatusOfStep.PASSED]: 0,
26
+ [status_of_step_1.StatusOfStep.FAILED]: 0,
27
+ [status_of_step_1.StatusOfStep.SKIPPED]: 0,
28
+ [status_of_step_1.StatusOfStep.SUGGESTION]: 0,
29
+ };
30
+ }
31
+ push(keyword, name, status) {
32
+ console.log(`System log -- status: ${status} -- : ${name} `);
33
+ this.statusCounter[status]++;
34
+ const currentStep = new Date().getTime();
35
+ this.stepLog.push({ keyword, name, result: { status, duration: currentStep - this.lastStepTime } });
36
+ this.lastStepTime = currentStep;
37
+ }
38
+ returnScenarioReport() {
39
+ return this.stepLog;
40
+ }
41
+ getStatusCount(status) {
42
+ return this.statusCounter[status];
43
+ }
44
+ }
45
+ exports.LogSteps = LogSteps;
46
+ const log = new LogSteps();
47
+ exports.default = log;
@@ -0,0 +1,36 @@
1
+ /// <reference types="node" />
2
+ import { Step } from "./log.service";
3
+ import { UploadModel } from "../models/upload.model";
4
+ export interface Feature {
5
+ featureId: string;
6
+ featureName: string;
7
+ featureUri: string;
8
+ status: string;
9
+ scenariosCount: number;
10
+ }
11
+ export interface Scenario {
12
+ featureId: string;
13
+ featureName: string;
14
+ featureUri: string;
15
+ status: string;
16
+ scenariosCount: number;
17
+ }
18
+ export interface Steps {
19
+ failedSteps: number;
20
+ passedSteps: number;
21
+ skippedSteps: number;
22
+ suggestedSteps: number;
23
+ }
24
+ export declare function createEmptyReport(body: any): Promise<string>;
25
+ export declare function uploadScenario(stepLog: Step[], scenarioName: string, screenshot?: Buffer, errMessage?: object): Promise<{
26
+ scenarioRef: any;
27
+ name: any;
28
+ status: any;
29
+ stepsCount: any;
30
+ }[]>;
31
+ export declare function uploadFeature(scenarioId: any[], scenarioName: string, uri: string, hasFailed: boolean): Promise<any>;
32
+ export declare function updateReport(reportId: string, feature: Feature, steps: Steps, isFinal: boolean): Promise<void>;
33
+ export declare function getReport(reportId: string): Promise<any>;
34
+ export declare function getLastDayResults(): Promise<any>;
35
+ export declare function postNotifications(body: UploadModel): Promise<void>;
36
+ export declare function postNotificationsOnFail(body: UploadModel): Promise<void>;