@auxcode/auxta 1.3.99 → 1.3.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/AuxTA.d.ts CHANGED
@@ -23,6 +23,7 @@ declare class AuxTA extends FunctionHelper {
23
23
  email: string;
24
24
  password: string;
25
25
  };
26
+ timezone: string;
26
27
  };
27
28
  email: import("./macros/helpers/emailHelper").EmailHelper;
28
29
  private readonly uploadModel;
@@ -16,6 +16,7 @@ export declare function setupConfig(jsonConfig: any): {
16
16
  email: string;
17
17
  password: string;
18
18
  };
19
+ timezone: string;
19
20
  };
20
21
  export declare function setupOverrideConfig(overrideConfig: any): {
21
22
  auxtaURL: string;
@@ -35,6 +36,7 @@ export declare function setupOverrideConfig(overrideConfig: any): {
35
36
  email: string;
36
37
  password: string;
37
38
  };
39
+ timezone: string;
38
40
  };
39
41
  export declare let config: {
40
42
  auxtaURL: string;
@@ -54,4 +56,5 @@ export declare let config: {
54
56
  email: string;
55
57
  password: string;
56
58
  };
59
+ timezone: string;
57
60
  };
@@ -2,12 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.config = exports.setupOverrideConfig = exports.setupConfig = void 0;
4
4
  function setupConfig(jsonConfig) {
5
- if (!jsonConfig.auxtaURL)
6
- throw new Error("auxtaURL missing");
7
- exports.config.auxtaURL = jsonConfig.auxtaURL;
8
5
  if (!jsonConfig.baseURL)
9
6
  throw new Error("baseURL");
10
7
  exports.config.baseURL = jsonConfig.baseURL;
8
+ if (!jsonConfig.auxtaURL)
9
+ throw new Error("auxtaURL missing");
10
+ exports.config.auxtaURL = jsonConfig.auxtaURL;
11
+ if (!jsonConfig.timezone)
12
+ throw new Error("auxtaURL missing");
13
+ exports.config.timezone = jsonConfig.timezone;
11
14
  if (!jsonConfig.digitalProduct)
12
15
  throw new Error("digitalProduct");
13
16
  exports.config.digitalProduct = jsonConfig.digitalProduct;
@@ -69,4 +72,5 @@ exports.config = {
69
72
  email: "",
70
73
  password: "",
71
74
  },
75
+ timezone: ""
72
76
  };
@@ -16,6 +16,7 @@ export interface Steps {
16
16
  suggestedSteps: number;
17
17
  performanceFailure: number;
18
18
  }
19
+ export declare function setTimeZone(): Promise<string>;
19
20
  export declare function createEmptyReport(body: any): Promise<string>;
20
21
  export declare function uploadStep(stepLog: Step[], scenarioName: string, screenshot?: Buffer, errMessage?: object): Promise<{
21
22
  stepRef: any;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getVerifyReceivedEmail = exports.postNotificationsOnFail = exports.postNotifications = exports.compareScreenshots = exports.getLastDayResults = exports.getReport = exports.updateReport = exports.uploadScenario = exports.uploadStep = exports.createEmptyReport = void 0;
15
+ exports.getVerifyReceivedEmail = exports.postNotificationsOnFail = exports.postNotifications = exports.compareScreenshots = exports.getLastDayResults = exports.getReport = exports.updateReport = exports.uploadScenario = exports.uploadStep = exports.createEmptyReport = exports.setTimeZone = void 0;
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  const config_1 = require("../configs/config");
18
18
  function headers(token) {
@@ -52,14 +52,24 @@ function auth() {
52
52
  return token;
53
53
  });
54
54
  }
55
+ function setTimeZone() {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const token = yield auth();
58
+ return (yield axios_1.default.post(config_1.config.auxtaURL + "set-timezone", {
59
+ organization: config_1.config.organization
60
+ }, headers(token))).data;
61
+ });
62
+ }
63
+ exports.setTimeZone = setTimeZone;
55
64
  function createEmptyReport(body) {
56
65
  return __awaiter(this, void 0, void 0, function* () {
57
66
  const token = yield auth();
67
+ const moment = require('moment-timezone');
58
68
  return (yield axios_1.default.post(config_1.config.auxtaURL + "create-empty-report", {
59
69
  environment: body.environment,
60
70
  digitalProductToken: body.digitalProduct,
61
71
  bucket: body.bucket,
62
- start: new Date(),
72
+ start: moment().tz(config_1.config.timezone),
63
73
  url: body.baseUrl
64
74
  }, headers(token))).data.reportId;
65
75
  });
@@ -123,9 +133,11 @@ exports.uploadScenario = uploadScenario;
123
133
  function updateReport(reportId, scenario, steps, isFinal) {
124
134
  return __awaiter(this, void 0, void 0, function* () {
125
135
  let token = yield auth();
136
+ const moment = require('moment-timezone');
126
137
  yield axios_1.default.post(config_1.config.auxtaURL + "update-inprogress-report", {
127
138
  reportId: reportId,
128
139
  isFinal: isFinal,
140
+ end: moment().tz(config_1.config.timezone),
129
141
  data: Object.assign({ scenario: {
130
142
  scenarioRef: scenario.scenarioId,
131
143
  name: scenario.scenarioName,
@@ -108,27 +108,29 @@ class Puppeteer {
108
108
  }
109
109
  catch (err) {
110
110
  console.log("Error message: \n", err);
111
- let browser_start_retry = err.toString().includes("Failed to launch the browser process!");
112
- const pages = yield this.defaultPage.browser().pages();
113
- consoleMessage.push('pages');
114
- consoleMessage.push(pages.length);
115
- if (browser_start_retry) {
116
- const result = yield (0, start_suite_helper_1.retrySuite)(uploadModel.nextSuites, uploadModel.reportId, uploadModel.currentSuite, uploadModel.retries);
117
- if (!result) {
118
- return yield (0, report_hook_1.onTestEnd)(uploadModel, featureName, scenarioName, statusCode, screenshotBuffer, !errMessage ? undefined : {
119
- currentPageUrl: 'undefined',
120
- console: consoleMessage,
121
- https: httpsMessage,
122
- error: 'Browser did not open'
123
- });
111
+ if (process.env.ENVIRONMENT !== 'LOCAL') {
112
+ let browser_start_retry = err.toString().includes("Failed to launch the browser process!");
113
+ const pages = yield this.defaultPage.browser().pages();
114
+ consoleMessage.push('pages');
115
+ consoleMessage.push(pages.length);
116
+ if (browser_start_retry) {
117
+ const result = yield (0, start_suite_helper_1.retrySuite)(uploadModel.nextSuites, uploadModel.reportId, uploadModel.currentSuite, uploadModel.retries);
118
+ if (!result) {
119
+ return yield (0, report_hook_1.onTestEnd)(uploadModel, featureName, scenarioName, statusCode, screenshotBuffer, !errMessage ? undefined : {
120
+ currentPageUrl: 'undefined',
121
+ console: consoleMessage,
122
+ https: httpsMessage,
123
+ error: 'Browser did not open'
124
+ });
125
+ }
126
+ return { statusCode: 204 };
124
127
  }
125
- return { statusCode: 204 };
128
+ errMessage = err;
129
+ statusCode = 500;
130
+ screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshot)();
131
+ log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
132
+ yield (0, report_service_1.postNotificationsOnFail)(uploadModel);
126
133
  }
127
- errMessage = err;
128
- statusCode = 500;
129
- screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshot)();
130
- log_service_1.default.push('When', log_service_1.default.tag, `Finished puppeteer process`, status_of_step_1.StatusOfStep.FAILED);
131
- yield (0, report_service_1.postNotificationsOnFail)(uploadModel);
132
134
  }
133
135
  let url = this.defaultPage.url();
134
136
  if (close)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "1.3.99",
3
+ "version": "1.3.101",
4
4
  "description": "",
5
5
  "main": "./build/AuxTA.js",
6
6
  "types": "./build/AuxTA.d.ts",
@@ -22,6 +22,7 @@
22
22
  "fs": "^0.0.1-security",
23
23
  "googleapis": "^118.0.0",
24
24
  "js-base64": "^3.7.5",
25
+ "moment-timezone": "^0.5.45",
25
26
  "node-2fa": "^2.0.3",
26
27
  "nodemailer": "^6.9.9",
27
28
  "puppeteer": "^22.0.0",