@auxcode/auxta 0.5.3 → 0.5.7

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;
@@ -1,34 +1,29 @@
1
- import puppeteer, {Puppeteer} from "./puppeteer/puppeteer";
2
- import {FunctionHelper} from "./macros/helpers/code.helper";
1
+ import puppeteer from "./puppeteer/puppeteer";
2
+ import { FunctionHelper } from "./macros/helpers/code.helper";
3
3
  import path from "path";
4
4
  import fs from "fs";
5
5
  import StatusOfStep from "./auxta/enums/status-of.step";
6
- import {UploadModel} from "./auxta/models/upload.model";
6
+ import { UploadModel } from "./auxta/models/upload.model";
7
7
  import * as dotenv from "dotenv";
8
- import {setupConfig, config as c, setupOverrideConfig} from "./auxta/configs/config";
9
- import {startSuite} from "./auxta/utilities/start-suite.helper";
10
- import {createEmptyReport} from "./auxta/services/report.service";
11
-
8
+ import { setupConfig, config as c, setupOverrideConfig } from "./auxta/configs/config";
9
+ import { startSuite } from "./auxta/utilities/start-suite.helper";
10
+ import { createEmptyReport } from "./auxta/services/report.service";
12
11
  dotenv.config();
13
-
14
12
  class AuxTA extends FunctionHelper {
15
- public puppeteer: Puppeteer = puppeteer;
16
- public config = c;
17
-
18
- private readonly uploadModel: UploadModel;
19
-
20
13
  constructor() {
21
14
  super();
15
+ this.puppeteer = puppeteer;
16
+ this.config = c;
22
17
  let file;
23
18
  if (!process.env.RPA) {
24
19
  try {
25
- let currentDir = ""
20
+ let currentDir = "";
26
21
  while (true) {
27
22
  file = path.join(__dirname, currentDir, "auxta.json");
28
23
  if (!fs.existsSync(file)) {
29
- currentDir += "../"
24
+ currentDir += "../";
30
25
  if (currentDir.length >= 30) {
31
- console.log("auxta.json file not found!")
26
+ console.log("auxta.json file not found!");
32
27
  process.exit(1);
33
28
  return;
34
29
  }
@@ -38,67 +33,65 @@ class AuxTA extends FunctionHelper {
38
33
  }
39
34
  const jsonConfig = JSON.parse(fs.readFileSync(file).toString());
40
35
  try {
41
- this.config = setupConfig(jsonConfig)
42
- } catch (e) {
43
- console.log("Missing field in auxta.json:", e)
36
+ this.config = setupConfig(jsonConfig);
37
+ }
38
+ catch (e) {
39
+ console.log("Missing field in auxta.json:", e);
44
40
  }
45
41
  this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment);
46
- } catch (e) {
47
- console.log("Missing or corrupted config: auxta.json. Searching in location:", file)
42
+ }
43
+ catch (e) {
44
+ console.log("Missing or corrupted config: auxta.json. Searching in location:", file);
48
45
  console.log(e);
49
46
  process.exit(1);
50
47
  }
51
- } else {
48
+ }
49
+ else {
52
50
  this.uploadModel = new UploadModel('', '', '', '');
53
51
  }
54
52
  }
55
-
56
- public async run(event: any, overrideConfig?: any) {
53
+ async run(event, overrideConfig) {
57
54
  this.changeModelData(overrideConfig);
58
- let reportId: string | undefined = event.queryStringParameters.reportId;
55
+ let reportId = event.queryStringParameters.reportId;
59
56
  if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
60
- return {statusCode: 401, message: 'Unauthorized'}
57
+ return { statusCode: 401, message: 'Unauthorized' };
61
58
  const suites = this.config.suitesList.slice(0);
62
59
  await startSuite(suites, reportId || await createEmptyReport(this.uploadModel));
63
- return {statusCode: 204}
60
+ return { statusCode: 204 };
64
61
  }
65
-
66
- private changeModelData(overrideConfig?: any) {
62
+ changeModelData(overrideConfig) {
67
63
  if (overrideConfig) {
68
- if (overrideConfig.digitalProduct) this.uploadModel.digitalProduct = overrideConfig.digitalProduct
69
- if (overrideConfig.environment) this.uploadModel.environment = overrideConfig.environment
70
- if (overrideConfig.baseURL) this.uploadModel.baseUrl = overrideConfig.baseURL
71
- this.config = setupOverrideConfig(overrideConfig)
64
+ if (overrideConfig.digitalProduct)
65
+ this.uploadModel.digitalProduct = overrideConfig.digitalProduct;
66
+ if (overrideConfig.environment)
67
+ this.uploadModel.environment = overrideConfig.environment;
68
+ if (overrideConfig.baseURL)
69
+ this.uploadModel.baseUrl = overrideConfig.baseURL;
70
+ this.config = setupOverrideConfig(overrideConfig);
72
71
  }
73
72
  }
74
-
75
- public async startBrowser(event: any, callback: any, feature: string, scenario: string, overrideConfig?: any, singleFeature = false) {
73
+ async startBrowser(event, callback, feature, scenario, overrideConfig, singleFeature = false) {
76
74
  this.changeModelData(overrideConfig);
77
75
  if (singleFeature && process.env.ENVIRONMENT !== 'LOCAL') {
78
76
  if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
79
- return {statusCode: 401, message: 'Unauthorized'}
77
+ return { statusCode: 401, message: 'Unauthorized' };
80
78
  this.uploadModel.reportId = await createEmptyReport(this.uploadModel);
81
79
  this.uploadModel.nextSuites = [];
82
80
  }
83
- return this.puppeteer.run(event, callback, feature, scenario)
81
+ return this.puppeteer.run(event, callback, feature, scenario);
84
82
  }
85
-
86
- public async startBrowserRPA(event: any, callback: any, baseURL: string) {
83
+ async startBrowserRPA(event, callback, baseURL) {
87
84
  this.changeModelData({
88
85
  baseURL: baseURL,
89
86
  environment: '',
90
87
  digitalProduct: ''
91
88
  });
92
- return this.puppeteer.runRPA(event, callback)
89
+ return this.puppeteer.runRPA(event, callback);
93
90
  }
94
-
95
- public getUploadModel(): UploadModel {
91
+ getUploadModel() {
96
92
  return this.uploadModel;
97
93
  }
98
94
  }
99
-
100
95
  export const StepStatus = StatusOfStep;
101
-
102
- const auxta: AuxTA = new AuxTA();
103
-
96
+ const auxta = new AuxTA();
104
97
  export 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,61 @@
1
+ export function setupConfig(jsonConfig) {
2
+ if (!jsonConfig.baseURL)
3
+ throw new Error("baseURL");
4
+ config.baseURL = jsonConfig.baseURL;
5
+ if (!jsonConfig.digitalProduct)
6
+ throw new Error("digitalProduct");
7
+ config.digitalProduct = jsonConfig.digitalProduct;
8
+ if (!jsonConfig.testsURL)
9
+ throw new Error("testsURL");
10
+ config.netlifyPath = (process.env.ENVIRONMENT == 'LOCAL') ? 'http://localhost:9999/' : jsonConfig.testsURL;
11
+ if (!jsonConfig.organization)
12
+ throw new Error("organization");
13
+ config.organization = jsonConfig.organization;
14
+ if (!jsonConfig.token)
15
+ throw new Error("token");
16
+ config.token = jsonConfig.token;
17
+ if (!jsonConfig.email)
18
+ throw new Error("email");
19
+ config.auxtaCredentials.email = jsonConfig.email;
20
+ if (!jsonConfig.password)
21
+ throw new Error("password");
22
+ config.auxtaCredentials.password = jsonConfig.password;
23
+ if (!jsonConfig.suitesList)
24
+ throw new Error("suitesList");
25
+ config.suitesList = jsonConfig.suitesList;
26
+ if (jsonConfig.timeout)
27
+ config.timeout = jsonConfig.timeout;
28
+ if (jsonConfig.screenWidth)
29
+ config.screenWidth = jsonConfig.screenWidth;
30
+ if (jsonConfig.screenHeight)
31
+ config.screenHeight = jsonConfig.screenHeight;
32
+ return config;
33
+ }
34
+ export function setupOverrideConfig(overrideConfig) {
35
+ if (overrideConfig.baseURL)
36
+ config.baseURL = overrideConfig.baseURL;
37
+ if (overrideConfig.digitalProduct)
38
+ config.digitalProduct = overrideConfig.digitalProduct;
39
+ if (overrideConfig.screenWidth)
40
+ config.screenWidth = overrideConfig.screenWidth;
41
+ if (overrideConfig.screenHeight)
42
+ config.screenHeight = overrideConfig.screenHeight;
43
+ return config;
44
+ }
45
+ export let config = {
46
+ auxtaURL: "https://auxta.live/.netlify/functions/",
47
+ baseURL: "",
48
+ siteURL: "",
49
+ organization: "",
50
+ netlifyPath: "",
51
+ digitalProduct: "",
52
+ token: "",
53
+ screenWidth: 1920,
54
+ screenHeight: 1080,
55
+ timeout: 10000,
56
+ suitesList: [],
57
+ auxtaCredentials: {
58
+ email: "",
59
+ password: "",
60
+ },
61
+ };
@@ -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,8 @@
1
+ export var StatusOfStep;
2
+ (function (StatusOfStep) {
3
+ StatusOfStep["PASSED"] = "passed";
4
+ StatusOfStep["FAILED"] = "failed";
5
+ StatusOfStep["SKIPPED"] = "skipped";
6
+ StatusOfStep["SUGGESTION"] = "suggestion";
7
+ })(StatusOfStep || (StatusOfStep = {}));
8
+ export 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
+ };
@@ -1,4 +1,4 @@
1
- export function returnImage(code: number, screenshot: Buffer) {
1
+ export function returnImage(code, screenshot) {
2
2
  return {
3
3
  isBase64Encoded: true,
4
4
  statusCode: code,
@@ -0,0 +1 @@
1
+ export {};
@@ -1,14 +1,15 @@
1
1
  import { join } from 'path';
2
-
3
2
  (async () => {
4
3
  const r = /^--params\.suite=(.*)$/g;
5
4
  let suite = process.argv.find(el => !!el.match(r));
6
- if (!suite) throw `Locale is undefined`;
5
+ if (!suite)
6
+ throw `Locale is undefined`;
7
7
  let suites = suite.replace('--params.suite=', '');
8
8
  let suitesArr = suites.split(',');
9
- if (!suitesArr) suitesArr = [ suites ];
9
+ if (!suitesArr)
10
+ suitesArr = [suites];
10
11
  for (const suite of suitesArr) {
11
- let f = require(join(process.cwd(), 'build', 'functions', 'controllers', suite));
12
+ let f = require(join(process.cwd(), 'build', 'functions', 'controllers', suite));
12
13
  await f.handler();
13
14
  }
14
- })();
15
+ })();
@@ -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>;
@@ -1,19 +1,10 @@
1
- import { basename } from 'path'
1
+ import { basename } from 'path';
2
2
  import log from "../services/log.service";
3
- import {
4
- Feature,
5
- postNotifications,
6
- Steps,
7
- updateReport,
8
- uploadFeature,
9
- uploadScenario
10
- } from '../services/report.service';
3
+ import { postNotifications, updateReport, uploadFeature, uploadScenario } from '../services/report.service';
11
4
  import { startSuite } from '../utilities/start-suite.helper';
12
5
  import { StatusOfStep } from "../enums/status-of.step";
13
- import { UploadModel } from "../models/upload.model";
14
-
15
- export async function onTestEnd(body: any, featureName: string, scenarioName: string, statusCode: number, screenshotBuffer?: Buffer, errMessage?: object) {
16
- let isFinal: boolean = false;
6
+ export async function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer, errMessage) {
7
+ let isFinal = false;
17
8
  if (process.env.ENVIRONMENT == "LIVE") {
18
9
  console.log('asc ' + errMessage);
19
10
  console.log('--- Uploading scenario and feature for AUXTA report ---');
@@ -21,32 +12,34 @@ export async function onTestEnd(body: any, featureName: string, scenarioName: st
21
12
  try {
22
13
  const scenarioRes = await uploadScenario(stepsArr, scenarioName, screenshotBuffer, errMessage);
23
14
  const featureRes = await uploadFeature(scenarioRes, featureName, basename(__filename), (statusCode != 200));
24
- const feature: Feature = {
15
+ const feature = {
25
16
  featureId: featureRes.featureRef,
26
17
  featureName: featureRes.name,
27
18
  featureUri: featureRes.uri,
28
19
  status: featureRes.status,
29
20
  scenariosCount: featureRes.scenariosCount
30
- }
31
- const stepCounts: Steps = {
21
+ };
22
+ const stepCounts = {
32
23
  failedSteps: log.getStatusCount(StatusOfStep.FAILED),
33
24
  passedSteps: log.getStatusCount(StatusOfStep.PASSED),
34
25
  skippedSteps: log.getStatusCount(StatusOfStep.SKIPPED),
35
26
  suggestedSteps: log.getStatusCount(StatusOfStep.SUGGESTION)
36
- }
27
+ };
37
28
  isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
38
29
  await updateReport(body.reportId, feature, stepCounts, isFinal);
39
30
  console.log('--- Finished uploading report data to AUXTA ---');
40
- } catch (error) {
41
- console.log('--- Failed to update report in AUXTA ---')
42
- console.log(error)
31
+ }
32
+ catch (error) {
33
+ console.log('--- Failed to update report in AUXTA ---');
34
+ console.log(error);
43
35
  }
44
36
  }
45
- if (isFinal) await afterComplete(body);
46
- else if (body && body.nextSuites) await startSuite(body.nextSuites, body.reportId);
37
+ if (isFinal)
38
+ await afterComplete(body);
39
+ else if (body && body.nextSuites)
40
+ await startSuite(body.nextSuites, body.reportId);
47
41
  }
48
-
49
- export async function afterComplete(body: UploadModel) {
42
+ export async function afterComplete(body) {
50
43
  if (process.env.ENVIRONMENT == "LIVE")
51
44
  await postNotifications(body);
52
45
  }
@@ -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,43 @@
1
+ export class UploadModel {
2
+ constructor(org, baseUrl, digitalProduct, environment) {
3
+ this._reportId = '';
4
+ this._nextSuites = [];
5
+ this._organization = org;
6
+ this._digitalProduct = digitalProduct;
7
+ this._environment = environment;
8
+ this._baseUrl = baseUrl;
9
+ }
10
+ get reportId() {
11
+ return this._reportId;
12
+ }
13
+ set reportId(value) {
14
+ this._reportId = value;
15
+ }
16
+ get nextSuites() {
17
+ return this._nextSuites;
18
+ }
19
+ set nextSuites(value) {
20
+ this._nextSuites = value;
21
+ }
22
+ get digitalProduct() {
23
+ return this._digitalProduct;
24
+ }
25
+ set digitalProduct(value) {
26
+ this._digitalProduct = value;
27
+ }
28
+ get organization() {
29
+ return this._organization;
30
+ }
31
+ get baseUrl() {
32
+ return this._baseUrl;
33
+ }
34
+ set baseUrl(value) {
35
+ this._baseUrl = value;
36
+ }
37
+ get environment() {
38
+ return this._environment;
39
+ }
40
+ set environment(value) {
41
+ this._environment = value;
42
+ }
43
+ }
@@ -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,43 @@
1
+ import { StatusOfStep } from "../enums/status-of.step";
2
+ export class LogSteps {
3
+ constructor() {
4
+ this.stepLog = [];
5
+ this.lastStepTime = new Date().getTime();
6
+ this.statusCounter = {
7
+ [StatusOfStep.PASSED]: 0,
8
+ [StatusOfStep.FAILED]: 0,
9
+ [StatusOfStep.SKIPPED]: 0,
10
+ [StatusOfStep.SUGGESTION]: 0,
11
+ };
12
+ }
13
+ addSuggestion(text) {
14
+ this.statusCounter[StatusOfStep.SUGGESTION]++;
15
+ this.stepLog.push({
16
+ keyword: 'Suggestion', name: text, result: { status: StatusOfStep.SUGGESTION, duration: 0 }
17
+ });
18
+ }
19
+ clear() {
20
+ this.stepLog = [];
21
+ this.statusCounter = {
22
+ [StatusOfStep.PASSED]: 0,
23
+ [StatusOfStep.FAILED]: 0,
24
+ [StatusOfStep.SKIPPED]: 0,
25
+ [StatusOfStep.SUGGESTION]: 0,
26
+ };
27
+ }
28
+ push(keyword, name, status) {
29
+ console.log(`System log -- status: ${status} -- : ${name} `);
30
+ this.statusCounter[status]++;
31
+ const currentStep = new Date().getTime();
32
+ this.stepLog.push({ keyword, name, result: { status, duration: currentStep - this.lastStepTime } });
33
+ this.lastStepTime = currentStep;
34
+ }
35
+ returnScenarioReport() {
36
+ return this.stepLog;
37
+ }
38
+ getStatusCount(status) {
39
+ return this.statusCounter[status];
40
+ }
41
+ }
42
+ const log = new LogSteps();
43
+ export 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>;