@auxcode/auxta 0.5.5 → 0.5.9

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/AuxTA.js +38 -23
  2. package/build/auxta/helpers/start.helper.js +12 -3
  3. package/build/auxta/hooks/report.hook.js +50 -37
  4. package/build/auxta/services/report.service.js +126 -105
  5. package/build/auxta/utilities/screenshot.helper.js +27 -16
  6. package/build/auxta/utilities/start-suite.helper.js +22 -11
  7. package/build/cjs/AuxTA.d.ts +43 -0
  8. package/build/cjs/AuxTA.js +137 -0
  9. package/build/cjs/auxta/configs/config.d.ts +51 -0
  10. package/build/cjs/auxta/configs/config.js +66 -0
  11. package/build/cjs/auxta/enums/status-of.step.d.ts +7 -0
  12. package/build/cjs/auxta/enums/status-of.step.js +11 -0
  13. package/build/cjs/auxta/helpers/response.helper.d.ts +10 -0
  14. package/build/cjs/auxta/helpers/response.helper.js +15 -0
  15. package/build/cjs/auxta/helpers/start.helper.d.ts +1 -0
  16. package/build/cjs/auxta/helpers/start.helper.js +26 -0
  17. package/build/cjs/auxta/hooks/report.hook.d.ts +4 -0
  18. package/build/cjs/auxta/hooks/report.hook.js +66 -0
  19. package/build/cjs/auxta/models/upload.model.d.ts +20 -0
  20. package/build/cjs/auxta/models/upload.model.js +47 -0
  21. package/build/cjs/auxta/services/log.service.d.ts +26 -0
  22. package/build/cjs/auxta/services/log.service.js +47 -0
  23. package/build/cjs/auxta/services/report.service.d.ts +36 -0
  24. package/build/cjs/auxta/services/report.service.js +162 -0
  25. package/build/cjs/auxta/services/runtime.service.d.ts +16 -0
  26. package/build/cjs/auxta/services/runtime.service.js +41 -0
  27. package/build/cjs/auxta/utilities/runtime.helper.d.ts +15 -0
  28. package/build/cjs/auxta/utilities/runtime.helper.js +19 -0
  29. package/build/cjs/auxta/utilities/screenshot.helper.d.ts +2 -0
  30. package/build/cjs/auxta/utilities/screenshot.helper.js +36 -0
  31. package/build/cjs/auxta/utilities/start-suite.helper.d.ts +1 -0
  32. package/build/cjs/auxta/utilities/start-suite.helper.js +32 -0
  33. package/build/cjs/macros/helpers/code.helper.d.ts +22 -0
  34. package/build/cjs/macros/helpers/code.helper.js +200 -0
  35. package/build/cjs/puppeteer/puppeteer.d.ts +13 -0
  36. package/build/cjs/puppeteer/puppeteer.js +160 -0
  37. package/build/esm/AuxTA.d.ts +43 -0
  38. package/build/esm/AuxTA.js +97 -0
  39. package/build/esm/auxta/configs/config.d.ts +51 -0
  40. package/build/esm/auxta/configs/config.js +61 -0
  41. package/build/esm/auxta/enums/status-of.step.d.ts +7 -0
  42. package/build/esm/auxta/enums/status-of.step.js +8 -0
  43. package/build/esm/auxta/helpers/response.helper.d.ts +10 -0
  44. package/build/esm/auxta/helpers/response.helper.js +11 -0
  45. package/build/esm/auxta/helpers/start.helper.d.ts +1 -0
  46. package/build/esm/auxta/helpers/start.helper.js +15 -0
  47. package/build/esm/auxta/hooks/report.hook.d.ts +4 -0
  48. package/build/esm/auxta/hooks/report.hook.js +45 -0
  49. package/build/esm/auxta/models/upload.model.d.ts +20 -0
  50. package/build/esm/auxta/models/upload.model.js +43 -0
  51. package/build/esm/auxta/services/log.service.d.ts +26 -0
  52. package/build/esm/auxta/services/log.service.js +43 -0
  53. package/build/esm/auxta/services/report.service.d.ts +36 -0
  54. package/build/esm/auxta/services/report.service.js +127 -0
  55. package/build/esm/auxta/services/runtime.service.d.ts +16 -0
  56. package/build/esm/auxta/services/runtime.service.js +37 -0
  57. package/build/esm/auxta/utilities/runtime.helper.d.ts +15 -0
  58. package/build/esm/auxta/utilities/runtime.helper.js +15 -0
  59. package/build/esm/auxta/utilities/screenshot.helper.d.ts +2 -0
  60. package/build/esm/auxta/utilities/screenshot.helper.js +18 -0
  61. package/build/esm/auxta/utilities/start-suite.helper.d.ts +1 -0
  62. package/build/esm/auxta/utilities/start-suite.helper.js +14 -0
  63. package/build/esm/macros/helpers/code.helper.d.ts +22 -0
  64. package/build/esm/macros/helpers/code.helper.js +158 -0
  65. package/build/esm/puppeteer/puppeteer.d.ts +13 -0
  66. package/build/esm/puppeteer/puppeteer.js +136 -0
  67. package/build/macros/helpers/code.helper.js +164 -129
  68. package/build/puppeteer/puppeteer.js +117 -100
  69. package/build/tsconfig-cjs.tsbuildinfo +1 -0
  70. package/build/tsconfig.tsbuildinfo +1 -0
  71. package/package.json +4 -3
package/build/AuxTA.js CHANGED
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import puppeteer from "./puppeteer/puppeteer";
2
11
  import { FunctionHelper } from "./macros/helpers/code.helper";
3
12
  import path from "path";
@@ -50,14 +59,16 @@ class AuxTA extends FunctionHelper {
50
59
  this.uploadModel = new UploadModel('', '', '', '');
51
60
  }
52
61
  }
53
- async run(event, overrideConfig) {
54
- this.changeModelData(overrideConfig);
55
- let reportId = event.queryStringParameters.reportId;
56
- if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
57
- return { statusCode: 401, message: 'Unauthorized' };
58
- const suites = this.config.suitesList.slice(0);
59
- await startSuite(suites, reportId || await createEmptyReport(this.uploadModel));
60
- return { statusCode: 204 };
62
+ run(event, overrideConfig) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ this.changeModelData(overrideConfig);
65
+ let reportId = event.queryStringParameters.reportId;
66
+ if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
67
+ return { statusCode: 401, message: 'Unauthorized' };
68
+ const suites = this.config.suitesList.slice(0);
69
+ yield startSuite(suites, reportId || (yield createEmptyReport(this.uploadModel)));
70
+ return { statusCode: 204 };
71
+ });
61
72
  }
62
73
  changeModelData(overrideConfig) {
63
74
  if (overrideConfig) {
@@ -70,23 +81,27 @@ class AuxTA extends FunctionHelper {
70
81
  this.config = setupOverrideConfig(overrideConfig);
71
82
  }
72
83
  }
73
- async startBrowser(event, callback, feature, scenario, overrideConfig, singleFeature = false) {
74
- this.changeModelData(overrideConfig);
75
- if (singleFeature && process.env.ENVIRONMENT !== 'LOCAL') {
76
- if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
77
- return { statusCode: 401, message: 'Unauthorized' };
78
- this.uploadModel.reportId = await createEmptyReport(this.uploadModel);
79
- this.uploadModel.nextSuites = [];
80
- }
81
- return this.puppeteer.run(event, callback, feature, scenario);
84
+ startBrowser(event, callback, feature, scenario, overrideConfig, singleFeature = false) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ this.changeModelData(overrideConfig);
87
+ if (singleFeature && process.env.ENVIRONMENT !== 'LOCAL') {
88
+ if (process.env.ENVIRONMENT === 'LIVE' && event.queryStringParameters.token !== this.config.token)
89
+ return { statusCode: 401, message: 'Unauthorized' };
90
+ this.uploadModel.reportId = yield createEmptyReport(this.uploadModel);
91
+ this.uploadModel.nextSuites = [];
92
+ }
93
+ return this.puppeteer.run(event, callback, feature, scenario);
94
+ });
82
95
  }
83
- async startBrowserRPA(event, callback, baseURL) {
84
- this.changeModelData({
85
- baseURL: baseURL,
86
- environment: '',
87
- digitalProduct: ''
96
+ startBrowserRPA(event, callback, baseURL) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ this.changeModelData({
99
+ baseURL: baseURL,
100
+ environment: '',
101
+ digitalProduct: ''
102
+ });
103
+ return this.puppeteer.runRPA(event, callback);
88
104
  });
89
- return this.puppeteer.runRPA(event, callback);
90
105
  }
91
106
  getUploadModel() {
92
107
  return this.uploadModel;
@@ -1,5 +1,14 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { join } from 'path';
2
- (async () => {
11
+ (() => __awaiter(void 0, void 0, void 0, function* () {
3
12
  const r = /^--params\.suite=(.*)$/g;
4
13
  let suite = process.argv.find(el => !!el.match(r));
5
14
  if (!suite)
@@ -10,6 +19,6 @@ import { join } from 'path';
10
19
  suitesArr = [suites];
11
20
  for (const suite of suitesArr) {
12
21
  let f = require(join(process.cwd(), 'build', 'functions', 'controllers', suite));
13
- await f.handler();
22
+ yield f.handler();
14
23
  }
15
- })();
24
+ }))();
@@ -1,45 +1,58 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { basename } from 'path';
2
11
  import log from "../services/log.service";
3
12
  import { postNotifications, updateReport, uploadFeature, uploadScenario } from '../services/report.service';
4
13
  import { startSuite } from '../utilities/start-suite.helper';
5
14
  import { StatusOfStep } from "../enums/status-of.step";
6
- export async function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer, errMessage) {
7
- let isFinal = false;
8
- if (process.env.ENVIRONMENT == "LIVE") {
9
- console.log('asc ' + errMessage);
10
- console.log('--- Uploading scenario and feature for AUXTA report ---');
11
- const stepsArr = log.returnScenarioReport();
12
- try {
13
- const scenarioRes = await uploadScenario(stepsArr, scenarioName, screenshotBuffer, errMessage);
14
- const featureRes = await uploadFeature(scenarioRes, featureName, basename(__filename), (statusCode != 200));
15
- const feature = {
16
- featureId: featureRes.featureRef,
17
- featureName: featureRes.name,
18
- featureUri: featureRes.uri,
19
- status: featureRes.status,
20
- scenariosCount: featureRes.scenariosCount
21
- };
22
- const stepCounts = {
23
- failedSteps: log.getStatusCount(StatusOfStep.FAILED),
24
- passedSteps: log.getStatusCount(StatusOfStep.PASSED),
25
- skippedSteps: log.getStatusCount(StatusOfStep.SKIPPED),
26
- suggestedSteps: log.getStatusCount(StatusOfStep.SUGGESTION)
27
- };
28
- isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
29
- await updateReport(body.reportId, feature, stepCounts, isFinal);
30
- console.log('--- Finished uploading report data to AUXTA ---');
15
+ export function onTestEnd(body, featureName, scenarioName, statusCode, screenshotBuffer, errMessage) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ let isFinal = false;
18
+ if (process.env.ENVIRONMENT == "LIVE") {
19
+ console.log('asc ' + errMessage);
20
+ console.log('--- Uploading scenario and feature for AUXTA report ---');
21
+ const stepsArr = log.returnScenarioReport();
22
+ try {
23
+ const scenarioRes = yield uploadScenario(stepsArr, scenarioName, screenshotBuffer, errMessage);
24
+ const featureRes = yield uploadFeature(scenarioRes, featureName, basename(__filename), (statusCode != 200));
25
+ const feature = {
26
+ featureId: featureRes.featureRef,
27
+ featureName: featureRes.name,
28
+ featureUri: featureRes.uri,
29
+ status: featureRes.status,
30
+ scenariosCount: featureRes.scenariosCount
31
+ };
32
+ const stepCounts = {
33
+ failedSteps: log.getStatusCount(StatusOfStep.FAILED),
34
+ passedSteps: log.getStatusCount(StatusOfStep.PASSED),
35
+ skippedSteps: log.getStatusCount(StatusOfStep.SKIPPED),
36
+ suggestedSteps: log.getStatusCount(StatusOfStep.SUGGESTION)
37
+ };
38
+ isFinal = (!(body.nextSuites && body.nextSuites.length > 0));
39
+ yield updateReport(body.reportId, feature, stepCounts, isFinal);
40
+ console.log('--- Finished uploading report data to AUXTA ---');
41
+ }
42
+ catch (error) {
43
+ console.log('--- Failed to update report in AUXTA ---');
44
+ console.log(error);
45
+ }
31
46
  }
32
- catch (error) {
33
- console.log('--- Failed to update report in AUXTA ---');
34
- console.log(error);
35
- }
36
- }
37
- if (isFinal)
38
- await afterComplete(body);
39
- else if (body && body.nextSuites)
40
- await startSuite(body.nextSuites, body.reportId);
47
+ if (isFinal)
48
+ yield afterComplete(body);
49
+ else if (body && body.nextSuites)
50
+ yield startSuite(body.nextSuites, body.reportId);
51
+ });
41
52
  }
42
- export async function afterComplete(body) {
43
- if (process.env.ENVIRONMENT == "LIVE")
44
- await postNotifications(body);
53
+ export function afterComplete(body) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ if (process.env.ENVIRONMENT == "LIVE")
56
+ yield postNotifications(body);
57
+ });
45
58
  }
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import axios from "axios";
2
11
  import { config } from "../configs/config";
3
12
  function headers(token) {
@@ -8,120 +17,132 @@ function headers(token) {
8
17
  }
9
18
  };
10
19
  }
11
- async function auth() {
12
- return axios.post(config.auxtaURL + 'login', config.auxtaCredentials, {
13
- headers: {
14
- 'Content-Type': 'application/json',
15
- }
16
- })
17
- .then(({ data }) => {
18
- return data.token;
19
- })
20
- .catch(() => {
21
- throw new Error("Invalid login credentials");
20
+ function auth() {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ return axios.post(config.auxtaURL + 'login', config.auxtaCredentials, {
23
+ headers: {
24
+ 'Content-Type': 'application/json',
25
+ }
26
+ })
27
+ .then(({ data }) => {
28
+ return data.token;
29
+ })
30
+ .catch(() => {
31
+ throw new Error("Invalid login credentials");
32
+ });
22
33
  });
23
34
  }
24
- export async function createEmptyReport(body) {
25
- const token = await auth();
26
- return (await axios.post(config.auxtaURL + "create-empty-report", {
27
- environment: body.environment,
28
- digitalProductName: body.digitalProduct,
29
- start: new Date(),
30
- url: body.baseUrl
31
- }, headers(token))).data.reportId;
35
+ export function createEmptyReport(body) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const token = yield auth();
38
+ return (yield axios.post(config.auxtaURL + "create-empty-report", {
39
+ environment: body.environment,
40
+ digitalProductName: body.digitalProduct,
41
+ start: new Date(),
42
+ url: body.baseUrl
43
+ }, headers(token))).data.reportId;
44
+ });
32
45
  }
33
- export async function uploadScenario(stepLog, scenarioName, screenshot, errMessage) {
34
- let scenarios = [];
35
- let token = await auth();
36
- let lastStep = stepLog[stepLog.length - 1];
37
- const stepLogFormat = JSON.parse(JSON.stringify(stepLog));
38
- stepLogFormat.pop();
39
- let output = (await axios.post(config.auxtaURL + "create-scenario", {
40
- json: {
41
- name: scenarioName,
42
- steps: [
43
- ...stepLogFormat,
44
- (lastStep.result.status == 'failed')
45
- ? Object.assign(lastStep, {
46
+ export function uploadScenario(stepLog, scenarioName, screenshot, errMessage) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ let scenarios = [];
49
+ let token = yield auth();
50
+ let lastStep = stepLog[stepLog.length - 1];
51
+ const stepLogFormat = JSON.parse(JSON.stringify(stepLog));
52
+ stepLogFormat.pop();
53
+ let output = (yield axios.post(config.auxtaURL + "create-scenario", {
54
+ json: {
55
+ name: scenarioName,
56
+ steps: [
57
+ ...stepLogFormat,
58
+ (lastStep.result.status == 'failed')
59
+ ? Object.assign(lastStep, {
60
+ result: Object.assign(Object.assign({}, lastStep.result), { error_message: JSON.stringify(errMessage) })
61
+ })
62
+ : lastStep,
63
+ {
64
+ keyword: "After",
46
65
  result: {
47
- ...lastStep.result,
48
- error_message: JSON.stringify(errMessage)
49
- }
50
- })
51
- : lastStep,
52
- {
53
- keyword: "After",
54
- result: {
55
- status: "passed",
56
- duration: 2678000000
57
- },
58
- embeddings: (screenshot) ? [{
59
- data: screenshot.toString("base64"),
60
- mime_type: "image/png"
61
- }] : undefined,
62
- }
63
- ],
64
- }
65
- }, headers(token))).data.scenarios;
66
- scenarios.push({
67
- scenarioRef: output.scenarioRef,
68
- name: output.name,
69
- status: output.status,
70
- stepsCount: output.stepsCount
66
+ status: "passed",
67
+ duration: 2678000000
68
+ },
69
+ embeddings: (screenshot) ? [{
70
+ data: screenshot.toString("base64"),
71
+ mime_type: "image/png"
72
+ }] : undefined,
73
+ }
74
+ ],
75
+ }
76
+ }, headers(token))).data.scenarios;
77
+ scenarios.push({
78
+ scenarioRef: output.scenarioRef,
79
+ name: output.name,
80
+ status: output.status,
81
+ stepsCount: output.stepsCount
82
+ });
83
+ return scenarios;
71
84
  });
72
- return scenarios;
73
85
  }
74
- export async function uploadFeature(scenarioId, scenarioName, uri, hasFailed) {
75
- let token = await auth();
76
- return (await axios.post(config.auxtaURL + "create-feature", {
77
- json: {
78
- name: scenarioName,
79
- uri: uri
80
- },
81
- scenarios: scenarioId,
82
- hasFailed: hasFailed
83
- }, headers(token))).data;
84
- }
85
- export async function updateReport(reportId, feature, steps, isFinal) {
86
- let token = await auth();
87
- await axios.post(config.auxtaURL + "update-inprogress-report", {
88
- reportId: reportId,
89
- isFinal: isFinal,
90
- data: {
91
- feature: {
92
- featureRef: feature.featureId,
93
- name: feature.featureName,
94
- uri: feature.featureUri,
95
- status: feature.status,
96
- scenariosCount: feature.scenariosCount
86
+ export function uploadFeature(scenarioId, scenarioName, uri, hasFailed) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ let token = yield auth();
89
+ return (yield axios.post(config.auxtaURL + "create-feature", {
90
+ json: {
91
+ name: scenarioName,
92
+ uri: uri
97
93
  },
98
- ...steps
99
- }
100
- }, headers(token));
94
+ scenarios: scenarioId,
95
+ hasFailed: hasFailed
96
+ }, headers(token))).data;
97
+ });
101
98
  }
102
- export async function getReport(reportId) {
103
- let token = await auth();
104
- return (await axios.post(config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
99
+ export function updateReport(reportId, feature, steps, isFinal) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ let token = yield auth();
102
+ yield axios.post(config.auxtaURL + "update-inprogress-report", {
103
+ reportId: reportId,
104
+ isFinal: isFinal,
105
+ data: Object.assign({ feature: {
106
+ featureRef: feature.featureId,
107
+ name: feature.featureName,
108
+ uri: feature.featureUri,
109
+ status: feature.status,
110
+ scenariosCount: feature.scenariosCount
111
+ } }, steps)
112
+ }, headers(token));
113
+ });
105
114
  }
106
- export async function getLastDayResults() {
107
- let token = await auth();
108
- return (await axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
115
+ export function getReport(reportId) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ let token = yield auth();
118
+ return (yield axios.post(config.auxtaURL + "get-report", { reportId: reportId }, headers(token))).data;
119
+ });
109
120
  }
110
- export async function postNotifications(body) {
111
- let token = await auth();
112
- await axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
113
- environmentName: body.environment,
114
- digitalProductName: body.digitalProduct,
115
- organizationName: body.organization,
116
- reportId: body.reportId,
117
- }, headers(token));
121
+ export function getLastDayResults() {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ let token = yield auth();
124
+ return (yield axios.get(config.auxtaURL + `get-last-day-results?url=${config.baseURL}`, headers(token))).data.results;
125
+ });
118
126
  }
119
- export async function postNotificationsOnFail(body) {
120
- let token = await auth();
121
- await axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
122
- environmentName: body.environment,
123
- digitalProductName: body.digitalProduct,
124
- organizationName: body.organization,
125
- reportId: body.reportId,
126
- }, headers(token));
127
+ export function postNotifications(body) {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ let token = yield auth();
130
+ yield axios.post(`${config.auxtaURL}post-notification-after-run-background`, {
131
+ environmentName: body.environment,
132
+ digitalProductName: body.digitalProduct,
133
+ organizationName: body.organization,
134
+ reportId: body.reportId,
135
+ }, headers(token));
136
+ });
137
+ }
138
+ export function postNotificationsOnFail(body) {
139
+ return __awaiter(this, void 0, void 0, function* () {
140
+ let token = yield auth();
141
+ yield axios.post(`${config.auxtaURL}post-notifications-after-case-fail-background`, {
142
+ environmentName: body.environment,
143
+ digitalProductName: body.digitalProduct,
144
+ organizationName: body.organization,
145
+ reportId: body.reportId,
146
+ }, headers(token));
147
+ });
127
148
  }
@@ -1,18 +1,29 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import puppeteer from "../../puppeteer/puppeteer";
2
- export async function captureScreenshot() {
3
- try {
4
- const pages = await puppeteer.defaultPage.browser().pages();
5
- if (!pages.length)
6
- return undefined;
7
- const lastPage = pages[pages.length - 1] || puppeteer.defaultPage;
8
- const screenshotBuffer = await lastPage.screenshot({
9
- fullPage: true,
10
- encoding: 'binary'
11
- });
12
- if (Buffer.isBuffer(screenshotBuffer))
13
- return screenshotBuffer;
14
- }
15
- catch (e) {
16
- }
17
- return undefined;
11
+ export function captureScreenshot() {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ try {
14
+ const pages = yield puppeteer.defaultPage.browser().pages();
15
+ if (!pages.length)
16
+ return undefined;
17
+ const lastPage = pages[pages.length - 1] || puppeteer.defaultPage;
18
+ const screenshotBuffer = yield lastPage.screenshot({
19
+ fullPage: true,
20
+ encoding: 'binary'
21
+ });
22
+ if (Buffer.isBuffer(screenshotBuffer))
23
+ return screenshotBuffer;
24
+ }
25
+ catch (e) {
26
+ }
27
+ return undefined;
28
+ });
18
29
  }
@@ -1,14 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import axios from 'axios';
2
11
  import { config } from "../configs/config";
3
- export async function startSuite(suites, reportId) {
4
- if (suites.length === 0)
5
- return;
6
- const next = suites.shift();
7
- console.log('Starting next suite: ' + next);
8
- try {
9
- await axios.post(`${config.netlifyPath}.netlify/functions/${next}?token=${config.token}`, { nextSuites: suites, reportId: reportId });
10
- }
11
- catch (e) {
12
- await startSuite(suites, reportId);
13
- }
12
+ export function startSuite(suites, reportId) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ if (suites.length === 0)
15
+ return;
16
+ const next = suites.shift();
17
+ console.log('Starting next suite: ' + next);
18
+ try {
19
+ yield axios.post(`${config.netlifyPath}.netlify/functions/${next}?token=${config.token}`, { nextSuites: suites, reportId: reportId });
20
+ }
21
+ catch (e) {
22
+ yield startSuite(suites, reportId);
23
+ }
24
+ });
14
25
  }
@@ -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;